From 996e81fb70419bdf0e7bb9afea18c142897730dc Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 19 Oct 2021 09:16:20 +0200 Subject: [PATCH] aco: fix loading 64-bit inputs with fragment shaders Fixes a bunch of 64-bit IO tests with piglit and Zink. Cc: 21.3 mesa-stable Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index cd36e8be1eb..5f1648eee56 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -5284,16 +5284,22 @@ visit_load_input(isel_context* ctx, nir_intrinsic_instr* instr) } } - if (instr->dest.ssa.num_components == 1) { + if (instr->dest.ssa.num_components == 1 && + instr->dest.ssa.bit_size != 64) { bld.vintrp(aco_opcode::v_interp_mov_f32, Definition(dst), Operand::c32(vertex_id), bld.m0(prim_mask), idx, component); } else { + unsigned num_components = instr->dest.ssa.num_components; + if (instr->dest.ssa.bit_size == 64) + num_components *= 2; aco_ptr vec{create_instruction( - aco_opcode::p_create_vector, Format::PSEUDO, instr->dest.ssa.num_components, 1)}; - for (unsigned i = 0; i < instr->dest.ssa.num_components; i++) { + aco_opcode::p_create_vector, Format::PSEUDO, num_components, 1)}; + for (unsigned i = 0; i < num_components; i++) { + unsigned chan_component = (component + i) % 4; + unsigned chan_idx = idx + (component + i) / 4; vec->operands[i] = bld.vintrp( aco_opcode::v_interp_mov_f32, bld.def(instr->dest.ssa.bit_size == 16 ? v2b : v1), - Operand::c32(vertex_id), bld.m0(prim_mask), idx, component + i); + Operand::c32(vertex_id), bld.m0(prim_mask), chan_idx, chan_component); } vec->definitions[0] = Definition(dst); bld.insert(std::move(vec));