Mesa (master): vc4: Clamp the shadow comparison value.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Nov 9 23:35:38 UTC 2016
Module: Mesa
Branch: master
Commit: 08d51487e3b8cfb14ca2ece9545b2e2ed344e3cc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08d51487e3b8cfb14ca2ece9545b2e2ed344e3cc
Author: Eric Anholt <eric at anholt.net>
Date: Mon Nov 7 12:25:47 2016 -0800
vc4: Clamp the shadow comparison value.
Fixes piglit glsl-fs-shadow2D-clamp-z.
Cc: <mesa-stable at lists.freedesktop.org>
---
src/gallium/drivers/vc4/vc4_program.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 86f71f6..abd20a5 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -495,6 +495,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);
More information about the mesa-commit
mailing list