Recently, some optimisations have been introduced to texenvprogram.c so that 
if we determine, based on vertex state, that certain fragment attributes must 
be constant, they are read from the constant file instead of from the fragment 
input registers.

However, the assumptions that lead to this optimisation fail when the 
fragments are created by a call to DrawPixels. This can be observed, for 
example, by the failure of the glean/pixelFormats test with the r300 driver, 
in which output is produced alternately by rendering quads with constant color 
and with DrawPixels.

The following patch fixes this problem by setting the vp_override flag around 
the actual operation of _swrast_DrawPixels. It fixes the problem for me, but 
it may not be the most elegant solution to the problem, so if you think there 
is a better fix, please tell me. Otherwise I will commit this patch to master 
in a few days.

cu,
Nicolai
---
 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);
 }
-- 
1.5.6.3



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to