From: Józef Kucia Subject: [PATCH vkd3d 4/5] vkd3d: Use vk_append_struct() in more places. Message-Id: <20190706053633.11077-4-joseph.kucia@gmail.com> Date: Sat, 6 Jul 2019 07:36:32 +0200 From: Józef Kucia Signed-off-by: Józef Kucia --- libs/vkd3d/device.c | 38 ++++++++++++++++---------------------- libs/vkd3d/state.c | 10 ---------- libs/vkd3d/vkd3d_private.h | 10 ++++++++++ 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 3cc224992742..0060afe475a3 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -84,12 +84,6 @@ static const void *vkd3d_find_struct_(const struct vkd3d_struct *chain, return NULL; } -struct vk_struct -{ - VkStructureType sType; - struct vk_struct *pNext; -}; - static uint32_t vkd3d_get_vk_version(void) { int major, minor; @@ -716,40 +710,40 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i xfb_features = &info->xfb_features; xfb_properties = &info->xfb_properties; + info->features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + conditional_rendering_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT; + vk_append_struct(&info->features2, conditional_rendering_features); depth_clip_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - depth_clip_features->pNext = conditional_rendering_features; + vk_append_struct(&info->features2, depth_clip_features); descriptor_indexing_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT; - descriptor_indexing_features->pNext = depth_clip_features; + vk_append_struct(&info->features2, descriptor_indexing_features); demote_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT; - demote_features->pNext = descriptor_indexing_features; + vk_append_struct(&info->features2, demote_features); buffer_alignment_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - buffer_alignment_features->pNext = demote_features; + vk_append_struct(&info->features2, buffer_alignment_features); xfb_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - xfb_features->pNext = buffer_alignment_features; + vk_append_struct(&info->features2, xfb_features); vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - vertex_divisor_features->pNext = xfb_features; - - info->features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; - info->features2.pNext = vertex_divisor_features; + vk_append_struct(&info->features2, vertex_divisor_features); if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2)); else VK_CALL(vkGetPhysicalDeviceFeatures(physical_device, &info->features2.features)); + info->properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + maintenance3_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; + vk_append_struct(&info->properties2, maintenance3_properties); descriptor_indexing_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT; - descriptor_indexing_properties->pNext = maintenance3_properties; + vk_append_struct(&info->properties2, descriptor_indexing_properties); buffer_alignment_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT; - buffer_alignment_properties->pNext = descriptor_indexing_properties; + vk_append_struct(&info->properties2, buffer_alignment_properties); xfb_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; - xfb_properties->pNext = buffer_alignment_properties; + vk_append_struct(&info->properties2, xfb_properties); vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; - vertex_divisor_properties->pNext = xfb_properties; - - info->properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; - info->properties2.pNext = vertex_divisor_properties; + vk_append_struct(&info->properties2, vertex_divisor_properties); if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2)); diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 59a70b92be99..45d543535a3e 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -19,16 +19,6 @@ #include "vkd3d_private.h" -static void vk_append_struct(void *h, void *structure) -{ - VkBaseOutStructure *header = h; - - while (header->pNext) - header = header->pNext; - - header->pNext = structure; -} - /* ID3D12RootSignature */ static inline struct d3d12_root_signature *impl_from_ID3D12RootSignature(ID3D12RootSignature *iface) { diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 6fe852492a67..9255580d9b05 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -1215,4 +1215,14 @@ VkResult vkd3d_set_vk_object_name_utf8(struct d3d12_device *device, uint64_t vk_ HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object, VkDebugReportObjectTypeEXT vk_object_type, const WCHAR *name) DECLSPEC_HIDDEN; +static inline void vk_append_struct(void *h, void *structure) +{ + VkBaseOutStructure *header = h; + + while (header->pNext) + header = header->pNext; + + header->pNext = structure; +} + #endif /* __VKD3D_PRIVATE_H */ -- 2.21.0