[FFmpeg-devel] [PATCH] avutil/hwcontext_vulkan: get VkFormatFeatureFlagBits2

Víctor Manuel Jáquez Leal vjaquez at igalia.com
Thu Nov 2 15:00:03 EET 2023


Rather than the VkFormatFeatureFlagBits enum

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez at igalia.com>
---
 libavutil/hwcontext_vulkan.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 8481427b42..506a218a42 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -298,8 +298,12 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p,
 
     for (int i = 0; i < nb_vk_formats_list; i++) {
         if (vk_formats_list[i].pixfmt == p) {
+            VkFormatProperties3 fprops = {
+                .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3,
+            };
             VkFormatProperties2 prop = {
                 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
+                .pNext = &fprops,
             };
             VkFormatFeatureFlagBits2 feats_primary, feats_secondary;
             int basics_primary = 0, basics_secondary = 0;
@@ -310,8 +314,7 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p,
                                                    &prop);
 
             feats_primary = tiling == VK_IMAGE_TILING_LINEAR ?
-                             prop.formatProperties.linearTilingFeatures :
-                             prop.formatProperties.optimalTilingFeatures;
+                             fprops.linearTilingFeatures : fprops.optimalTilingFeatures;
             basics_primary = (feats_primary & basic_flags) == basic_flags;
             storage_primary = !!(feats_primary & VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
 
@@ -320,8 +323,7 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p,
                                                        vk_formats_list[i].fallback[0],
                                                        &prop);
                 feats_secondary = tiling == VK_IMAGE_TILING_LINEAR ?
-                                  prop.formatProperties.linearTilingFeatures :
-                                  prop.formatProperties.optimalTilingFeatures;
+                                  fprops.linearTilingFeatures : fprops.optimalTilingFeatures;
                 basics_secondary = (feats_secondary & basic_flags) == basic_flags;
                 storage_secondary = !!(feats_secondary & VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
             } else {
-- 
2.42.0



More information about the ffmpeg-devel mailing list