summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_program.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-11-07 12:25:47 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-23 13:52:19 +0000
commit64d7d70c5b4722f53f6080b35ec516462f1e191b (patch)
tree848d547269b858fa372273ec9f89813b49331686 /src/gallium/drivers/vc4/vc4_program.c
parent9a4206379b0e36d440481ae89b98467ed53dc86b (diff)
downloadexternal_mesa3d-64d7d70c5b4722f53f6080b35ec516462f1e191b.zip
external_mesa3d-64d7d70c5b4722f53f6080b35ec516462f1e191b.tar.gz
external_mesa3d-64d7d70c5b4722f53f6080b35ec516462f1e191b.tar.bz2
vc4: Clamp the shadow comparison value.
Fixes piglit glsl-fs-shadow2D-clamp-z. Cc: <mesa-stable@lists.freedesktop.org> (cherry picked from commit 08d51487e3b8cfb14ca2ece9545b2e2ed344e3cc)
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index fe07d91..05e2021 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -451,6 +451,15 @@ 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) {
+ /* From the GL_ARB_shadow spec:
+ *
+ * "Let Dt (D subscript t) be the depth texture
+ * value, in the range [0, 1]. Let R be the
+ * interpolated texture coordinate clamped to the
+ * range [0, 1]."
+ */
+ compare = qir_SAT(c, compare);
+
switch (c->key->tex[unit].compare_func) {
case PIPE_FUNC_NEVER:
depth_output = qir_uniform_f(c, 0.0f);