Mesa (master): vc4: Use the NIR cubemap normalization instead of our own.

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


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

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

vc4: Use the NIR cubemap normalization instead of our own.

This is one of two uses of the current QIR CSE pass according to
shader-db.  The NIR pass means that we'll end up doing Newton-Raphson on
our RCP, which we weren't doing before, but that's probably actually a
good thing.

---

 src/gallium/drivers/vc4/vc4_program.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index b1c8b00..a1646d7 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -403,12 +403,6 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
         }
 
         if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
-                struct qreg ma = qir_FMAXABS(c, qir_FMAXABS(c, s, t), r);
-                struct qreg rcp_ma = qir_RCP(c, ma);
-                s = qir_FMUL(c, s, rcp_ma);
-                t = qir_FMUL(c, t, rcp_ma);
-                r = qir_FMUL(c, r, rcp_ma);
-
                 qir_TEX_R(c, r, texture_u[next_texture_u++]);
         } else if (c->key->tex[unit].wrap_s == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
                    c->key->tex[unit].wrap_s == PIPE_TEX_WRAP_CLAMP ||
@@ -1893,6 +1887,7 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
                 }
         }
 
+        NIR_PASS_V(c->s, nir_normalize_cubemap_coords);
         NIR_PASS_V(c->s, nir_lower_tex, &tex_options);
 
         if (c->fs_key && c->fs_key->light_twoside)




More information about the mesa-commit mailing list