vulkan: Make vk_copy_struct_guts() public
authorChad Versace <chadversary@chromium.org>
Thu, 11 Aug 2022 19:16:32 +0000 (12:16 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 30 Aug 2022 08:09:55 +0000 (08:09 +0000)
Venus wants to copy struct guts too.

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18000>

src/vulkan/runtime/vk_device.c
src/vulkan/util/vk_util.h

index 57883a2..09b5893 100644 (file)
@@ -527,13 +527,6 @@ vk_common_DeviceWaitIdle(VkDevice _device)
    return VK_SUCCESS;
 }
 
-static void
-copy_vk_struct_guts(VkBaseOutStructure *dst, VkBaseInStructure *src, size_t struct_size)
-{
-   STATIC_ASSERT(sizeof(*dst) == sizeof(*src));
-   memcpy(dst + 1, src + 1, struct_size - sizeof(VkBaseOutStructure));
-}
-
 #define CORE_FEATURE(feature) features->feature = core->feature
 
 bool
@@ -585,7 +578,7 @@ vk_get_physical_device_core_1_1_feature_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
@@ -705,7 +698,7 @@ vk_get_physical_device_core_1_2_feature_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
@@ -799,7 +792,7 @@ vk_get_physical_device_core_1_3_feature_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
@@ -868,7 +861,7 @@ vk_get_physical_device_core_1_1_property_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
@@ -963,7 +956,7 @@ vk_get_physical_device_core_1_2_property_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
@@ -1049,7 +1042,7 @@ vk_get_physical_device_core_1_3_property_ext(struct VkBaseOutStructure *ext,
    }
 
    case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES:
-      copy_vk_struct_guts(ext, (void *)core, sizeof(*core));
+      vk_copy_struct_guts(ext, (void *)core, sizeof(*core));
       return true;
 
    default:
index 8745986..ac60610 100644 (file)
@@ -108,6 +108,12 @@ vk_pnext_iterator_next(struct vk_pnext_iterator *iter)
       for (const VkBaseInStructure *__e = (VkBaseInStructure *)__iter.pos; \
            __e; __e = (VkBaseInStructure *)vk_pnext_iterator_next(&__iter))
 
+static inline void
+vk_copy_struct_guts(VkBaseOutStructure *dst, VkBaseInStructure *src, size_t struct_size)
+{
+   STATIC_ASSERT(sizeof(*dst) == sizeof(*src));
+   memcpy(dst + 1, src + 1, struct_size - sizeof(VkBaseOutStructure));
+}
 
 /**
  * A wrapper for a Vulkan output array. A Vulkan output array is one that