Mesa (master): llvmpipe: Check when a shader does not satisfy 0 < imm < 1.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed May 2 09:25:58 UTC 2012


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

Author: James Benton <jbenton at vmware.com>
Date:   Wed Apr 25 11:19:06 2012 +0100

llvmpipe: Check when a shader does not satisfy 0 < imm < 1.

Signed-off-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h      |    5 +++++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c |    8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 888221d..773c679 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -122,6 +122,11 @@ struct lp_tgsi_info
    unsigned indirect_textures:1;
 
    /*
+    * Whether any immediate values are outside the range of 0 and 1
+    */
+   unsigned unclamped_immediates:1;
+
+   /*
     * Texture opcode description. Aimed at detecting and described direct
     * texture opcodes.
     */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index 3373ed4..ab393ed 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -442,8 +442,12 @@ lp_build_tgsi_info(const struct tgsi_token *tokens,
             assert(size <= 4);
             if (ctx.num_imms < Elements(ctx.imm)) {
                for (chan = 0; chan < size; ++chan) {
-                  ctx.imm[ctx.num_imms][chan] =
-                        parse.FullToken.FullImmediate.u[chan].Float;
+                  float value = parse.FullToken.FullImmediate.u[chan].Float;
+                  ctx.imm[ctx.num_imms][chan] = value;
+
+                  if (value < 0.0f || value > 1.0f) {
+                     info->unclamped_immediates = TRUE;
+                  }
                }
                ++ctx.num_imms;
             }




More information about the mesa-commit mailing list