From d0f25109f645adb2e362e1e13d45c5d926b131de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Fri, 17 Feb 2023 12:57:26 +0100 Subject: [PATCH] radv: Add per-prim attributes to ring_attr stride. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_nir_lower_abi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_nir_lower_abi.c b/src/amd/vulkan/radv_nir_lower_abi.c index 2ed0497..9795145 100644 --- a/src/amd/vulkan/radv_nir_lower_abi.c +++ b/src/amd/vulkan/radv_nir_lower_abi.c @@ -125,8 +125,12 @@ lower_abi_instr(nir_builder *b, nir_instr *instr, void *state) case nir_intrinsic_load_ring_attr_amd: replacement = load_ring(b, RING_PS_ATTR, s); + /* Note, the HW always assumes there is at least 1 per-vertex param. */ + const unsigned total_num_params = + MAX2(1, s->info->outinfo.param_exports) + s->info->outinfo.prim_param_exports; + nir_ssa_def *dword1 = nir_channel(b, replacement, 1); - dword1 = nir_ior_imm(b, dword1, S_008F04_STRIDE(16 * s->info->outinfo.param_exports)); + dword1 = nir_ior_imm(b, dword1, S_008F04_STRIDE(16 * total_num_params)); replacement = nir_vector_insert_imm(b, replacement, dword1, 1); break; -- 2.7.4