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 <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13714>
This commit is contained in:
Alyssa Rosenzweig 2022-01-01 10:09:21 -05:00 committed by Marge Bot
parent 31d839aacc
commit 996645e479
1 changed files with 12 additions and 9 deletions

View File

@ -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,