mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +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,26 +603,29 @@ 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 (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info))
|
||||
continue;
|
||||
if (gst_vkGetPhysicalDeviceFormatProperties2) {
|
||||
if (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info))
|
||||
continue;
|
||||
|
||||
vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt, &prop);
|
||||
|
||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
prop.formatProperties.optimalTilingFeatures;
|
||||
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],
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
|
||||
&prop);
|
||||
|
||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
prop.formatProperties.optimalTilingFeatures;
|
||||
basics_secondary = (feats_secondary & basic_flags) == basic_flags;
|
||||
} else {
|
||||
basics_secondary = basics_primary;
|
||||
basics_primary = (feats_primary & basic_flags) == basic_flags;
|
||||
|
||||
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu,
|
||||
vk_formats_map[i].vkfrmts[0], &prop);
|
||||
|
||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
prop.formatProperties.optimalTilingFeatures;
|
||||
basics_secondary = (feats_secondary & basic_flags) == basic_flags;
|
||||
} else {
|
||||
basics_secondary = basics_primary;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue