mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +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 *n_imgs, VkImageUsageFlags * usage_ret)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
|
||||||
VkPhysicalDevice gpu;
|
VkPhysicalDevice gpu;
|
||||||
|
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
||||||
VkFormatProperties2 prop = {
|
VkFormatProperties2 prop = {
|
||||||
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||||
};
|
};
|
||||||
PFN_vkGetPhysicalDeviceFormatProperties2
|
PFN_vkGetPhysicalDeviceFormatProperties2
|
||||||
gst_vkGetPhysicalDeviceFormatProperties2 = NULL;
|
gst_vkGetPhysicalDeviceFormatProperties2 = NULL;
|
||||||
|
|
||||||
gpu = gst_vulkan_physical_device_get_handle (physical_device);
|
|
||||||
|
|
||||||
gst_vkGetPhysicalDeviceFormatProperties2 =
|
gst_vkGetPhysicalDeviceFormatProperties2 =
|
||||||
gst_vulkan_instance_get_proc_address (physical_device->instance,
|
gst_vulkan_instance_get_proc_address (physical_device->instance,
|
||||||
"vkGetPhysicalDeviceFormatProperties2");
|
"vkGetPhysicalDeviceFormatProperties2");
|
||||||
|
@ -598,8 +596,12 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
"vkGetPhysicalDeviceFormatProperties2KHR");
|
"vkGetPhysicalDeviceFormatProperties2KHR");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gpu = gst_vulkan_physical_device_get_handle (physical_device);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
||||||
guint64 feats_primary = 0, feats_secondary = 0;
|
guint64 feats_primary = 0, feats_secondary = 0;
|
||||||
|
VkFormatProperties primary_format_props = { 0, };
|
||||||
|
VkFormatProperties secondary_format_props = { 0, };
|
||||||
VkImageUsageFlags usage = 0;
|
VkImageUsageFlags usage = 0;
|
||||||
|
|
||||||
if (vk_formats_map[i].format != GST_VIDEO_INFO_FORMAT (info))
|
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) {
|
if (gst_vkGetPhysicalDeviceFormatProperties2) {
|
||||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
|
gst_vkGetPhysicalDeviceFormatProperties2 (gpu, vk_formats_map[i].vkfrmt,
|
||||||
&prop);
|
&prop);
|
||||||
|
primary_format_props = prop.formatProperties;
|
||||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
|
||||||
prop.formatProperties.linearTilingFeatures :
|
|
||||||
prop.formatProperties.optimalTilingFeatures;
|
|
||||||
|
|
||||||
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
||||||
gst_vkGetPhysicalDeviceFormatProperties2 (gpu,
|
gst_vkGetPhysicalDeviceFormatProperties2 (gpu,
|
||||||
vk_formats_map[i].vkfrmts[0], &prop);
|
vk_formats_map[i].vkfrmts[0], &prop);
|
||||||
|
secondary_format_props = prop.formatProperties;
|
||||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
|
||||||
prop.formatProperties.linearTilingFeatures :
|
|
||||||
prop.formatProperties.optimalTilingFeatures;
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* XXX: VkFormatFeatureFlagBits and VkFormatFeatureFlagBits2 are the same
|
vkGetPhysicalDeviceFormatProperties (gpu, vk_formats_map[i].vkfrmt,
|
||||||
* values for basic_flags' symbols and they are defined in
|
&primary_format_props);
|
||||||
* VK_VERSION_1_0 */
|
|
||||||
feats_primary = feats_secondary = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
if (vk_formats_map[i].vkfrmt != vk_formats_map[i].vkfrmts[0]) {
|
||||||
| VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
|
vkGetPhysicalDeviceFormatProperties (gpu, vk_formats_map[i].vkfrmts[0],
|
||||||
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
|
&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_IS_RGB (info)) {
|
||||||
if ((GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
if ((GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
||||||
GST_VIDEO_TRANSFER_SRGB
|
GST_VIDEO_TRANSFER_SRGB
|
||||||
|
|
Loading…
Reference in a new issue