pan/bi: Emit discard (not if)
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 1 May 2020 22:26:18 +0000 (18:26 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 4 May 2020 15:08:15 +0000 (11:08 -0400)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4883>

src/panfrost/bifrost/bifrost_compile.c

index 2b5b5070dd98952d2274cec5fc8b37b6c07e362b..b5027e18b71382150237fad13bbe46f6bbd01d66 100644 (file)
@@ -351,6 +351,20 @@ bi_emit_ld_frag_coord(bi_context *ctx, nir_intrinsic_instr *instr)
         bi_emit(ctx, combine);
 }
 
+static void
+bi_emit_discard(bi_context *ctx, nir_intrinsic_instr *instr)
+{
+        /* Goofy lowering */
+        bi_instruction discard = {
+                .type = BI_DISCARD,
+                .cond = BI_COND_EQ,
+                .src_types = { nir_type_uint32, nir_type_uint32 },
+                .src = { BIR_INDEX_ZERO, BIR_INDEX_ZERO },
+        };
+
+        bi_emit(ctx, discard);
+}
+
 static void
 bi_emit_discard_if(bi_context *ctx, nir_intrinsic_instr *instr)
 {
@@ -406,6 +420,10 @@ emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
                 bi_emit_ld_frag_coord(ctx, instr);
                 break;
 
+        case nir_intrinsic_discard:
+                bi_emit_discard(ctx, instr);
+                break;
+
         case nir_intrinsic_discard_if:
                 bi_emit_discard_if(ctx, instr);
                 break;