mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
vulkan/format: don't rely on vulkan header version for function availability
e.g. android will have update vulkan.h headers but old platforms will not contain the function and will result in a link error. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4746>
This commit is contained in:
parent
37aab17be3
commit
0a74a967e3
1 changed files with 28 additions and 15 deletions
|
@ -584,8 +584,18 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
VkFormatProperties2 prop = {
|
||||
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||
};
|
||||
PFN_vkGetPhysicalDeviceFormatProperties2
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 = NULL;
|
||||
|
||||
gpu = gst_vulkan_physical_device_get_handle (physical_device);
|
||||
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 =
|
||||
gst_vulkan_instance_get_proc_address (physical_device->instance,
|
||||
"vkGetPhysicalDeviceFormatProperties2");
|
||||
if (!gst_vkGetPhysicalDeviceFormatProperties2)
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 =
|
||||
gst_vulkan_instance_get_proc_address (physical_device->instance,
|
||||
"vkGetPhysicalDeviceFormatProperties2KHR");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
||||
|
@ -593,10 +603,12 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
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))
|
||||
continue;
|
||||
|
||||
vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt, &prop);
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
|
||||
&prop);
|
||||
|
||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
|
@ -604,8 +616,8 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
basics_primary = (feats_primary & basic_flags) == basic_flags;
|
||||
|
||||
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
||||
vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmts[0],
|
||||
&prop);
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu,
|
||||
vk_formats_map[i].vkfrmts[0], &prop);
|
||||
|
||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
|
@ -614,6 +626,7 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
} else {
|
||||
basics_secondary = basics_primary;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GST_VIDEO_INFO_IS_RGB (info)) {
|
||||
|
|
Loading…
Reference in a new issue