« Return to Thread: [PATCH] intel: Disable texenv program around _swrast_CopyPixels.

[PATCH] intel: Disable texenv program around _swrast_CopyPixels.

by Eric Anholt-4 :: Rate this Message:

Reply to Author | View in Thread

This fixes the mesa readpix demo with scale and bias enabled.  I can't
justify why it should, though -- anyone have any explanation here?

Bug #20262.
---
 src/mesa/drivers/dri/intel/intel_pixel_copy.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index 5d52335..96390ca 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -394,6 +394,8 @@ intelCopyPixels(GLcontext * ctx,
                 GLsizei width, GLsizei height,
                 GLint destx, GLint desty, GLenum type)
 {
+   struct gl_fragment_program *fp_save;
+
    if (INTEL_DEBUG & DEBUG_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
@@ -404,8 +406,15 @@ intelCopyPixels(GLcontext * ctx,
    if (do_texture_copypixels(ctx, srcx, srcy, width, height, destx, desty, type))
       return;
 #endif
-
    DBG("fallback to _swrast_CopyPixels\n");
 
+   /* Disable the automatically generated fragment program when falling back
+    * to software.  Fixes readpix demo with scale/bias enabled.
+    */
+   fp_save = ctx->FragmentProgram._Current;
+   ctx->FragmentProgram._Current = NULL;
+   ctx->FragmentProgram._MaintainTexEnvProgram = GL_FALSE;
    _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type);
+   ctx->FragmentProgram._Current = fp_save;
+   ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
 }
--
1.6.3.3


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@...
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

 « Return to Thread: [PATCH] intel: Disable texenv program around _swrast_CopyPixels.