From 005cfc63fc750c34f120a440b8c65ed079d5bb11 Mon Sep 17 00:00:00 2001 From: Constantine Shablya Date: Fri, 7 Apr 2023 04:00:52 +0300 Subject: [PATCH] vulkan: put interesting code before boring code Reviewed-by: Faith Ekstrand Part-of: --- src/vulkan/util/vk_physical_device_features.py | 64 +++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/vulkan/util/vk_physical_device_features.py b/src/vulkan/util/vk_physical_device_features.py index a971341..53a61ff 100644 --- a/src/vulkan/util/vk_physical_device_features.py +++ b/src/vulkan/util/vk_physical_device_features.py @@ -236,14 +236,32 @@ vk_physical_device_check_device_features(struct vk_physical_device *physical_dev return VK_SUCCESS; } -void -vk_set_physical_device_features_1_0(struct vk_features *all_features, - const VkPhysicalDeviceFeatures *pFeatures) +VKAPI_ATTR void VKAPI_CALL +vk_common_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2 *pFeatures) { + VK_FROM_HANDLE(vk_physical_device, pdevice, physicalDevice); + % for flag in pdev_features: - if (pFeatures->${flag}) - all_features->${flag} = true; + pFeatures->features.${flag} = pdevice->supported_features.${flag}; +% endfor + + vk_foreach_struct(ext, pFeatures) { + switch (ext->sType) { +% for f in feature_structs: + case ${f.s_type}: { + ${f.c_type} *features = (void *) ext; +% for flag in f.features: + features->${flag} = pdevice->supported_features.${get_renamed_feature(f.c_type, flag)}; +% endfor + break; + } + % endfor + default: + break; + } + } } void @@ -275,32 +293,14 @@ vk_set_physical_device_features(struct vk_features *all_features, } } -VKAPI_ATTR void VKAPI_CALL -vk_common_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures2 *pFeatures) +void +vk_set_physical_device_features_1_0(struct vk_features *all_features, + const VkPhysicalDeviceFeatures *pFeatures) { - VK_FROM_HANDLE(vk_physical_device, pdevice, physicalDevice); - % for flag in pdev_features: - pFeatures->features.${flag} = pdevice->supported_features.${flag}; -% endfor - - vk_foreach_struct(ext, pFeatures) { - switch (ext->sType) { -% for f in feature_structs: - case ${f.s_type}: { - ${f.c_type} *features = (void *) ext; -% for flag in f.features: - features->${flag} = pdevice->supported_features.${get_renamed_feature(f.c_type, flag)}; -% endfor - break; - } - + if (pFeatures->${flag}) + all_features->${flag} = true; % endfor - default: - break; - } - } } """, output_encoding='utf-8') @@ -320,13 +320,13 @@ struct vk_features { }; void -vk_set_physical_device_features_1_0(struct vk_features *all_features, - const VkPhysicalDeviceFeatures *pFeatures); - -void vk_set_physical_device_features(struct vk_features *all_features, const VkPhysicalDeviceFeatures2 *pFeatures); +void +vk_set_physical_device_features_1_0(struct vk_features *all_features, + const VkPhysicalDeviceFeatures *pFeatures); + #ifdef __cplusplus } #endif -- 2.7.4