From 20df1d2b1f85711732eb190cf373b56df573e36e Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 7 Mar 2024 13:18:46 +0200 Subject: [PATCH] anv: ignore descriptor alignment for inline uniforms For this particular case only it doesn't matter. Fixes some new CTS tests with small inline uniform sizes. Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: Ivan Briano Part-of: --- src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index fa315732da8..a1ab07f3273 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -621,8 +621,16 @@ build_res_index(nir_builder *b, } const uint32_t desc_bti = state->set[set].binding[binding].surface_offset; - assert(bind_layout->descriptor_surface_stride % 8 == 0); - const uint32_t desc_stride = bind_layout->descriptor_surface_stride / 8; + /* We don't care about the stride field for inline uniforms (see + * build_desc_addr_for_res_index), but for anything else we should be + * aligned to 8 bytes because we store a multiple of 8 in the packed info + * to be able to encode a stride up to 2040 (8 * 255). + */ + assert(bind_layout->type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK || + bind_layout->descriptor_surface_stride % 8 == 0); + const uint32_t desc_stride = + bind_layout->type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK ? 0 : + bind_layout->descriptor_surface_stride / 8; nir_def *packed = nir_ior_imm(b,