Mesa (master): pan/bi: Generate TEX_COMPACT instruction

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 22 01:16:17 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue Apr 21 13:00:44 2020 -0400

pan/bi: Generate TEX_COMPACT instruction

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

---

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

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 8b7e32f5e8b..21211820dfe 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -684,7 +684,27 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
 static void
 emit_tex_compact(bi_context *ctx, nir_tex_instr *instr)
 {
-        unreachable("stub");
+        bi_instruction tex = {
+                .type = BI_TEX,
+                .op = { .texture = BI_TEX_COMPACT },
+                .dest = bir_dest_index(&instr->dest),
+                .dest_type = instr->dest_type,
+                .src_types = { nir_type_float32, nir_type_float32 },
+                .writemask = instr->dest_type == nir_type_float32 ?
+                        0xFFFF : 0xFF,
+        };
+
+        for (unsigned i = 0; i < instr->num_srcs; ++i) {
+                int index = bir_src_index(&instr->src[i].src);
+                assert (instr->src[i].src_type == nir_tex_src_coord);
+
+                tex.src[0] = index;
+                tex.src[1] = index;
+                tex.swizzle[0][0] = 0;
+                tex.swizzle[1][0] = 1;
+        }
+
+        bi_emit(ctx, tex);
 }
 
 static void



More information about the mesa-commit mailing list