pan/bi: Implement store_output for fragment shaders
Corresponds to a BLEND instruction, possibly preceded by an ATEST instruction. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4097>
This commit is contained in:

committed by
Marge Bot

parent
79c1af0623
commit
dabb6c6b9f
@@ -88,6 +88,31 @@ bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
bi_emit(ctx, ins);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
if (!ctx->emitted_atest) {
|
||||
bi_instruction ins = {
|
||||
.type = BI_ATEST
|
||||
};
|
||||
|
||||
bi_emit(ctx, ins);
|
||||
bi_schedule_barrier(ctx);
|
||||
ctx->emitted_atest = true;
|
||||
}
|
||||
|
||||
bi_instruction blend = {
|
||||
.type = BI_BLEND,
|
||||
.blend_location = nir_intrinsic_base(instr),
|
||||
.src = {
|
||||
bir_src_index(&instr->src[0])
|
||||
}
|
||||
};
|
||||
|
||||
bi_emit(ctx, blend);
|
||||
bi_schedule_barrier(ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
@@ -99,6 +124,13 @@ emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
case nir_intrinsic_load_interpolated_input:
|
||||
bi_emit_ld_vary(ctx, instr);
|
||||
break;
|
||||
case nir_intrinsic_store_output:
|
||||
if (ctx->stage == MESA_SHADER_FRAGMENT)
|
||||
bi_emit_frag_out(ctx, instr);
|
||||
else {
|
||||
/* TODO */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* todo */
|
||||
break;
|
||||
|
@@ -330,6 +330,7 @@ typedef struct {
|
||||
bi_block *after_block;
|
||||
bi_block *break_block;
|
||||
bi_block *continue_block;
|
||||
bool emitted_atest;
|
||||
|
||||
/* Stats for shader-db */
|
||||
unsigned instruction_count;
|
||||
|
Reference in New Issue
Block a user