vulkan: put interesting code before boring code

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22333>
This commit is contained in:
Constantine Shablya
2023-04-07 04:00:52 +03:00
committed by Marge Bot
parent 64f4b277ea
commit 005cfc63fc

View File

@@ -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};
if (pFeatures->${flag})
all_features->${flag} = true;
% 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;
}
}
}
""", output_encoding='utf-8')
@@ -319,14 +319,14 @@ struct vk_features {
% endfor
};
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