Mesa (main): turnip: Use the new shared buffer-view descriptor creation function.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 3 20:02:41 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Oct 19 11:46:21 2021 -0700

turnip: Use the new shared buffer-view descriptor creation function.

This cross-checks that our descriptors match as I move the code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13635>

---

 src/freedreno/vulkan/tu_image.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 089d07eef91..5172a4888f7 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -773,6 +773,31 @@ tu_buffer_view_init(struct tu_buffer_view *view,
       A6XX_TEX_CONST_2_UNK31;
    view->descriptor[4] = iova;
    view->descriptor[5] = iova >> 32;
+
+   uint32_t old_descriptor[FDL6_TEX_CONST_DWORDS];
+   memcpy(old_descriptor, view->descriptor, sizeof(old_descriptor));
+
+   uint8_t swiz[4] = { PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z,
+                       PIPE_SWIZZLE_W };
+
+   fdl6_buffer_view_init(
+      view->descriptor, tu_vk_format_to_pipe_format(pCreateInfo->format),
+      swiz, tu_buffer_iova(buffer) + pCreateInfo->offset, range);
+
+   bool diff = false;
+   for (int i = 0; i < ARRAY_SIZE(view->descriptor); i++) {
+      if (view->descriptor[i] != old_descriptor[i]) {
+         if (!diff) {
+            mesa_loge("Mismatch on buffer view %s",
+                      util_format_name(
+                         tu_vk_format_to_pipe_format(pCreateInfo->format)));
+            diff = true;
+         }
+         mesa_loge("CONST[%d] 0x%08x vs 0x%08x", i, old_descriptor[i],
+                   view->descriptor[i]);
+      }
+   }
+   assert(!diff);
 }
 
 VKAPI_ATTR VkResult VKAPI_CALL



More information about the mesa-commit mailing list