Mesa (master): pan/bi: Emit +ZS_EMIT as needed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 4 16:45:35 UTC 2020


Module: Mesa
Branch: master
Commit: 6433fedcf1c09174b7ee6137775f5340ffa6120b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6433fedcf1c09174b7ee6137775f5340ffa6120b

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Wed Nov  4 09:05:39 2020 -0500

pan/bi: Emit +ZS_EMIT as needed

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>

---

 src/panfrost/bifrost/bifrost_compile.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index bf9b868596c..68fa13ba1a1 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -270,6 +270,29 @@ bi_emit_blend(bi_context *ctx, unsigned rgba, nir_alu_type T, unsigned rt)
         bi_emit(ctx, blend);
 }
 
+static void
+bi_emit_zs_emit(bi_context *ctx, unsigned z, unsigned stencil)
+{
+        bi_instruction ins = {
+                .type = BI_ZS_EMIT,
+                .src = {
+                        z,
+                        stencil,
+                        BIR_INDEX_REGISTER | 60 /* TODO: RA */,
+                },
+                .src_types = {
+                        nir_type_float32,
+                        nir_type_uint8,
+                        nir_type_uint32,
+                },
+                .swizzle = { { 0 }, { 0 }, { 0 } },
+                .dest = BIR_INDEX_REGISTER | 60 /* TODO: RA */,
+                .dest_type = nir_type_uint32,
+        };
+
+        bi_emit(ctx, ins);
+}
+
 static void
 bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
 {
@@ -291,7 +314,12 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
         }
 
         if (emit_zs) {
-                unreachable("stub");
+                unsigned z = writeout & PAN_WRITEOUT_Z ?
+                        pan_src_index(&instr->src[2]) : 0;
+                unsigned s = writeout & PAN_WRITEOUT_S ?
+                        pan_src_index(&instr->src[3]) : 0;
+
+                bi_emit_zs_emit(ctx, z, s);
         }
 
         if (emit_blend) {



More information about the mesa-commit mailing list