llvmpipe: Avoid adding floating point zero to flat inputs.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 18 May 2012 00:03:13 +0000 (01:03 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 18 May 2012 00:03:13 +0000 (01:03 +0100)
Which could clobber integer inputs, if the addition is not optimized away
(e.g., if optimizations are disabled for debugging purposes).

src/gallium/drivers/llvmpipe/lp_bld_interp.c

index 0608ab0a2a7529bf54fd0b85667dca71e06bdb30..0d51ccb034986dd045f2d60225eab7756f1f8867 100644 (file)
@@ -239,7 +239,10 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
              * Compute the attrib values on the upper-left corner of each quad.
              */
 
-            a = LLVMBuildFAdd(builder, a, dadq2, "");
+            if (interp != LP_INTERP_CONSTANT &&
+                interp != LP_INTERP_FACING) {
+               a = LLVMBuildFAdd(builder, a, dadq2, "");
+           }
 
 #if PERSPECTIVE_DIVIDE_PER_QUAD
             /*