From: Józef Kucia jkucia@codeweavers.com
Order of structures doesn't matter so we can simply prepend instead of apending.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/device.c | 24 ++++++++++++------------ libs/vkd3d/state.c | 4 ++-- libs/vkd3d/vkd3d_private.h | 11 +++++------ 3 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 18c7bf66c8a2..cb70578e9f4c 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -714,19 +714,19 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i 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); + vk_prepend_struct(&info->features2, conditional_rendering_features); depth_clip_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - vk_append_struct(&info->features2, depth_clip_features); + vk_prepend_struct(&info->features2, depth_clip_features); descriptor_indexing_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT; - vk_append_struct(&info->features2, descriptor_indexing_features); + vk_prepend_struct(&info->features2, descriptor_indexing_features); demote_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT; - vk_append_struct(&info->features2, demote_features); + vk_prepend_struct(&info->features2, demote_features); buffer_alignment_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - vk_append_struct(&info->features2, buffer_alignment_features); + vk_prepend_struct(&info->features2, buffer_alignment_features); xfb_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - vk_append_struct(&info->features2, xfb_features); + vk_prepend_struct(&info->features2, xfb_features); vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - vk_append_struct(&info->features2, vertex_divisor_features); + vk_prepend_struct(&info->features2, vertex_divisor_features);
if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2)); @@ -736,15 +736,15 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i 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); + vk_prepend_struct(&info->properties2, maintenance3_properties); descriptor_indexing_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT; - vk_append_struct(&info->properties2, descriptor_indexing_properties); + vk_prepend_struct(&info->properties2, descriptor_indexing_properties); buffer_alignment_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT; - vk_append_struct(&info->properties2, buffer_alignment_properties); + vk_prepend_struct(&info->properties2, buffer_alignment_properties); xfb_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; - vk_append_struct(&info->properties2, xfb_properties); + vk_prepend_struct(&info->properties2, xfb_properties); vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; - vk_append_struct(&info->properties2, vertex_divisor_properties); + vk_prepend_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 45d543535a3e..8ddbd4ff1b23 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1729,7 +1729,7 @@ static void rs_depth_clip_info_from_d3d12(VkPipelineRasterizationDepthClipStateC depth_clip_info->flags = 0; depth_clip_info->depthClipEnable = d3d12_desc->DepthClipEnable;
- vk_append_struct(vk_rs_desc, depth_clip_info); + vk_prepend_struct(vk_rs_desc, depth_clip_info); }
static void rs_stream_info_from_d3d12(VkPipelineRasterizationStateStreamCreateInfoEXT *stream_info, @@ -1750,7 +1750,7 @@ static void rs_stream_info_from_d3d12(VkPipelineRasterizationStateStreamCreateIn stream_info->flags = 0; stream_info->rasterizationStream = so_desc->RasterizedStream;
- vk_append_struct(vk_rs_desc, stream_info); + vk_prepend_struct(vk_rs_desc, stream_info); }
static enum VkStencilOp vk_stencil_op_from_d3d12(D3D12_STENCIL_OP op) diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4f2559c9ade9..51bfba967c7a 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -1233,14 +1233,13 @@ 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) +static inline void vk_prepend_struct(void *header, void *structure) { - VkBaseOutStructure *header = h; + VkBaseOutStructure *vk_header = header, *vk_structure = structure;
- while (header->pNext) - header = header->pNext; - - header->pNext = structure; + assert(!vk_structure->pNext); + vk_structure->pNext = vk_header->pNext; + vk_header->pNext = vk_structure; }
#endif /* __VKD3D_PRIVATE_H */