vkd3d: Prepend pNext chain structures.

Order of structures doesn't matter so we can simply prepend instead of
apending.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-08-05 18:03:39 +02:00 committed by Alexandre Julliard
parent 8b49b6e057
commit 8df3bfc5c2
3 changed files with 19 additions and 20 deletions

View File

@ -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));

View File

@ -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)

View File

@ -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 */