From f24bd5291596cc0c33ee56c60df2dade1ad3f142 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 29 Aug 2022 02:31:19 +0200 Subject: [PATCH] nvk: align desc root table Signed-off-by: Karol Herbst Part-of: --- src/nouveau/vulkan/nvk_cmd_buffer.h | 3 +++ src/nouveau/vulkan/nvk_cmd_dispatch.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.h b/src/nouveau/vulkan/nvk_cmd_buffer.h index abf6d44..dda3d2f 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.h +++ b/src/nouveau/vulkan/nvk_cmd_buffer.h @@ -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 */ diff --git a/src/nouveau/vulkan/nvk_cmd_dispatch.c b/src/nouveau/vulkan/nvk_cmd_dispatch.c index bdbdc16..fab2d63 100644 --- a/src/nouveau/vulkan/nvk_cmd_dispatch.c +++ b/src/nouveau/vulkan/nvk_cmd_dispatch.c @@ -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, -- 2.7.4