Mesa (master): panfrost: Prepare things to support non-native texture ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 18 13:36:37 UTC 2019


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Mon Jun 17 21:47:46 2019 +0200

panfrost: Prepare things to support non-native texture ops

We are about to add support for the TXS (texture size) op which is not
implemented using a midgard texture instruction. Let's rename emit_tex()
into emit_texop_native() and repurpose emit_tex() as a dispatcher.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 .../drivers/panfrost/midgard/midgard_compile.c     | 35 ++++++++++++----------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 0abecb90f3c..2d2d69a98ac 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1366,22 +1366,9 @@ midgard_tex_format(enum glsl_sampler_dim dim)
         }
 }
 
-static unsigned
-midgard_tex_op(nir_texop op)
-{
-        switch (op) {
-                case nir_texop_tex:
-                case nir_texop_txb:
-                        return TEXTURE_OP_NORMAL;
-                case nir_texop_txl:
-                        return TEXTURE_OP_LOD;
-                default:
-                        unreachable("Unhanlded texture op");
-        }
-}
-
 static void
-emit_tex(compiler_context *ctx, nir_tex_instr *instr)
+emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
+		  unsigned midgard_texop)
 {
         /* TODO */
         //assert (!instr->sampler);
@@ -1467,7 +1454,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
         midgard_instruction ins = {
                 .type = TAG_TEXTURE_4,
                 .texture = {
-                        .op = midgard_tex_op(instr->op),
+                        .op = midgard_texop,
                         .format = midgard_tex_format(instr->sampler_dim),
                         .texture_handle = texture_index,
                         .sampler_handle = sampler_index,
@@ -1526,6 +1513,22 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
 }
 
 static void
+emit_tex(compiler_context *ctx, nir_tex_instr *instr)
+{
+        switch (instr->op) {
+        case nir_texop_tex:
+        case nir_texop_txb:
+                emit_texop_native(ctx, instr, TEXTURE_OP_NORMAL);
+                break;
+        case nir_texop_txl:
+                emit_texop_native(ctx, instr, TEXTURE_OP_LOD);
+                break;
+        default:
+		unreachable("Unhanlded texture op");
+        }
+}
+
+static void
 emit_jump(compiler_context *ctx, nir_jump_instr *instr)
 {
         switch (instr->type) {




More information about the mesa-commit mailing list