tu: Use vk_features2_to_features
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 30 Mar 2023 15:56:57 +0000 (11:56 -0400)
committerAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 7 Apr 2023 22:16:43 +0000 (18:16 -0400)
Sanitizes properties returned through GetPhysicalDeviceFormatProperties2.

Bit-31 is not valid to return in the original
vkGetPhysicalDeviceFormatProperties{2,}. Sanitize the bit returned from the
internal to ensure invalid bits aren't return to the application.

Falls in line with the other vulkan drivers.

Based on original commit by Ryan Houdek.

Closes: #8733
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>

src/freedreno/vulkan/tu_formats.cc

index 555d58a..9c2c28b 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "fdl/fd6_format_table.h"
 
+#include "vk_enum_defines.h"
 #include "vk_util.h"
 #include "drm-uapi/drm_fourcc.h"
 
@@ -373,9 +374,12 @@ tu_GetPhysicalDeviceFormatProperties2(
       physical_device, format, props3);
 
    pFormatProperties->formatProperties = (VkFormatProperties) {
-      .linearTilingFeatures = props3->linearTilingFeatures,
-      .optimalTilingFeatures = props3->optimalTilingFeatures,
-      .bufferFeatures = props3->bufferFeatures,
+      .linearTilingFeatures =
+         vk_format_features2_to_features(props3->linearTilingFeatures),
+      .optimalTilingFeatures =
+         vk_format_features2_to_features(props3->optimalTilingFeatures),
+      .bufferFeatures =
+         vk_format_features2_to_features(props3->bufferFeatures),
    };
 
    VkDrmFormatModifierPropertiesListEXT *list =