Mesa (master): swrast: Don't try to adjust_colors for < 8bpc when handling R16, RG1616.
Eric Anholt
anholt at kemper.freedesktop.org
Mon Apr 18 18:21:17 UTC 2011
Module: Mesa
Branch: master
Commit: 2b624634dda23d3b94045fb07aea558df39b48ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b624634dda23d3b94045fb07aea558df39b48ff
Author: Eric Anholt <eric at anholt.net>
Date: Fri Apr 15 19:55:38 2011 -0700
swrast: Don't try to adjust_colors for <8bpc when handling R16, RG1616.
The GL_RED and GL_RG were tricking this code into executing, but it's
totally unprepared for a 16-bit channel and just rescaled the values
down to 0. We don't have anything with <8bit channels alongside >8bit
channels, so disabling it should be safe.
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/swrast/s_readpix.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index cca7ec0..5604c2e 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -344,9 +344,9 @@ read_rgba_pixels( struct gl_context *ctx,
_swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba);
/* apply fudge factor for shallow color buffers */
- if (fb->Visual.redBits < 8 ||
- fb->Visual.greenBits < 8 ||
- fb->Visual.blueBits < 8) {
+ if ((fb->Visual.redBits < 8 && fb->Visual.redBits != 0) ||
+ (fb->Visual.greenBits < 8 && fb->Visual.greenBits != 0) ||
+ (fb->Visual.blueBits < 8 && fb->Visual.blueBits != 0)) {
adjust_colors(fb, width, rgba);
}
More information about the mesa-commit
mailing list