llvmpipe: Fix bug with blend factor in complementary optimisations.
authorJames Benton <jbenton@vmware.com>
Tue, 17 Jul 2012 11:08:02 +0000 (12:08 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 17 Jul 2012 12:16:38 +0000 (13:16 +0100)
Fixes fdo 52168.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/llvmpipe/lp_bld_blend.c

index a87a220ea48a54fcc5998059c032c2fcd35714ec..75309dd5fcd4aea9299d9bc7598219d08a291b4e 100644 (file)
@@ -152,20 +152,22 @@ lp_build_blend(struct lp_build_context *bld,
             }
          } else if(bld->type.floating && func == PIPE_BLEND_SUBTRACT) {
             result = lp_build_add(bld, src, dst);
-            result = lp_build_mul(bld, result, src_factor);
 
             if (factor_src < factor_dst) {
+               result = lp_build_mul(bld, result, src_factor);
                return lp_build_sub(bld, result, dst);
             } else {
+               result = lp_build_mul(bld, result, dst_factor);
                return lp_build_sub(bld, src, result);
             }
          } else if(bld->type.floating && func == PIPE_BLEND_REVERSE_SUBTRACT) {
             result = lp_build_add(bld, src, dst);
-            result = lp_build_mul(bld, result, src_factor);
 
             if (factor_src < factor_dst) {
+               result = lp_build_mul(bld, result, src_factor);
                return lp_build_sub(bld, dst, result);
             } else {
+               result = lp_build_mul(bld, result, dst_factor);
                return lp_build_sub(bld, result, src);
             }
          }