From: Brian Paul Date: Sun, 8 Mar 2009 23:58:54 +0000 (-0600) Subject: mesa: texture combine clean-ups X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd9b2be8284fda3f8aac235908ded118b5648a38;p=mesa.git mesa: texture combine clean-ups Use MAX_COMBINER_TERMS instead of 4. Rename some vars. Update comments. --- diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e77dd1d226a..c1f06885ec4 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1338,18 +1338,23 @@ struct gl_texture_object }; +/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */ +#define MAX_COMBINER_TERMS 4 + + /** * Texture combine environment state. - * Up to four combiner sources are possible with GL_NV_texture_env_combine4. */ struct gl_tex_env_combine_state { GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ - GLenum SourceRGB[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ - GLenum SourceA[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ - GLenum OperandRGB[4]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */ - GLenum OperandA[4]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */ + /** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */ + GLenum SourceRGB[MAX_COMBINER_TERMS]; + GLenum SourceA[MAX_COMBINER_TERMS]; + /** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */ + GLenum OperandRGB[MAX_COMBINER_TERMS]; + GLenum OperandA[MAX_COMBINER_TERMS]; GLuint ScaleShiftRGB; /**< 0, 1 or 2 */ GLuint ScaleShiftA; /**< 0, 1 or 2 */ GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */ diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index c2960fc8208..4d511f2f7ed 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -184,7 +184,7 @@ set_combiner_source(GLcontext *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { - GLuint src; + GLuint term; GLboolean alpha, legal; if (!ctx->Extensions.EXT_texture_env_combine && @@ -194,24 +194,24 @@ set_combiner_source(GLcontext *ctx, } /* - * Translate pname to (src, alpha). + * Translate pname to (term, alpha). */ switch (pname) { case GL_SOURCE0_RGB: - src = 0; + term = 0; alpha = GL_FALSE; break; case GL_SOURCE1_RGB: - src = 1; + term = 1; alpha = GL_FALSE; break; case GL_SOURCE2_RGB: - src = 2; + term = 2; alpha = GL_FALSE; break; case GL_SOURCE3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { - src = 3; + term = 3; alpha = GL_FALSE; } else { @@ -220,20 +220,20 @@ set_combiner_source(GLcontext *ctx, } break; case GL_SOURCE0_ALPHA: - src = 0; + term = 0; alpha = GL_TRUE; break; case GL_SOURCE1_ALPHA: - src = 1; + term = 1; alpha = GL_TRUE; break; case GL_SOURCE2_ALPHA: - src = 2; + term = 2; alpha = GL_TRUE; break; case GL_SOURCE3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { - src = 3; + term = 3; alpha = GL_TRUE; } else { @@ -246,7 +246,7 @@ set_combiner_source(GLcontext *ctx, return; } - assert(src < 4); + assert(term < MAX_COMBINER_TERMS); /* * Error-check param (the source term) @@ -288,9 +288,9 @@ set_combiner_source(GLcontext *ctx, FLUSH_VERTICES(ctx, _NEW_TEXTURE); if (alpha) - texUnit->Combine.SourceA[src] = param; + texUnit->Combine.SourceA[term] = param; else - texUnit->Combine.SourceRGB[src] = param; + texUnit->Combine.SourceRGB[term] = param; } @@ -300,7 +300,7 @@ set_combiner_operand(GLcontext *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { - GLuint op; + GLuint term; GLboolean alpha, legal; if (!ctx->Extensions.EXT_texture_env_combine && @@ -311,16 +311,16 @@ set_combiner_operand(GLcontext *ctx, switch (pname) { case GL_OPERAND0_RGB: - op = 0; + term = 0; alpha = GL_FALSE; break; case GL_OPERAND1_RGB: - op = 1; + term = 1; alpha = GL_FALSE; break; case GL_OPERAND2_RGB: if (ctx->Extensions.ARB_texture_env_combine) { - op = 2; + term = 2; alpha = GL_FALSE; } else { @@ -330,7 +330,7 @@ set_combiner_operand(GLcontext *ctx, break; case GL_OPERAND3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { - op = 3; + term = 3; alpha = GL_FALSE; } else { @@ -339,16 +339,16 @@ set_combiner_operand(GLcontext *ctx, } break; case GL_OPERAND0_ALPHA: - op = 0; + term = 0; alpha = GL_TRUE; break; case GL_OPERAND1_ALPHA: - op = 1; + term = 1; alpha = GL_TRUE; break; case GL_OPERAND2_ALPHA: if (ctx->Extensions.ARB_texture_env_combine) { - op = 2; + term = 2; alpha = GL_TRUE; } else { @@ -358,7 +358,7 @@ set_combiner_operand(GLcontext *ctx, break; case GL_OPERAND3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { - op = 3; + term = 3; alpha = GL_TRUE; } else { @@ -371,7 +371,7 @@ set_combiner_operand(GLcontext *ctx, return; } - assert(op < 4); + assert(term < MAX_COMBINER_TERMS); /* * Error-check param (the source operand) @@ -397,9 +397,9 @@ set_combiner_operand(GLcontext *ctx, FLUSH_VERTICES(ctx, _NEW_TEXTURE); if (alpha) - texUnit->Combine.OperandA[op] = param; + texUnit->Combine.OperandA[term] = param; else - texUnit->Combine.OperandRGB[op] = param; + texUnit->Combine.OperandRGB[term] = param; } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 3fbd119b347..4a124bf27e2 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -39,9 +39,6 @@ #include "texenvprogram.h" -#define MAX_TERMS 4 - - /* * Note on texture units: * @@ -95,11 +92,11 @@ struct state_key { GLuint NumArgsRGB:3; GLuint ModeRGB:5; - struct mode_opt OptRGB[MAX_TERMS]; + struct mode_opt OptRGB[MAX_COMBINER_TERMS]; GLuint NumArgsA:3; GLuint ModeA:5; - struct mode_opt OptA[MAX_TERMS]; + struct mode_opt OptA[MAX_COMBINER_TERMS]; } unit[8]; }; @@ -389,7 +386,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB; key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA; - for (j = 0; j < MAX_TERMS; j++) { + for (j = 0; j < MAX_COMBINER_TERMS; j++) { key->unit[i].OptRGB[j].Operand = translate_operand(texUnit->_CurrentCombine->OperandRGB[j]); key->unit[i].OptA[j].Operand = @@ -972,11 +969,11 @@ static struct ureg emit_combine( struct texenv_fragment_program *p, GLuint mode, const struct mode_opt *opt) { - struct ureg src[MAX_TERMS]; + struct ureg src[MAX_COMBINER_TERMS]; struct ureg tmp, half; GLuint i; - assert(nr <= MAX_TERMS); + assert(nr <= MAX_COMBINER_TERMS); tmp = undef; /* silence warning (bug 5318) */ diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 5f032bbd69d..b71fb9eae97 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -74,7 +74,6 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); @@ -116,7 +115,6 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 27c5c15cf16..76b95e8ae7a 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -37,23 +37,23 @@ #include "s_texcombine.h" -#define MAX_COMBINER_TERMS 4 - - /** - * Do texture application for GL_ARB/EXT_texture_env_combine. - * This function also supports GL_{EXT,ARB}_texture_env_dot3 and - * GL_ATI_texture_env_combine3. Since "classic" texture environments are - * implemented using GL_ARB_texture_env_combine-like state, this same function - * is used for classic texture environment application as well. + * Do texture application for: + * GL_EXT_texture_env_combine + * GL_ARB_texture_env_combine + * GL_EXT_texture_env_dot3 + * GL_ARB_texture_env_dot3 + * GL_ATI_texture_env_combine3 + * GL_NV_texture_env_combine4 + * conventional GL texture env modes * * \param ctx rendering context - * \param textureUnit the texture unit to apply + * \param unit the texture combiner unit * \param n number of fragments to process (span width) * \param primary_rgba incoming fragment color array * \param texelBuffer pointer to texel colors for all texture units * - * \param rgba incoming colors, which get modified here + * \param rgba incoming/result fragment colors */ static void texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, @@ -65,16 +65,14 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; const GLfloat (*argRGB [MAX_COMBINER_TERMS])[4]; const GLfloat (*argA [MAX_COMBINER_TERMS])[4]; - const GLfloat RGBmult = (GLfloat) (1 << combine->ScaleShiftRGB); - const GLfloat Amult = (GLfloat) (1 << combine->ScaleShiftA); - const GLuint numColorArgs = combine->_NumArgsRGB; - const GLuint numAlphaArgs = combine->_NumArgsA; + const GLfloat scaleRGB = (GLfloat) (1 << combine->ScaleShiftRGB); + const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA); + const GLuint numArgsRGB = combine->_NumArgsRGB; + const GLuint numArgsA = combine->_NumArgsA; GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */ GLfloat rgba[MAX_WIDTH][4]; GLuint i, term; - ASSERT(ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine); ASSERT(CONST_SWRAST_CONTEXT(ctx)->_AnyTextureCombine); for (i = 0; i < n; i++) { @@ -97,7 +95,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* * Do operand setup for up to 4 operands. Loop over the terms. */ - for (term = 0; term < numColorArgs; term++) { + for (term = 0; term < numArgsRGB; term++) { const GLenum srcRGB = combine->SourceRGB[term]; const GLenum operandRGB = combine->OperandRGB[term]; @@ -193,9 +191,9 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } /* - * Set up the argA[i] pointers + * Set up the argA[term] pointers */ - for (term = 0; term < numAlphaArgs; term++) { + for (term = 0; term < numArgsA; term++) { const GLenum srcA = combine->SourceA[term]; const GLenum operandA = combine->OperandA[term]; @@ -269,16 +267,16 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (combine->ModeRGB) { case GL_REPLACE: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; + rgba[i][RCOMP] = arg0[i][RCOMP] * scaleRGB; + rgba[i][GCOMP] = arg0[i][GCOMP] * scaleRGB; + rgba[i][BCOMP] = arg0[i][BCOMP] * scaleRGB; } break; case GL_MODULATE: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; + rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * scaleRGB; + rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * scaleRGB; + rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * scaleRGB; } break; case GL_ADD: @@ -286,19 +284,19 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + - arg2[i][RCOMP] * arg3[i][RCOMP]) * RGBmult; + arg2[i][RCOMP] * arg3[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + - arg2[i][GCOMP] * arg3[i][GCOMP]) * RGBmult; + arg2[i][GCOMP] * arg3[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + - arg2[i][BCOMP] * arg3[i][BCOMP]) * RGBmult; + arg2[i][BCOMP] * arg3[i][BCOMP]) * scaleRGB; } } else { /* 2-term addition */ for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * scaleRGB; } } break; @@ -307,45 +305,45 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) - 0.5 */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] * - arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * RGBmult; + arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] * - arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * RGBmult; + arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] * - arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * RGBmult; + arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * scaleRGB; } } else { for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB; } } break; case GL_INTERPOLATE: for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + - arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * RGBmult; + arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + - arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * RGBmult; + arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + - arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * RGBmult; + arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * scaleRGB; } break; case GL_SUBTRACT: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * scaleRGB; } break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: /* Do not scale the result by 1 2 or 4 */ for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + + (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + + (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) * 4.0F; dot = CLAMP(dot, 0.0F, 1.0F); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; @@ -355,10 +353,10 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_DOT3_RGBA: /* DO scale the result by 1 2 or 4 */ for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) - * 4.0F * RGBmult; + GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + + (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + + (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) + * 4.0F * scaleRGB; dot = CLAMP(dot, 0.0, 1.0F); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } @@ -366,31 +364,31 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_MODULATE_ADD_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP]) * RGBmult; + arg1[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP]) * RGBmult; + arg1[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP]) * RGBmult; + arg1[i][BCOMP]) * scaleRGB; } break; case GL_MODULATE_SIGNED_ADD_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP] - 0.5) * RGBmult; + arg1[i][RCOMP] - 0.5) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP] - 0.5) * RGBmult; + arg1[i][GCOMP] - 0.5) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP] - 0.5) * RGBmult; + arg1[i][BCOMP] - 0.5) * scaleRGB; } break; case GL_MODULATE_SUBTRACT_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - - arg1[i][RCOMP]) * RGBmult; + arg1[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - - arg1[i][GCOMP]) * RGBmult; + arg1[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - - arg1[i][BCOMP]) * RGBmult; + arg1[i][BCOMP]) * scaleRGB; } break; case GL_BUMP_ENVMAP_ATI: @@ -427,13 +425,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (combine->ModeA) { case GL_REPLACE: for (i = 0; i < n; i++) { - GLfloat a = arg0[i][ACOMP] * Amult; + GLfloat a = arg0[i][ACOMP] * scaleA; rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); } break; case GL_MODULATE: for (i = 0; i < n; i++) { - rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; + rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * scaleA; } break; case GL_ADD: @@ -441,13 +439,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) */ for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + - arg2[i][ACOMP] * arg3[i][ACOMP]) * Amult; + arg2[i][ACOMP] * arg3[i][ACOMP]) * scaleA; } } else { /* two-term add */ for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * scaleA; } } break; @@ -457,13 +455,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP] - - 0.5) * Amult; + 0.5) * scaleA; } } else { /* a + b - 0.5 */ for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * scaleA; } } break; @@ -471,30 +469,30 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i=0; i