panfrost/midgard: Implement txl
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 11 Jun 2019 16:43:08 +0000 (09:43 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 12 Jun 2019 21:31:45 +0000 (14:31 -0700)
This follows the txb implementation, but requires an adjustment to how
the cont/last flags are set.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/midgard/midgard_compile.c
src/gallium/drivers/panfrost/midgard/midgard_emit.c

index 85b7c425eb4d98bfb67032c9b085c8b0a7cbf7ca..eacf84e89e65937ed9f1f5c3c3c567bab24a828d 100644 (file)
@@ -1318,6 +1318,8 @@ midgard_tex_op(nir_texop 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");
         }
@@ -1377,7 +1379,8 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
                         break;
                 }
 
-                case nir_tex_src_bias: {
+                case nir_tex_src_bias:
+                case nir_tex_src_lod: {
                         /* To keep RA simple, we put the bias/LOD into the w
                          * component of the input source, which is otherwise in xy */
 
@@ -1417,9 +1420,6 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
 
                         /* Always 1 */
                         .unknown7 = 1,
-
-                        /* Assume we can continue; hint it out later */
-                        .cont = 1,
                 }
         };
 
@@ -1430,7 +1430,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
         /* Setup bias/LOD if necessary. Only register mode support right now.
          * TODO: Immediate mode for performance gains */
 
-        if (instr->op == nir_texop_txb) {
+        if (instr->op == nir_texop_txb || instr->op == nir_texop_txl) {
                 ins.texture.lod_register = true;
 
                 midgard_tex_register_select sel = {
index ffa08735ff049005aea64cdf6e41a4f9c5681571..5ddcee419bfa2246924aab8c3f1a8ff6a4dd886e 100644 (file)
@@ -214,9 +214,12 @@ emit_binary_bundle(compiler_context *ctx,
 
                 ctx->texture_op_count--;
 
-                if (!ctx->texture_op_count) {
-                        ins->texture.cont = 0;
-                        ins->texture.last = 1;
+                if (ins->texture.op == TEXTURE_OP_NORMAL) {
+                        bool continues = ctx->texture_op_count > 0;
+                        ins->texture.cont = continues;
+                        ins->texture.last = !continues;
+                } else {
+                        ins->texture.cont = ins->texture.last = 1;
                 }
 
                 util_dynarray_append(emission, midgard_texture_word, ins->texture);