Mesa (master): swrast: Set vp_override flag during DrawPixels

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Feb 18 21:00:56 UTC 2009


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

Author: Nicolai Haehnle <nhaehnle at gmail.com>
Date:   Sun Feb 15 13:34:43 2009 +0100

swrast: Set vp_override flag during DrawPixels

Obviously, the color of fragments produced by DrawPixels is not constant,
even if the current vertex array / vertex program state indicates that the
color for normal rendering will be constant. Therefore, we need to override
certain optimisations that have been added to texenvprogram.c

Signed-off-by: Nicolai Haehnle <nhaehnle at gmail.com>

---

 src/mesa/swrast/s_drawpix.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 700f76d..a9ef8e6 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -829,6 +829,15 @@ _swrast_DrawPixels( GLcontext *ctx,
 		    const GLvoid *pixels )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLboolean save_vp_override = ctx->VertexProgram._Overriden;
+
+   /* We are creating fragments directly, without going through vertex programs.
+    *
+    * This override flag tells the fragment processing code that its input comes
+    * from a non-standard source, and it may therefore not rely on optimizations
+    * that assume e.g. constant color if there is no color vertex array.
+    */
+   _mesa_set_vp_override(ctx, GL_TRUE);
 
    swrast_render_start(ctx);
 
@@ -841,6 +850,7 @@ _swrast_DrawPixels( GLcontext *ctx,
     pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels);
     if (!pixels) {
        swrast_render_finish(ctx);
+       _mesa_set_vp_override(ctx, save_vp_override);
        return;
     }
 
@@ -880,6 +890,7 @@ _swrast_DrawPixels( GLcontext *ctx,
    }
 
    swrast_render_finish(ctx);
+   _mesa_set_vp_override(ctx, save_vp_override);
 
    _mesa_unmap_drawpix_pbo(ctx, unpack);
 }




More information about the mesa-commit mailing list