pan/bi: Add a bi_instr::blend_target

On Bifrost, we have to return the blend return offset in the compiled
shader info and that means we need to be able to index into an array by
blend target deep inside the compiler.  Instead of assuming bound blend
targets and subtracting BIR_FAU_BLEND_0 from fau_idx, add a separte
blend_target to bi_instr and use that.  This way what we return will be
based on the nir_io_semantics::location, regardless of where the actual
blend descriptor comes from.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39274>
This commit is contained in:
Faith Ekstrand 2026-01-12 16:56:28 -05:00 committed by Marge Bot
parent 0ee1631120
commit fa9b2e7404
3 changed files with 7 additions and 5 deletions

View file

@ -693,7 +693,7 @@ bi_collect_blend_ret_addr(bi_context *ctx, struct util_dynarray *emission,
if (!ins || ins->op != BI_OPCODE_BLEND)
return;
unsigned loc = tuple->regs.fau_idx - BIR_FAU_BLEND_0;
unsigned loc = ins->blend_target;
assert(loc < ARRAY_SIZE(ctx->info.bifrost->blend));
assert(!ctx->info.bifrost->blend[loc].return_offset);
ctx->info.bifrost->blend[loc].return_offset =

View file

@ -2168,15 +2168,16 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr)
bi_make_vec_to(b, rgba, srcs, channels, 4, size);
}
bi_blend_to(b, bi_temp(b->shader), rgba, coverage,
bi_extract(b, desc, 0), bi_extract(b, desc, 1),
rgba2, regfmt, sr_count, sr_count_2);
nir_io_semantics io = nir_intrinsic_io_semantics(instr);
assert(io.location >= FRAG_RESULT_DATA0);
assert(io.location <= FRAG_RESULT_DATA7);
unsigned rt = io.location - FRAG_RESULT_DATA0;
bi_instr *I = bi_blend_to(b, bi_temp(b->shader), rgba, coverage,
bi_extract(b, desc, 0), bi_extract(b, desc, 1),
rgba2, regfmt, sr_count, sr_count_2);
I->blend_target = rt;
b->shader->info.bifrost->blend[rt].type = T;
if (instr->intrinsic == nir_intrinsic_blend2_pan) {
assert(b->shader->info.bifrost->blend_src1_type == nir_type_invalid);

View file

@ -629,6 +629,7 @@ typedef struct {
bool format; /* LEA_TEX */
bool z_stencil; /* LD_TILE */
bool scheduling_barrier; /* NOP */
unsigned blend_target; /* BLEND */
struct {
enum bi_special special; /* FADD_RSCALE, FMA_RSCALE */