nvk: fix transform feedback with multiple saved counters.
authorDave Airlie <airlied@redhat.com>
Thu, 7 Dec 2023 03:14:34 +0000 (13:14 +1000)
committerEric Engestrom <eric@engestrom.ch>
Fri, 8 Dec 2023 11:24:46 +0000 (11:24 +0000)
The SET_STREAM_OUT_BUFFER_LOAD_WRITE_POINTER registers have an
8 dword stride, but the code is only adding one dword between them
then the MME is calling an illegal method.

This is the simple fix, otherwise I think we'd have to multiply
somehow in the MME which seems pointless.

Fixes KHR-GL45.transform_feedback* on zink on nvk.

Fixes: 5fd7df4aa2c3 ("nvk: Support for vertex shader transform feedback")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26558>
(cherry picked from commit 1b27a6be20732b251648c5ca6f93e6c0a9279f7f)

.pick_status.json
src/nouveau/vulkan/nvk_cmd_buffer.c

index 6713728..fbaaede 100644 (file)
         "description": "nvk: fix transform feedback with multiple saved counters.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "5fd7df4aa2c36726d190ba06c6ce9f1c01da5d4a",
         "notes": null
index b6d7ee3..8fefcd5 100644 (file)
@@ -649,7 +649,8 @@ nvk_CmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer,
          struct nv_push *p = nvk_cmd_buffer_push(cmd, 6);
          P_IMMD(p, NVC597, SET_MME_DATA_FIFO_CONFIG, FIFO_SIZE_SIZE_4KB);
          P_1INC(p, NV9097, CALL_MME_MACRO(NVK_MME_XFB_COUNTER_LOAD));
-         P_INLINE_DATA(p, cb_idx);
+         /* The STREAM_OUT_BUFFER_LOAD_WRITE_POINTER registers are 8 dword stride */
+         P_INLINE_DATA(p, cb_idx * 8);
          P_INLINE_DATA(p, cb_addr >> 32);
          P_INLINE_DATA(p, cb_addr);
       } else {
@@ -658,7 +659,8 @@ nvk_CmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer,
          __push_immd(p, SUBC_NV9097, NV906F_SET_REFERENCE, 0);
 
          P_1INC(p, NV9097, CALL_MME_MACRO(NVK_MME_XFB_COUNTER_LOAD));
-         P_INLINE_DATA(p, cb_idx);
+         /* The STREAM_OUT_BUFFER_LOAD_WRITE_POINTER registers are 8 dword stride */
+         P_INLINE_DATA(p, cb_idx * 8);
          nv_push_update_count(p, 1);
          nvk_cmd_buffer_push_indirect_buffer(cmd, buffer, offset, 4);
       }