aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/bifrost_compile.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-06 09:26:44 -0500
committerMarge Bot <[email protected]>2020-03-07 00:37:39 +0000
commitdabb6c6b9fd473b10ae9d63b96e7ef248b1a7ed1 (patch)
tree2e8cfc1b33a201d063dbb19145ecdab6303a73cb /src/panfrost/bifrost/bifrost_compile.c
parent79c1af062341266d7ad64a0ac221394d6cbfdfdc (diff)
pan/bi: Implement store_output for fragment shaders
Corresponds to a BLEND instruction, possibly preceded by an ATEST instruction. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4097>
Diffstat (limited to 'src/panfrost/bifrost/bifrost_compile.c')
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 6a57adc4e53..922591279c5 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -89,6 +89,31 @@ bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr)
}
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;