Mesa (master): vc4: Just use NIR lowering for texture projection.

Eric Anholt anholt at kemper.freedesktop.org
Mon May 2 18:18:57 UTC 2016


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Apr 27 19:17:03 2016 -0700

vc4: Just use NIR lowering for texture projection.

This means doing Newton-Raphson on the RCP, but it's probably actually a
good thing to be accurate on.

---

 src/gallium/drivers/vc4/vc4_program.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 692d9d6..3c17676 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -336,8 +336,8 @@ ntq_emit_txf(struct vc4_compile *c, nir_tex_instr *instr)
 static void
 ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
 {
-        struct qreg s, t, r, lod, proj, compare;
-        bool is_txb = false, is_txl = false, has_proj = false;
+        struct qreg s, t, r, lod, compare;
+        bool is_txb = false, is_txl = false;
         unsigned unit = instr->texture_index;
 
         if (instr->op == nir_texop_txf) {
@@ -367,12 +367,6 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
                 case nir_tex_src_comparitor:
                         compare = ntq_get_src(c, instr->src[i].src, 0);
                         break;
-                case nir_tex_src_projector:
-                        proj = qir_RCP(c, ntq_get_src(c, instr->src[i].src, 0));
-                        s = qir_FMUL(c, s, proj);
-                        t = qir_FMUL(c, t, proj);
-                        has_proj = true;
-                        break;
                 default:
                         unreachable("unknown texture source");
                 }
@@ -440,9 +434,6 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
                 struct qreg u0 = qir_uniform_f(c, 0.0f);
                 struct qreg u1 = qir_uniform_f(c, 1.0f);
                 if (c->key->tex[unit].compare_mode) {
-                        if (has_proj)
-                                compare = qir_FMUL(c, compare, proj);
-
                         switch (c->key->tex[unit].compare_func) {
                         case PIPE_FUNC_NEVER:
                                 depth_output = qir_uniform_f(c, 0.0f);
@@ -1846,10 +1837,7 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
                  */
                 .lower_rect = false,
 
-                /* We want to use this, but we don't want to newton-raphson
-                 * its rcp.
-                 */
-                .lower_txp = false,
+                .lower_txp = ~0,
 
                 /* Apply swizzles to all samplers. */
                 .swizzle_result = ~0,




More information about the mesa-commit mailing list