Mesa (main): turnip: Allow image access on swapped formats.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Apr 2 20:16:29 UTC 2022


Module: Mesa
Branch: main
Commit: e1de9b0de5ecc3877b1ab9bcb17f043272b91f8c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1de9b0de5ecc3877b1ab9bcb17f043272b91f8c

Author: Emma Anholt <emma at anholt.net>
Date:   Fri Mar  4 11:57:32 2022 -0800

turnip: Allow image access on swapped formats.

This is apparently something that gamescope would like to have, and the
CTS's test coverage is happy with it.

Fixes: #6011 (we hope)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15293>

---

 src/freedreno/vulkan/tu_formats.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 9cc38cf4055..429c898e5c0 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -212,24 +212,14 @@ tu_physical_device_get_format_properties(
    if (supported_color) {
       assert(supported_tex);
       optimal |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
-                 VK_FORMAT_FEATURE_BLIT_DST_BIT;
-
-      /* IBO's don't have a swap field at all, so swapped formats can't be
-       * supported, even with linear images.
-       *
-       * TODO: See if setting the swap field from the tex descriptor works,
-       * after we enable shaderStorageImageReadWithoutFormat and there are
-       * tests for these formats.
-       */
-      struct tu_native_format tex = tu6_format_texture(format, TILE6_LINEAR);
-      if (tex.swap == WZYX && tex.fmt != FMT6_1_5_5_5_UNORM) {
-         optimal |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT |
-                    VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
-                    VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR;
-         buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT |
-                   VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
-                   VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR;
-      }
+                 VK_FORMAT_FEATURE_BLIT_DST_BIT |
+                 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT |
+                 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
+                 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR;
+
+      buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT |
+                VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT |
+                VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR;
 
       /* TODO: The blob also exposes these for R16G16_UINT/R16G16_SINT, but we
        * don't have any tests for those.



More information about the mesa-commit mailing list