summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-11-04 12:04:15 -0700
committerEric Anholt <[email protected]>2016-11-04 15:34:38 -0700
commit70fc3a941abc876f8679a32bc9aa83ff3ca2a129 (patch)
tree3f1e2de19777b22bd46f4e1f7e8a7885803b2a00
parent2c875158e2763d57e5dae8892af96a894bdb7dc9 (diff)
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).
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 809c96dda3d..f4be5f43c8c 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;