summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmma Anholt <emma@anholt.net>2021-10-19 11:46:21 -0700
committerMarge Bot <emma+marge@anholt.net>2021-11-03 19:38:48 +0000
commitef1fb25787eff6bd931a855cf3d263d9c334071c (patch)
tree65a5d2b9584be55ccdca0cec0d6089120d2baf52
parentaa3074e5be4dc3fff51e1359fb21e00cf26031b7 (diff)
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>
-rw-r--r--src/freedreno/vulkan/tu_image.c25
1 files changed, 25 insertions, 0 deletions
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