From 486734a5d50ff9114b567b5e9eac6337248a80e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Apr 2002 16:56:24 +0000 Subject: Texture combine alpha subtraction was wrong. Fixed 16-bit channel glitches --- src/mesa/swrast/s_texture.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index e1ba958417..617c04ca68 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.57 2002/03/23 16:33:53 brianp Exp $ */ +/* $Id: s_texture.c,v 1.58 2002/04/04 16:56:24 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2542,6 +2542,16 @@ texture_combine(const GLcontext *ctx, ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); + /* + printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", + textureUnit->CombineModeRGB, + textureUnit->CombineModeA, + textureUnit->CombineSourceRGB[0], + textureUnit->CombineSourceA[0], + textureUnit->CombineSourceRGB[1], + textureUnit->CombineSourceA[1]); + */ + /* * Do operand setup for up to 3 operands. Loop over the terms. */ @@ -2689,7 +2699,7 @@ texture_combine(const GLcontext *ctx, const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; #if CHAN_TYPE != GL_FLOAT - const GLint shift = 8 - RGBshift; + const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT @@ -2756,7 +2766,7 @@ texture_combine(const GLcontext *ctx, const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; #if CHAN_TYPE != GL_FLOAT - const GLint shift = 8 - RGBshift; + const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT @@ -2861,7 +2871,7 @@ texture_combine(const GLcontext *ctx, const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; #if CHAN_TYPE != GL_FLOAT - const GLint shift = 8 - Ashift; + const GLint shift = CHAN_BITS - Ashift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT @@ -2908,7 +2918,7 @@ texture_combine(const GLcontext *ctx, const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; #if CHAN_TYPE != GL_FLOAT - const GLint shift = 8 - Ashift; + const GLint shift = CHAN_BITS - Ashift; #endif for (i=0; i