nvk: align desc root table
authorKarol Herbst <kherbst@redhat.com>
Mon, 29 Aug 2022 00:31:19 +0000 (02:31 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:32:02 +0000 (21:32 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_cmd_buffer.h
src/nouveau/vulkan/nvk_cmd_dispatch.c

index abf6d44..dda3d2f 100644 (file)
@@ -42,6 +42,9 @@ struct nvk_root_descriptor_table {
 
    /* Dynamic buffer bindings */
    struct nvk_buffer_address dynamic_buffers[NVK_MAX_DYNAMIC_BUFFERS];
+
+   /* enfore alignment to 0x100 as needed pre pascal */
+   uint8_t __padding[0x20];
 };
 
 /* helper macro for computing root descriptor byte offsets */
index bdbdc16..fab2d63 100644 (file)
@@ -121,6 +121,11 @@ nvk_flush_compute_state(struct nvk_cmd_buffer *cmd,
    desc->root.cs.block_size[1] = shader->cp.block_size[1];
    desc->root.cs.block_size[2] = shader->cp.block_size[2];
 
+   /* pre Pascal the constant buffer sizes need to be 0x100 aligned. As we simply allocated a
+    * buffer and upload data to it, make sure its size is 0x100 aligned.
+    */
+   STATIC_ASSERT((sizeof(desc->root) & 0xff) == 0);
+
    uint64_t root_desc_addr;
    result = nvk_cmd_buffer_upload_data(cmd, &desc->root, sizeof(desc->root),
                                        NVK_MIN_UBO_ALIGNMENT,