Mesa (master): llvmpipe: Only generate the whole shader specialization for opaque shaders.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Sep 12 02:37:52 PDT 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Sep 12 10:14:50 2010 +0100

llvmpipe: Only generate the whole shader specialization for opaque shaders.

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 |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 3a6011c..1bcc16d 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -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;
 }
 



More information about the mesa-commit mailing list