From 996645e4794acc84537b6b69680acfc46620bbcb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 1 Jan 2022 10:09:21 -0500 Subject: [PATCH] pan/bi: Don't read base for combined stores `base` is meaningless for combined stores, so don't read it. This allows us to remove the base index from the intrinsic and simplify the lowering code generating the combined store intrinsic. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 047ab4fabf9..ba641185f8e 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -574,12 +574,17 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) bool emit_blend = writeout & (PAN_WRITEOUT_C); bool emit_zs = writeout & (PAN_WRITEOUT_Z | PAN_WRITEOUT_S); - const nir_variable *var = - nir_find_variable_with_driver_location(b->shader->nir, - nir_var_shader_out, nir_intrinsic_base(instr)); - assert(var); + const nir_variable *var = NULL; + unsigned loc = ~0; + + if (!combined) { + var = nir_find_variable_with_driver_location(b->shader->nir, + nir_var_shader_out, nir_intrinsic_base(instr)); + assert(var); + + loc = var->data.location; + } - unsigned loc = var->data.location; bi_index src0 = bi_src_index(&instr->src[0]); /* By ISA convention, the coverage mask is stored in R60. The store @@ -595,7 +600,7 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) /* Dual-source blending is implemented by putting the color in * registers r4-r7. */ - if (var->data.index) { + if (var && var->data.index) { unsigned count = nir_src_num_components(instr->src[0]); for (unsigned i = 0; i < count; ++i) @@ -643,9 +648,7 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) } if (emit_blend) { - assert(loc >= FRAG_RESULT_DATA0); - - unsigned rt = (loc - FRAG_RESULT_DATA0); + unsigned rt = combined ? 0 : (loc - FRAG_RESULT_DATA0); bi_index color = bi_src_index(&instr->src[0]); /* Explicit copy since BLEND inputs are precoloured to R0-R3,