From 3645a3106a06ff1ff823272456182ca9dec1479b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Wed, 30 Sep 2020 00:41:12 +0200 Subject: [PATCH] aco/ngg: Make primitive export packing less prone to error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use lshl_or instead of lshl_add, which makes it more robust in handling -1 and -2 indices which will now just become null exports, which is what we want. Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 2a7a51fa9d1..8c809de27fa 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -10769,19 +10769,19 @@ Temp ngg_pack_prim_exp_arg(isel_context *ctx, unsigned num_vertices, const Temp assert(vtxindex[i].id()); if (i) - tmp = bld.vop3(aco_opcode::v_lshl_add_u32, bld.def(v1), vtxindex[i], Operand(10u * i), tmp); + tmp = bld.vop3(aco_opcode::v_lshl_or_b32, bld.def(v1), vtxindex[i], Operand(10u * i), tmp); else tmp = vtxindex[i]; /* The initial edge flag is always false in tess eval shaders. */ if (ctx->stage == ngg_vertex_gs) { - Temp edgeflag = bld.vop3(aco_opcode::v_bfe_u32, bld.def(v1), gs_invocation_id, Operand(8 + i), Operand(1u)); - tmp = bld.vop3(aco_opcode::v_lshl_add_u32, bld.def(v1), edgeflag, Operand(10u * i + 9u), tmp); + Temp edgeflag = bld.vop3(aco_opcode::v_bfe_u32, bld.def(v1), gs_invocation_id, Operand(8u + i), Operand(1u)); + tmp = bld.vop3(aco_opcode::v_lshl_or_b32, bld.def(v1), edgeflag, Operand(10u * i + 9u), tmp); } } if (is_null.id()) - tmp = bld.vop3(aco_opcode::v_lshl_add_u32, bld.def(v1), is_null, Operand(31u), tmp); + tmp = bld.vop3(aco_opcode::v_lshl_or_b32, bld.def(v1), is_null, Operand(31u), tmp); return tmp; }