mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
vulkan/format: also get features in the fallback case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
This commit is contained in:
parent
634fc913a6
commit
f50b43c83b
1 changed files with 22 additions and 17 deletions
|
@ -579,16 +579,14 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
int *n_imgs, VkImageUsageFlags * usage_ret)
|
||||
{
|
||||
int i;
|
||||
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
||||
VkPhysicalDevice gpu;
|
||||
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
||||
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");
|
||||
|
@ -598,8 +596,12 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
"vkGetPhysicalDeviceFormatProperties2KHR");
|
||||
#endif
|
||||
|
||||
gpu = gst_vulkan_physical_device_get_handle (physical_device);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
||||
guint64 feats_primary = 0, feats_secondary = 0;
|
||||
VkFormatProperties primary_format_props = { 0, };
|
||||
VkFormatProperties secondary_format_props = { 0, };
|
||||
VkImageUsageFlags usage = 0;
|
||||
|
||||
if (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info))
|
||||
|
@ -609,30 +611,33 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
|||
if (gst_vkGetPhysicalDeviceFormatProperties2) {
|
||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
|
||||
&prop);
|
||||
|
||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
prop.formatProperties.linearTilingFeatures :
|
||||
prop.formatProperties.optimalTilingFeatures;
|
||||
primary_format_props = prop.formatProperties;
|
||||
|
||||
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;
|
||||
secondary_format_props = prop.formatProperties;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* XXX: VkFormatFeatureFlagBits and VkFormatFeatureFlagBits2 are the same
|
||||
* values for basic_flags' symbols and they are defined in
|
||||
* VK_VERSION_1_0 */
|
||||
feats_primary = feats_secondary = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
||||
| VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
|
||||
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
|
||||
vkGetPhysicalDeviceFormatProperties (gpu, vk_formats_map[i].vkfrmt,
|
||||
&primary_format_props);
|
||||
|
||||
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
||||
vkGetPhysicalDeviceFormatProperties (gpu, vk_formats_map[i].vkfrmts[0],
|
||||
&secondary_format_props);
|
||||
}
|
||||
}
|
||||
|
||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
primary_format_props.linearTilingFeatures :
|
||||
primary_format_props.optimalTilingFeatures;
|
||||
|
||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||
secondary_format_props.linearTilingFeatures :
|
||||
secondary_format_props.optimalTilingFeatures;
|
||||
|
||||
if (GST_VIDEO_INFO_IS_RGB (info)) {
|
||||
if ((GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
||||
GST_VIDEO_TRANSFER_SRGB
|
||||
|
|
Loading…
Reference in a new issue