From 260f9c503ad3c2459fffbc4dc4583554b2437e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Wed, 14 Oct 2020 17:23:15 +0200 Subject: [PATCH] aco/ngg: Put shader query reduction operand into a VGPR. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The p_reduce instruction only works if this operand is in a VGPR, and otherwise gets lowered to incorrect code. Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 6717c6e6280..953217928e7 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11342,6 +11342,8 @@ void ngg_gs_write_shader_query(isel_context *ctx, nir_intrinsic_instr *instr) Temp prm_cnt = gs_vtx_cnt; if (total_vtx_per_prim > 1) prm_cnt = bld.vop3(aco_opcode::v_mad_i32_i24, bld.def(v1), gs_prm_cnt, Operand(-1u * (total_vtx_per_prim - 1)), gs_vtx_cnt); + else + prm_cnt = as_vgpr(ctx, prm_cnt); /* Reduction calculates the primitive count for the entire subgroup. */ sg_prm_cnt = bld.tmp(s1);