diff options
author | Brian <brian@i915.localnet.net> | 2007-06-21 09:15:32 -0600 |
---|---|---|
committer | Brian <brian@i915.localnet.net> | 2007-06-21 09:15:32 -0600 |
commit | 171dcdfa27dda30916a7f9bfed89577feee5d350 (patch) | |
tree | 88624d960231df741ceaa2e5ed2005ebb97d7e22 /src/mesa/drivers | |
parent | fe11b2c04bf206bd50654c31e6789519c6c07563 (diff) |
Another round of fixing attribute interpolation for glDraw/CopyPixels.
Need to turn off FRAG_BIT_COL0 in swrast->_ActiveAttribMask when doing
glRead/CopyPixels to prevent the user's colors from getting overwritten
when a fragment program is active.
This was happening in the DRI drivers when MaintainTexEnv program was
used (the texenv fragment program was enabled when _swrast_DrawPixels was
called).
This still isn't an ideal solution, but fixes things for now.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_pixel.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_pixel_draw.c | 9 |
2 files changed, 25 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_pixel.c b/src/mesa/drivers/dri/i915/intel_pixel.c index a52a81bf13..d175870a0c 100644 --- a/src/mesa/drivers/dri/i915/intel_pixel.c +++ b/src/mesa/drivers/dri/i915/intel_pixel.c @@ -439,21 +439,25 @@ intelDrawPixels( GLcontext *ctx, if (INTEL_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); - if (!intelTryDrawPixels( ctx, x, y, width, height, format, type, - unpack, pixels )) { - if (ctx->FragmentProgram._Current == - ctx->FragmentProgram._TexEnvProgram) { - /* don't want the i915 texenv program to be applied to DrawPixels */ - struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current; - ctx->FragmentProgram._Current = NULL; - _swrast_DrawPixels( ctx, x, y, width, height, format, type, - unpack, pixels ); - ctx->FragmentProgram._Current = fpSave; - } - else { - _swrast_DrawPixels( ctx, x, y, width, height, format, type, - unpack, pixels ); - } + if (intelTryDrawPixels( ctx, x, y, width, height, format, type, + unpack, pixels )) + return; + + if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) { + /* + * We don't want the i915 texenv program to be applied to DrawPixels. + * This is really just a performance optimization (mesa will other- + * wise happily run the fragment program on each pixel in the image). + */ + struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current; + ctx->FragmentProgram._Current = NULL; + _swrast_DrawPixels( ctx, x, y, width, height, format, type, + unpack, pixels ); + ctx->FragmentProgram._Current = fpSave; + } + else { + _swrast_DrawPixels( ctx, x, y, width, height, format, type, + unpack, pixels ); } } diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c index 46480da1b1..77c67c821e 100644 --- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c @@ -363,9 +363,12 @@ intelDrawPixels(GLcontext * ctx, if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); - if (ctx->FragmentProgram._Current == - ctx->FragmentProgram._TexEnvProgram) { - /* don't want the i915 texenv program to be applied to DrawPixels */ + if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) { + /* + * We don't want the i915 texenv program to be applied to DrawPixels. + * This is really just a performance optimization (mesa will other- + * wise happily run the fragment program on each pixel in the image). + */ struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current; ctx->FragmentProgram._Current = NULL; _swrast_DrawPixels( ctx, x, y, width, height, format, type, |