mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
vulkan/format: don't assign an uneeded boolean
We don't actually need the basics_primary/secondary boolean. The returned format is decided by the requested usage with fallbacks as necessary. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
This commit is contained in:
parent
420548a6c6
commit
634fc913a6
1 changed files with 14 additions and 29 deletions
|
@ -581,10 +581,6 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
int i;
|
int i;
|
||||||
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
||||||
VkPhysicalDevice gpu;
|
VkPhysicalDevice gpu;
|
||||||
const VkFormatFeatureFlagBits2KHR basic_flags =
|
|
||||||
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT |
|
|
||||||
VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT |
|
|
||||||
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT;
|
|
||||||
VkFormatProperties2 prop = {
|
VkFormatProperties2 prop = {
|
||||||
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||||
};
|
};
|
||||||
|
@ -603,7 +599,6 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
for (i = 0; i < G_N_ELEMENTS (vk_formats_map); i++) {
|
||||||
gboolean basics_primary = FALSE, basics_secondary = FALSE;
|
|
||||||
guint64 feats_primary = 0, feats_secondary = 0;
|
guint64 feats_primary = 0, feats_secondary = 0;
|
||||||
VkImageUsageFlags usage = 0;
|
VkImageUsageFlags usage = 0;
|
||||||
|
|
||||||
|
@ -618,7 +613,6 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||||
prop.formatProperties.linearTilingFeatures :
|
prop.formatProperties.linearTilingFeatures :
|
||||||
prop.formatProperties.optimalTilingFeatures;
|
prop.formatProperties.optimalTilingFeatures;
|
||||||
basics_primary = (feats_primary & basic_flags) == basic_flags;
|
|
||||||
|
|
||||||
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,
|
||||||
|
@ -627,9 +621,6 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
|
||||||
prop.formatProperties.linearTilingFeatures :
|
prop.formatProperties.linearTilingFeatures :
|
||||||
prop.formatProperties.optimalTilingFeatures;
|
prop.formatProperties.optimalTilingFeatures;
|
||||||
basics_secondary = (feats_secondary & basic_flags) == basic_flags;
|
|
||||||
} else {
|
|
||||||
basics_secondary = basics_primary;
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
@ -640,11 +631,10 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
feats_primary = feats_secondary = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
feats_primary = feats_secondary = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
||||||
| VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
|
| VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
|
||||||
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
|
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
|
||||||
basics_primary = basics_secondary = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_VIDEO_INFO_IS_RGB (info)) {
|
if (GST_VIDEO_INFO_IS_RGB (info)) {
|
||||||
if (basics_primary && (GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
if ((GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
||||||
GST_VIDEO_TRANSFER_SRGB
|
GST_VIDEO_TRANSFER_SRGB
|
||||||
|| GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
|| GST_VIDEO_INFO_COLORIMETRY (info).transfer ==
|
||||||
GST_VIDEO_TRANSFER_UNKNOWN)) {
|
GST_VIDEO_TRANSFER_UNKNOWN)) {
|
||||||
|
@ -660,9 +650,7 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basics_secondary
|
if (GST_VIDEO_INFO_COLORIMETRY (info).transfer != GST_VIDEO_TRANSFER_SRGB) {
|
||||||
&& GST_VIDEO_INFO_COLORIMETRY (info).transfer !=
|
|
||||||
GST_VIDEO_TRANSFER_SRGB) {
|
|
||||||
usage = _get_usage (feats_secondary);
|
usage = _get_usage (feats_secondary);
|
||||||
if ((requested_usage & usage) == requested_usage) {
|
if ((requested_usage & usage) == requested_usage) {
|
||||||
if (fmts)
|
if (fmts)
|
||||||
|
@ -676,8 +664,7 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (basics_primary && !no_multiplane
|
if (!no_multiplane && GST_VIDEO_INFO_N_PLANES (info) > 1) {
|
||||||
&& GST_VIDEO_INFO_N_PLANES (info) > 1) {
|
|
||||||
usage = _get_usage (feats_primary);
|
usage = _get_usage (feats_primary);
|
||||||
if ((requested_usage & usage) == requested_usage) {
|
if ((requested_usage & usage) == requested_usage) {
|
||||||
if (fmts)
|
if (fmts)
|
||||||
|
@ -690,20 +677,18 @@ gst_vulkan_format_from_video_info_2 (GstVulkanPhysicalDevice * physical_device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basics_secondary) {
|
usage = _get_usage (feats_secondary);
|
||||||
usage = _get_usage (feats_secondary);
|
if ((requested_usage & usage) == requested_usage) {
|
||||||
if ((requested_usage & usage) == requested_usage) {
|
if (fmts) {
|
||||||
if (fmts) {
|
memcpy (fmts, vk_formats_map[i].vkfrmts,
|
||||||
memcpy (fmts, vk_formats_map[i].vkfrmts,
|
GST_VIDEO_MAX_PLANES * sizeof (VkFormat));
|
||||||
GST_VIDEO_MAX_PLANES * sizeof (VkFormat));
|
|
||||||
}
|
|
||||||
if (n_imgs)
|
|
||||||
*n_imgs = GST_VIDEO_INFO_N_PLANES (info);
|
|
||||||
if (usage_ret)
|
|
||||||
*usage_ret = usage;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
if (n_imgs)
|
||||||
|
*n_imgs = GST_VIDEO_INFO_N_PLANES (info);
|
||||||
|
if (usage_ret)
|
||||||
|
*usage_ret = usage;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue