Mesa (master): vc4: Make sure that vertex shader texture2D() calls use LOD 0.

Eric Anholt anholt at kemper.freedesktop.org
Fri Nov 4 22:40:08 UTC 2016


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Nov  4 12:04:15 2016 -0700

vc4: Make sure that vertex shader texture2D() calls use LOD 0.

I noticed this while trying to debug glmark2 terrain (which does vertex
shader texturing, but no mipmaps on its textures sampled from the VS).

---

 src/gallium/drivers/vc4/vc4_program.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 809c96d..f4be5f4 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -417,6 +417,16 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
                 }
         }
 
+        if (c->stage != QSTAGE_FRAG && !is_txl) {
+                /* From the GLSL 1.20 spec:
+                 *
+                 *     "If it is mip-mapped and running on the vertex shader,
+                 *      then the base texture is used."
+                 */
+                is_txl = true;
+                lod = qir_uniform_ui(c, 0);
+        }
+
         if (c->key->tex[unit].force_first_level) {
                 lod = qir_uniform(c, QUNIFORM_TEXTURE_FIRST_LEVEL, unit);
                 is_txl = true;




More information about the mesa-commit mailing list