vulkan/format: use basic features (v1) as fallback

if vkGetPhysicalDeviceFormatProperties2 isn't available.

This approach assumes that, for basic features flags symbols,
VkFormatFeatureFlagBits and VkFormatFeatureFlagBits2 are binary equivalent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4746>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-06-01 11:55:34 +02:00 committed by GStreamer Marge Bot
parent 0a74a967e3
commit 06d793033d

View file

@ -602,11 +602,11 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
gboolean basics_primary = FALSE, basics_secondary = FALSE; gboolean basics_primary = FALSE, basics_secondary = FALSE;
guint64 feats_primary = 0, feats_secondary = 0; guint64 feats_primary = 0, feats_secondary = 0;
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
if (gst_vkGetPhysicalDeviceFormatProperties2) {
if (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info)) if (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info))
continue; continue;
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
if (gst_vkGetPhysicalDeviceFormatProperties2) {
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt, gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
&prop); &prop);
@ -626,8 +626,16 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
} else { } else {
basics_secondary = basics_primary; basics_secondary = basics_primary;
} }
} } else
#endif #endif
{
/* XXX: VkFormatFeatureFlagBits and VkFormatFeatureFlagBits2 are the same
* values for basic_flags' symbols and they are defined in
* VK_VERSION_1_0 */
basics_primary = basics_secondary = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
| VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
}
if (GST_VIDEO_INFO_IS_RGB (info)) { if (GST_VIDEO_INFO_IS_RGB (info)) {
if (basics_primary && GST_VIDEO_INFO_COLORIMETRY (info).transfer != if (basics_primary && GST_VIDEO_INFO_COLORIMETRY (info).transfer !=