=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Use vk_append_struct() in more places.

Alexandre Julliard julliard at winehq.org
Wed Jul 31 13:43:29 CDT 2019


Module: vkd3d
Branch: master
Commit: 56d260b40e26d8367e69838ca1c55abe93f6b87c
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=56d260b40e26d8367e69838ca1c55abe93f6b87c

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Sat Jul  6 07:36:32 2019 +0200

vkd3d: Use vk_append_struct() in more places.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 3cc2249..0060afe 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 59a70b9..45d5435 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 6fe8524..9255580 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 */




More information about the wine-cvs mailing list