llvmpipe: Only generate the whole shader specialization for opaque shaders.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 12 Sep 2010 09:14:50 +0000 (10:14 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 12 Sep 2010 09:15:48 +0000 (10:15 +0100)
If not opaque, then the color buffer will have to be read any way,
therefore the specialization is pointless.

src/gallium/drivers/llvmpipe/lp_state_fs.c

index 3a6011c78422b5d35ce50ef01b4f186eb9e51695..1bcc16dd6dd672c7f7b909fafe5794c7ebcf5fd3 100644 (file)
@@ -850,9 +850,15 @@ generate_variant(struct llvmpipe_context *lp,
       lp_debug_fs_variant(variant);
    }
 
-   generate_fragment(lp, shader, variant, RAST_WHOLE);
    generate_fragment(lp, shader, variant, RAST_EDGE_TEST);
 
+   if (variant->opaque) {
+      /* Specialized shader, which doesn't need to read the color buffer. */
+      generate_fragment(lp, shader, variant, RAST_WHOLE);
+   } else {
+      variant->jit_function[RAST_WHOLE] = variant->jit_function[RAST_EDGE_TEST];
+   }
+
    return variant;
 }