llvmpipe: Check when a shader does not satisfy 0 < imm < 1.
authorJames Benton <jbenton@vmware.com>
Wed, 25 Apr 2012 10:19:06 +0000 (11:19 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 2 May 2012 09:23:21 +0000 (10:23 +0100)
Signed-off-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c

index 888221d4d64801593f010cd4a0caacaf8dcce755..773c679a4d838d94848a70395e89fa20bd87ac77 100644 (file)
@@ -121,6 +121,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.
index 3373ed4426d4ee10ff0e42af48f742c4a10e562b..ab393ed942a022c9025b49d2a6bc5e7bf2c107a1 100644 (file)
@@ -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;
             }