summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i830/i830_texstate.c20
-rw-r--r--src/mesa/drivers/dri/mga/mga_texcombine.c66
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c940
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c24
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_texstate.c128
5 files changed, 360 insertions, 818 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c
index 8e93a5b8fe..19775db94c 100644
--- a/src/mesa/drivers/dri/i830/i830_texstate.c
+++ b/src/mesa/drivers/dri/i830/i830_texstate.c
@@ -1021,14 +1021,14 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
GLuint args_RGB[3];
GLuint args_A[3];
GLuint texel_op = GetTexelOp(unit);
- GLuint rgb_shift = texUnit->CombineScaleShiftRGB;
- GLuint alpha_shift = texUnit->CombineScaleShiftA;
+ GLuint rgb_shift = texUnit->Combine.ScaleShiftRGB;
+ GLuint alpha_shift = texUnit->Combine.ScaleShiftA;
int i;
if(I830_DEBUG&DEBUG_TEXTURE)
fprintf(stderr, "%s\n", __FUNCTION__);
- switch(texUnit->CombineModeRGB) {
+ switch(texUnit->Combine.ModeRGB) {
case GL_REPLACE:
blendop = TEXBLENDOP_ARG1;
break;
@@ -1067,7 +1067,7 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
blendop |= (rgb_shift << TEXOP_SCALE_SHIFT);
- switch(texUnit->CombineModeA) {
+ switch(texUnit->Combine.ModeA) {
case GL_REPLACE:
ablendop = TEXBLENDOP_ARG1;
break;
@@ -1090,8 +1090,8 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
return;
}
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGBA) ) {
+ if ( (texUnit->Combine.ModeRGB == GL_DOT3_RGBA_EXT)
+ || (texUnit->Combine.ModeRGB == GL_DOT3_RGBA) ) {
ablendop = TEXBLENDOP_DOT3;
}
@@ -1099,7 +1099,7 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
/* Handle RGB args */
for(i = 0; i < 3; i++) {
- switch(texUnit->CombineSourceRGB[i]) {
+ switch(texUnit->Combine.SourceRGB[i]) {
case GL_TEXTURE:
args_RGB[i] = texel_op;
break;
@@ -1117,7 +1117,7 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
}
- switch(texUnit->CombineOperandRGB[i]) {
+ switch(texUnit->Combine.OperandRGB[i]) {
case GL_SRC_COLOR:
args_RGB[i] |= 0;
break;
@@ -1138,7 +1138,7 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
/* Handle A args */
for(i = 0; i < 3; i++) {
- switch(texUnit->CombineSourceA[i]) {
+ switch(texUnit->Combine.SourceA[i]) {
case GL_TEXTURE:
args_A[i] = texel_op;
break;
@@ -1156,7 +1156,7 @@ static void i830SetTexEnvCombine(i830ContextPtr imesa,
}
- switch(texUnit->CombineOperandA[i]) {
+ switch(texUnit->Combine.OperandA[i]) {
case GL_SRC_ALPHA:
args_A[i] |= 0;
break;
diff --git a/src/mesa/drivers/dri/mga/mga_texcombine.c b/src/mesa/drivers/dri/mga/mga_texcombine.c
index ca7322a599..bbfa29be5f 100644
--- a/src/mesa/drivers/dri/mga/mga_texcombine.c
+++ b/src/mesa/drivers/dri/mga/mga_texcombine.c
@@ -52,7 +52,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
int args[3];
int i;
- switch (texUnit->CombineModeRGB) {
+ switch (texUnit->Combine.ModeRGB) {
case GL_REPLACE:
numColorArgs = 1;
break;
@@ -72,7 +72,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch (texUnit->CombineModeA) {
+ switch (texUnit->Combine.ModeA) {
case GL_REPLACE:
numAlphaArgs = 1;
break;
@@ -97,7 +97,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
for (i = 0;i < numColorArgs; i++) {
- switch (texUnit->CombineSourceRGB[i]) {
+ switch (texUnit->Combine.SourceRGB[i]) {
case GL_TEXTURE:
arg1[i] |= 0;
arg2[i] |= ARG_DISABLE;
@@ -181,11 +181,11 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch (texUnit->CombineOperandRGB[i]) {
+ switch (texUnit->Combine.OperandRGB[i]) {
case GL_SRC_COLOR:
arg1[i] |= 0;
arg2[i] |= 0;
- if (texUnit->CombineSourceRGB[i] == GL_CONSTANT &&
+ if (texUnit->Combine.SourceRGB[i] == GL_CONSTANT &&
RGBA_EQUAL( mmesa->envcolor[source] )) {
alpha[i] |= 0;
} else {
@@ -195,7 +195,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
case GL_ONE_MINUS_SRC_COLOR:
arg1[i] |= TD0_color_arg1_inv_enable;
arg2[i] |= TD0_color_arg2_inv_enable;
- if (texUnit->CombineSourceRGB[i] == GL_CONSTANT &&
+ if (texUnit->Combine.SourceRGB[i] == GL_CONSTANT &&
RGBA_EQUAL( mmesa->envcolor[source] )) {
alpha[i] |= (TD0_color_alpha1inv_enable |
TD0_color_alpha2inv_enable);
@@ -219,7 +219,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
}
- switch (texUnit->CombineModeRGB) {
+ switch (texUnit->Combine.ModeRGB) {
case GL_MODULATE_ADD_ATI:
case GL_MODULATE_SIGNED_ADD_ATI:
/* Special handling for ATI_texture_env_combine3.
@@ -302,12 +302,12 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
} else
if ((arg1[1] | arg2[0] | alpha[2]) != ARG_DISABLE &&
- texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
+ texUnit->Combine.ModeRGB != GL_MODULATE_SUBTRACT_ATI) {
*reg |= arg1[1] | arg2[0] | alpha[2];
args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
} else
if ((arg1[1] | arg2[2] | alpha[0]) != ARG_DISABLE &&
- texUnit->CombineModeRGB != GL_MODULATE_SUBTRACT_ATI) {
+ texUnit->Combine.ModeRGB != GL_MODULATE_SUBTRACT_ATI) {
*reg |= arg1[1] | arg2[2] | alpha[0];
args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
} else
@@ -328,9 +328,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
}
- switch (texUnit->CombineModeRGB) {
+ switch (texUnit->Combine.ModeRGB) {
case GL_REPLACE:
- if (texUnit->CombineScaleShiftRGB) {
+ if (texUnit->Combine.ScaleShiftRGB) {
return GL_FALSE;
}
@@ -344,9 +344,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
break;
case GL_MODULATE:
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_modbright_2x;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
*reg |= TD0_color_modbright_4x;
}
@@ -368,9 +368,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
/* Can't get alpha to the adder */
return GL_FALSE;
}
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
return GL_FALSE;
}
@@ -382,9 +382,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
/* Only alpha can function as Arg2 */
return GL_FALSE;
}
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
return GL_FALSE;
}
@@ -422,9 +422,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
/* Can't get alpha to the adder */
return GL_FALSE;
}
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
return GL_FALSE;
}
@@ -445,9 +445,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
/* Can't get alpha to the adder */
return GL_FALSE;
}
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
return GL_FALSE;
}
@@ -487,9 +487,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
/* Can't swap arguments */
return GL_FALSE;
}
- if (texUnit->CombineScaleShiftRGB == 1) {
+ if (texUnit->Combine.ScaleShiftRGB == 1) {
*reg |= TD0_color_add2x_enable;
- } else if (texUnit->CombineScaleShiftRGB == 2) {
+ } else if (texUnit->Combine.ScaleShiftRGB == 2) {
return GL_FALSE;
}
@@ -515,7 +515,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
for (i = 0; i < numAlphaArgs; i++) {
- switch (texUnit->CombineSourceA[i]) {
+ switch (texUnit->Combine.SourceA[i]) {
case GL_TEXTURE:
arg1[i] |= 0;
arg2[i] |= ARG_DISABLE;
@@ -589,7 +589,7 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch (texUnit->CombineOperandA[i]) {
+ switch (texUnit->Combine.OperandA[i]) {
case GL_SRC_ALPHA:
arg1[i] |= 0;
arg2[i] |= 0;
@@ -614,9 +614,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch (texUnit->CombineModeA) {
+ switch (texUnit->Combine.ModeA) {
case GL_REPLACE:
- if (texUnit->CombineScaleShiftA) {
+ if (texUnit->Combine.ScaleShiftA) {
return GL_FALSE;
}
@@ -627,9 +627,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
}
break;
case GL_MODULATE:
- if (texUnit->CombineScaleShiftA == 1) {
+ if (texUnit->Combine.ScaleShiftA == 1) {
*reg |= TD0_alpha_modbright_2x;
- } else if (texUnit->CombineScaleShiftA == 2) {
+ } else if (texUnit->Combine.ScaleShiftA == 2) {
*reg |= TD0_alpha_modbright_4x;
}
@@ -639,9 +639,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
*reg |= TD0_alpha_addbias_enable;
/* fallthrough */
case GL_ADD:
- if (texUnit->CombineScaleShiftA == 1) {
+ if (texUnit->Combine.ScaleShiftA == 1) {
*reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->CombineScaleShiftA == 2) {
+ } else if (texUnit->Combine.ScaleShiftA == 2) {
return GL_FALSE;
}
@@ -649,9 +649,9 @@ GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
TD0_alpha_sel_add);
break;
case GL_SUBTRACT:
- if (texUnit->CombineScaleShiftA == 1) {
+ if (texUnit->Combine.ScaleShiftA == 1) {
*reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->CombineScaleShiftA == 2) {
+ } else if (texUnit->Combine.ScaleShiftA == 2) {
return GL_FALSE;
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 8e171669c4..dbd15ac7ea 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -279,304 +279,6 @@ static void r200SetTexImages( r200ContextPtr rmesa,
* Texture combine functions
*/
-#define R200_DISABLE 0
-#define R200_REPLACE 1
-#define R200_MODULATE 2
-#define R200_DECAL 3
-#define R200_BLEND 4
-#define R200_ADD 5
-#define R200_MAX_COMBFUNC 6
-
-static GLuint r200_color_combine[][R200_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00802800
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x00800142
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR | /* current starts in DIFFUSE */
- R200_TXC_ARG_B_R0_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c2d42
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_R0_COLOR |
- R200_TXC_ARG_C_R0_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c2902
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00812802
- */
- (R200_TXC_ARG_A_DIFFUSE_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00803000
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x00800182
- */
- (R200_TXC_ARG_A_R0_COLOR | /* current in R0 thereafter */
- R200_TXC_ARG_B_R1_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c3582
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R1_COLOR |
- R200_TXC_ARG_C_R1_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c3102
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00813002
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R1_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_REPLACE = 0x00803800
- */
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_OP_MADD),
-
- /* GL_MODULATE = 0x008001c2
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R2_COLOR |
- R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD),
-
- /* GL_DECAL = 0x008c3dc2
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_R2_COLOR |
- R200_TXC_ARG_C_R2_ALPHA |
- R200_TXC_OP_LERP),
-
- /* GL_BLEND = 0x008c3902
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_TFACTOR_COLOR |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_OP_LERP),
-
- /* GL_ADD = 0x00813802
- */
- (R200_TXC_ARG_A_R0_COLOR |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R2_COLOR |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD),
- }
-};
-
-static GLuint r200_alpha_combine[][R200_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD),
-
-
- /* GL_REPLACE = 0x00800500
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_R0_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800051
- */
- (R200_TXA_ARG_A_DIFFUSE_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_REPLACE = 0x00800600
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_R1_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800061
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R1_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- },
-
- /* Unit 2:
- */
- {
- /* Disable combiner stage
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_REPLACE = 0x00800700
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_MODULATE = 0x00800071
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_R2_ALPHA |
- R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD),
-
- /* GL_DECAL = 0x00800100
- */
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD),
-
- /* GL_BLEND = 0x00800071
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_TFACTOR_ALPHA |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_OP_LERP),
-
- /* GL_ADD = 0x00800021
- */
- (R200_TXA_ARG_A_R0_ALPHA |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R2_ALPHA |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD),
- }
-};
-
-
/* GL_ARB_texture_env_combine support
*/
@@ -731,443 +433,283 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit )
*/
rmesa->state.texture.unit[unit].format = 0;
rmesa->state.texture.unit[unit].envMode = 0;
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
+ if ( unit == 0 ) {
+ color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
+ | R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD;
+ alpha_combine = R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO
+ | R200_TXA_ARG_C_DIFFUSE_ALPHA | R200_TXA_OP_MADD;
+ }
+ else {
+ color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
+ | R200_TXC_ARG_C_R0_COLOR | R200_TXC_OP_MADD;
+ alpha_combine = R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO
+ | R200_TXA_ARG_C_R0_ALPHA | R200_TXA_OP_MADD;
+ }
}
else {
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
GLuint color_arg[3], alpha_arg[3];
- GLuint i, numColorArgs = 0, numAlphaArgs = 0;
- GLuint RGBshift = texUnit->CombineScaleShiftRGB;
- GLuint Ashift = texUnit->CombineScaleShiftA;
-
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_REPLACE];
- alpha_combine = r200_alpha_combine[unit][R200_REPLACE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_REPLACE];
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_REPLACE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
+ GLuint i;
+ const GLuint numColorArgs = texUnit->_CurrentCombine->_NumArgsRGB;
+ const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA;
+ GLuint RGBshift = texUnit->_CurrentCombine->ScaleShiftRGB;
+ GLuint Ashift = texUnit->_CurrentCombine->ScaleShiftA;
- case GL_MODULATE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_MODULATE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_MODULATE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
+ /* Don't cache these results.
+ */
+ rmesa->state.texture.unit[unit].format = 0;
+ rmesa->state.texture.unit[unit].envMode = 0;
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_DECAL];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
- case GL_BLEND:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_BLEND];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
+ /* Step 1:
+ * Extract the color and alpha combine function arguments.
+ */
+ for ( i = 0 ; i < numColorArgs ; i++ ) {
+ const GLuint op = texUnit->_CurrentCombine->OperandRGB[i] - GL_SRC_COLOR;
+ assert(op >= 0);
+ assert(op <= 3);
+ switch ( texUnit->_CurrentCombine->SourceRGB[i] ) {
+ case GL_TEXTURE:
+ color_arg[i] = r200_register_color[op][unit];
break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
+ case GL_CONSTANT:
+ color_arg[i] = r200_tfactor_color[op];
break;
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_BLEND];
- alpha_combine = r200_alpha_combine[unit][R200_BLEND];
+ case GL_PRIMARY_COLOR:
+ color_arg[i] = r200_primary_color[op];
break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_ADD:
- switch ( format ) {
- case GL_RGBA:
- case GL_RGB:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_YCBCR_MESA:
- color_combine = r200_color_combine[unit][R200_ADD];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
+ case GL_PREVIOUS:
+ if (unit == 0)
+ color_arg[i] = r200_primary_color[op];
+ else
+ color_arg[i] = r200_register_color[op][0];
break;
- case GL_ALPHA:
- color_combine = r200_color_combine[unit][R200_DISABLE];
- alpha_combine = r200_alpha_combine[unit][R200_MODULATE];
+ case GL_ZERO:
+ color_arg[i] = r200_zero_color[op];
break;
- case GL_INTENSITY:
- color_combine = r200_color_combine[unit][R200_ADD];
- alpha_combine = r200_alpha_combine[unit][R200_ADD];
+ case GL_ONE:
+ color_arg[i] = r200_zero_color[op+1];
break;
- case GL_COLOR_INDEX:
default:
return GL_FALSE;
}
- break;
-
- case GL_COMBINE:
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
+ }
- /* Step 0:
- * Calculate how many arguments we need to process.
- */
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- numColorArgs = 1;
+ for ( i = 0 ; i < numAlphaArgs ; i++ ) {
+ const GLuint op = texUnit->_CurrentCombine->OperandA[i] - GL_SRC_ALPHA;
+ assert(op >= 0);
+ assert(op <= 1);
+ switch ( texUnit->_CurrentCombine->SourceA[i] ) {
+ case GL_TEXTURE:
+ alpha_arg[i] = r200_register_alpha[op][unit];
break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- numColorArgs = 2;
+ case GL_CONSTANT:
+ alpha_arg[i] = r200_tfactor_alpha[op];
break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numColorArgs = 3;
+ case GL_PRIMARY_COLOR:
+ alpha_arg[i] = r200_primary_alpha[op];
break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- numAlphaArgs = 1;
+ case GL_PREVIOUS:
+ if (unit == 0)
+ alpha_arg[i] = r200_primary_alpha[op];
+ else
+ alpha_arg[i] = r200_register_alpha[op][0];
break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numAlphaArgs = 2;
+ case GL_ZERO:
+ alpha_arg[i] = r200_zero_alpha[op];
break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numAlphaArgs = 3;
+ case GL_ONE:
+ alpha_arg[i] = r200_zero_alpha[op+1];
break;
default:
return GL_FALSE;
}
+ }
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR;
- assert(op >= 0);
- assert(op <= 3);
- switch ( texUnit->CombineSourceRGB[i] ) {
- case GL_TEXTURE:
- color_arg[i] = r200_register_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = r200_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = r200_primary_color[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- color_arg[i] = r200_primary_color[op];
- else
- color_arg[i] = r200_register_color[op][0];
- break;
- case GL_ZERO:
- color_arg[i] = r200_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = r200_zero_color[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA;
- assert(op >= 0);
- assert(op <= 1);
- switch ( texUnit->CombineSourceA[i] ) {
- case GL_TEXTURE:
- alpha_arg[i] = r200_register_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = r200_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = r200_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- alpha_arg[i] = r200_primary_alpha[op];
- else
- alpha_arg[i] = r200_register_alpha[op][0];
- break;
- case GL_ZERO:
- alpha_arg[i] = r200_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = r200_zero_alpha[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
+ /* Step 2:
+ * Build up the color and alpha combine functions.
+ */
+ switch ( texUnit->_CurrentCombine->ModeRGB ) {
+ case GL_REPLACE:
+ color_combine = (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, C );
+ break;
+ case GL_MODULATE:
+ color_combine = (R200_TXC_ARG_C_ZERO |
+ R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, B );
+ break;
+ case GL_ADD:
+ color_combine = (R200_TXC_ARG_B_ZERO |
+ R200_TXC_COMP_ARG_B |
+ R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ break;
+ case GL_ADD_SIGNED:
+ color_combine = (R200_TXC_ARG_B_ZERO |
+ R200_TXC_COMP_ARG_B |
+ R200_TXC_BIAS_ARG_C | /* new */
+ R200_TXC_OP_MADD); /* was ADDSIGNED */
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ break;
+ case GL_SUBTRACT:
+ color_combine = (R200_TXC_ARG_B_ZERO |
+ R200_TXC_COMP_ARG_B |
+ R200_TXC_NEG_ARG_C |
+ R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ break;
+ case GL_INTERPOLATE:
+ color_combine = (R200_TXC_OP_LERP);
+ R200_COLOR_ARG( 0, B );
+ R200_COLOR_ARG( 1, A );
+ R200_COLOR_ARG( 2, C );
+ break;
- /* Step 2:
- * Build up the color and alpha combine functions.
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ /* The EXT version of the DOT3 extension does not support the
+ * scale factor, but the ARB version (and the version in OpenGL
+ * 1.3) does.
+ */
+ RGBshift = 0;
+ Ashift = 0;
+ /* FALLTHROUGH */
+
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ /* DOT3 works differently on R200 than on R100. On R100, just
+ * setting the DOT3 mode did everything for you. On R200, the
+ * driver has to enable the biasing and scale in the inputs to
+ * put them in the proper [-1,1] range. This is what the 4x and
+ * the -0.5 in the DOT3 spec do. The post-scale is then set
+ * normally.
*/
- switch ( texUnit->CombineModeRGB ) {
- case GL_REPLACE:
- color_combine = (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, C );
- break;
- case GL_MODULATE:
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
- case GL_ADD:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- color_combine = (R200_TXC_OP_LERP);
- R200_COLOR_ARG( 0, B );
- R200_COLOR_ARG( 1, A );
- R200_COLOR_ARG( 2, C );
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- Ashift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* DOT3 works differently on R200 than on R100. On R100, just
- * setting the DOT3 mode did everything for you. On R200, the
- * driver has to enable the biasing and scale in the inputs to
- * put them in the proper [-1,1] range. This is what the 4x and
- * the -0.5 in the DOT3 spec do. The post-scale is then set
- * normally.
- */
-
- RGBshift++;
- Ashift = RGBshift;
-
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_DOT3 |
- R200_TXC_BIAS_ARG_A |
- R200_TXC_BIAS_ARG_B |
- R200_TXC_SCALE_ARG_A |
- R200_TXC_SCALE_ARG_B);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->CombineModeA ) {
- case GL_REPLACE:
- alpha_combine = (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, C );
- break;
- case GL_MODULATE:
- alpha_combine = (R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, B );
- break;
- case GL_ADD:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- alpha_combine = (R200_TXA_OP_LERP);
- R200_ALPHA_ARG( 0, B );
- R200_ALPHA_ARG( 1, A );
- R200_ALPHA_ARG( 2, C );
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGB_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGB) ) {
- alpha_scale |= R200_TXA_DOT_ALPHA;
- }
+ RGBshift++;
+ Ashift = RGBshift;
+
+ color_combine = (R200_TXC_ARG_C_ZERO |
+ R200_TXC_OP_DOT3 |
+ R200_TXC_BIAS_ARG_A |
+ R200_TXC_BIAS_ARG_B |
+ R200_TXC_SCALE_ARG_A |
+ R200_TXC_SCALE_ARG_B);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, B );
+ break;
- /* Step 3:
- * Apply the scale factor.
- */
- color_scale &= ~R200_TXC_SCALE_MASK;
- alpha_scale &= ~R200_TXA_SCALE_MASK;
- color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT);
- alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT);
+ case GL_MODULATE_ADD_ATI:
+ color_combine = (R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ R200_COLOR_ARG( 2, B );
+ break;
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ color_combine = (R200_TXC_BIAS_ARG_C | /* new */
+ R200_TXC_OP_MADD); /* was ADDSIGNED */
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ R200_COLOR_ARG( 2, B );
+ break;
+ case GL_MODULATE_SUBTRACT_ATI:
+ color_combine = (R200_TXC_NEG_ARG_C |
+ R200_TXC_OP_MADD);
+ R200_COLOR_ARG( 0, A );
+ R200_COLOR_ARG( 1, C );
+ R200_COLOR_ARG( 2, B );
+ break;
+ default:
+ return GL_FALSE;
+ }
- /* All done!
- */
+ switch ( texUnit->_CurrentCombine->ModeA ) {
+ case GL_REPLACE:
+ alpha_combine = (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, C );
+ break;
+ case GL_MODULATE:
+ alpha_combine = (R200_TXA_ARG_C_ZERO |
+ R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, B );
+ break;
+ case GL_ADD:
+ alpha_combine = (R200_TXA_ARG_B_ZERO |
+ R200_TXA_COMP_ARG_B |
+ R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ break;
+ case GL_ADD_SIGNED:
+ alpha_combine = (R200_TXA_ARG_B_ZERO |
+ R200_TXA_COMP_ARG_B |
+ R200_TXA_BIAS_ARG_C | /* new */
+ R200_TXA_OP_MADD); /* was ADDSIGNED */
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ break;
+ case GL_SUBTRACT:
+ alpha_combine = (R200_TXA_ARG_B_ZERO |
+ R200_TXA_COMP_ARG_B |
+ R200_TXA_NEG_ARG_C |
+ R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ break;
+ case GL_INTERPOLATE:
+ alpha_combine = (R200_TXA_OP_LERP);
+ R200_ALPHA_ARG( 0, B );
+ R200_ALPHA_ARG( 1, A );
+ R200_ALPHA_ARG( 2, C );
break;
+ case GL_MODULATE_ADD_ATI:
+ alpha_combine = (R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ R200_ALPHA_ARG( 2, B );
+ break;
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */
+ R200_TXA_OP_MADD); /* was ADDSIGNED */
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ R200_ALPHA_ARG( 2, B );
+ break;
+ case GL_MODULATE_SUBTRACT_ATI:
+ alpha_combine = (R200_TXA_NEG_ARG_C |
+ R200_TXA_OP_MADD);
+ R200_ALPHA_ARG( 0, A );
+ R200_ALPHA_ARG( 1, C );
+ R200_ALPHA_ARG( 2, B );
+ break;
default:
return GL_FALSE;
}
+
+ if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB_EXT)
+ || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB) ) {
+ alpha_scale |= R200_TXA_DOT_ALPHA;
+ }
+
+ /* Step 3:
+ * Apply the scale factor.
+ */
+ color_scale &= ~R200_TXC_SCALE_MASK;
+ alpha_scale &= ~R200_TXA_SCALE_MASK;
+ color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT);
+ alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT);
+
+ /* All done!
+ */
}
if ( rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine ||
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index f4991a70a2..563a7e9ea0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -782,8 +782,8 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
GLuint color_arg[3], alpha_arg[3];
GLuint i, numColorArgs = 0, numAlphaArgs = 0;
- GLuint RGBshift = texUnit->CombineScaleShiftRGB;
- GLuint Ashift = texUnit->CombineScaleShiftA;
+ GLuint RGBshift = texUnit->Combine.ScaleShiftRGB;
+ GLuint Ashift = texUnit->Combine.ScaleShiftA;
switch ( texUnit->EnvMode ) {
case GL_REPLACE:
@@ -912,7 +912,7 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
/* Step 0:
* Calculate how many arguments we need to process.
*/
- switch ( texUnit->CombineModeRGB ) {
+ switch ( texUnit->Combine.ModeRGB ) {
case GL_REPLACE:
numColorArgs = 1;
break;
@@ -936,7 +936,7 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch ( texUnit->CombineModeA ) {
+ switch ( texUnit->Combine.ModeA ) {
case GL_REPLACE:
numAlphaArgs = 1;
break;
@@ -960,10 +960,10 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
* Extract the color and alpha combine function arguments.
*/
for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR;
+ const GLuint op = texUnit->Combine.OperandRGB[i] - GL_SRC_COLOR;
assert(op >= 0);
assert(op <= 3);
- switch ( texUnit->CombineSourceRGB[i] ) {
+ switch ( texUnit->Combine.SourceRGB[i] ) {
case GL_TEXTURE:
color_arg[i] = radeon_texture_color[op][unit];
break;
@@ -988,10 +988,10 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
}
for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLuint op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA;
+ const GLuint op = texUnit->Combine.OperandA[i] - GL_SRC_ALPHA;
assert(op >= 0);
assert(op <= 1);
- switch ( texUnit->CombineSourceA[i] ) {
+ switch ( texUnit->Combine.SourceA[i] ) {
case GL_TEXTURE:
alpha_arg[i] = radeon_texture_alpha[op][unit];
break;
@@ -1018,7 +1018,7 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
/* Step 2:
* Build up the color and alpha combine functions.
*/
- switch ( texUnit->CombineModeRGB ) {
+ switch ( texUnit->Combine.ModeRGB ) {
case GL_REPLACE:
color_combine = (RADEON_COLOR_ARG_A_ZERO |
RADEON_COLOR_ARG_B_ZERO |
@@ -1119,7 +1119,7 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
return GL_FALSE;
}
- switch ( texUnit->CombineModeA ) {
+ switch ( texUnit->Combine.ModeA ) {
case GL_REPLACE:
alpha_combine = (RADEON_ALPHA_ARG_A_ZERO |
RADEON_ALPHA_ARG_B_ZERO |
@@ -1191,8 +1191,8 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
return GL_FALSE;
}
- if ( (texUnit->CombineModeRGB == GL_DOT3_RGB_EXT)
- || (texUnit->CombineModeRGB == GL_DOT3_RGB) ) {
+ if ( (texUnit->Combine.ModeRGB == GL_DOT3_RGB_EXT)
+ || (texUnit->Combine.ModeRGB == GL_DOT3_RGB) ) {
alpha_combine |= RADEON_DOT_ALPHA_DONT_REPLICATE;
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
index 318d3a1c8f..c9caea3063 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
@@ -424,9 +424,9 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
*
* Calculate the color combination.
*/
- Shift_RGB = texUnit->CombineScaleShiftRGB;
- Shift_A = texUnit->CombineScaleShiftA;
- switch (texUnit->CombineModeRGB) {
+ Shift_RGB = texUnit->Combine.ScaleShiftRGB;
+ Shift_A = texUnit->Combine.ScaleShiftA;
+ switch (texUnit->Combine.ModeRGB) {
case GL_REPLACE:
/*
* The formula is: Arg0
@@ -434,11 +434,11 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* (Arg0 + 0(0))*(1-0) + 0
*/
TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
+ texUnit->Combine.SourceRGB[0],
+ texUnit->Combine.OperandRGB[0],
incomingRGB, incomingAlpha);
TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
+ texUnit->Combine.OperandRGB[0]);
B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
Bmode_RGB = GR_FUNC_MODE_ZERO;
Cinv_RGB = FXTRUE;
@@ -452,19 +452,19 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* (Arg0 + 0(0)) * Arg1 + 0(0)
*/
TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
+ texUnit->Combine.SourceRGB[0],
+ texUnit->Combine.OperandRGB[0],
incomingRGB, incomingAlpha);
TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
+ texUnit->Combine.OperandRGB[0]);
B_RGB = GR_CMBX_ZERO;
Bmode_RGB = GR_CMBX_ZERO;
TEXENV_SETUP_ARG_RGB(C_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
+ texUnit->Combine.SourceRGB[1],
+ texUnit->Combine.OperandRGB[1],
incomingRGB, incomingAlpha);
Cinv_RGB = TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1]);
+ (texUnit->Combine.OperandRGB[1]);
D_RGB = GR_CMBX_ZERO;
Dinv_RGB = Ginv_RGB = FXFALSE;
break;
@@ -473,17 +473,17 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* The formula is Arg0 + Arg1
*/
TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
+ texUnit->Combine.SourceRGB[0],
+ texUnit->Combine.OperandRGB[0],
incomingRGB, incomingAlpha);
TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
+ texUnit->Combine.OperandRGB[0]);
TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
+ texUnit->Combine.SourceRGB[1],
+ texUnit->Combine.OperandRGB[1],
incomingRGB, incomingAlpha);
TEXENV_SETUP_MODE_RGB(Bmode_RGB,
- texUnit->CombineOperandRGB[1]);
+ texUnit->Combine.OperandRGB[1]);
C_RGB = D_RGB = GR_CMBX_ZERO;
Cinv_RGB = FXTRUE;
Dinv_RGB = Ginv_RGB = FXFALSE;
@@ -498,20 +498,20 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* we cannot implement the formula properly.
*/
TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
+ texUnit->Combine.SourceRGB[0],
+ texUnit->Combine.OperandRGB[0],
incomingRGB, incomingAlpha);
TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
+ texUnit->Combine.SourceRGB[1],
+ texUnit->Combine.OperandRGB[1],
incomingRGB, incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) {
+ if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[0])) {
/*
* A is not inverted. So, choose it.
*/
Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1])) {
+ (texUnit->Combine.OperandRGB[1])) {
Bmode_RGB = GR_FUNC_MODE_X;
}
else {
@@ -525,7 +525,7 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
*/
Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandRGB[1])) {
+ (texUnit->Combine.OperandRGB[1])) {
Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
}
else {
@@ -553,16 +553,16 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* not support it properly.
*/
TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->CombineSourceRGB[0],
- texUnit->CombineOperandRGB[0],
+ texUnit->Combine.SourceRGB[0],
+ texUnit->Combine.OperandRGB[0],
incomingRGB, incomingAlpha);
TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->CombineOperandRGB[0]);
+ texUnit->Combine.OperandRGB[0]);
TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->CombineSourceRGB[1],
- texUnit->CombineOperandRGB[1],
+ texUnit->Combine.SourceRGB[1],
+ texUnit->Combine.OperandRGB[1],
incomingRGB, incomingAlpha);
- if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) {
+ if (TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[1])) {
/*
* This case is wrong.
*/
@@ -577,8 +577,8 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* specify some kind of alpha value.
*/
TEXENV_SETUP_ARG_A(C_RGB,
- texUnit->CombineSourceRGB[2],
- texUnit->CombineOperandRGB[2],
+ texUnit->Combine.SourceRGB[2],
+ texUnit->Combine.OperandRGB[2],
incomingAlpha);
Cinv_RGB = FXFALSE;
D_RGB = GR_CMBX_B;
@@ -599,7 +599,7 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
/*
* Calculate the alpha combination.
*/
- switch (texUnit->CombineModeA) {
+ switch (texUnit->Combine.ModeA) {
case GL_REPLACE:
/*
* The formula is: Arg0
@@ -607,11 +607,11 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* (Arg0 + 0(0))*(1-0) + 0
*/
TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
+ texUnit->Combine.SourceA[0],
+ texUnit->Combine.OperandA[0],
incomingAlpha);
TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
+ texUnit->Combine.OperandA[0]);
B_A = GR_CMBX_ITALPHA;
Bmode_A = GR_FUNC_MODE_ZERO;
C_A = D_A = GR_CMBX_ZERO;
@@ -626,19 +626,19 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* (Arg0 + 0(0)) * Arg1 + 0(0)
*/
TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
+ texUnit->Combine.SourceA[0],
+ texUnit->Combine.OperandA[0],
incomingAlpha);
TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
+ texUnit->Combine.OperandA[0]);
B_A = GR_CMBX_ZERO;
Bmode_A = GR_CMBX_ZERO;
TEXENV_SETUP_ARG_A(C_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
+ texUnit->Combine.SourceA[1],
+ texUnit->Combine.OperandA[1],
incomingAlpha);
Cinv_A = TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1]);
+ (texUnit->Combine.OperandA[1]);
D_A = GR_CMBX_ZERO;
Dinv_A = Ginv_A = FXFALSE;
break;
@@ -647,17 +647,17 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* The formula is Arg0 + Arg1
*/
TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
+ texUnit->Combine.SourceA[0],
+ texUnit->Combine.OperandA[0],
incomingAlpha);
TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
+ texUnit->Combine.OperandA[0]);
TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
+ texUnit->Combine.SourceA[1],
+ texUnit->Combine.OperandA[1],
incomingAlpha);
TEXENV_SETUP_MODE_A(Bmode_A,
- texUnit->CombineOperandA[1]);
+ texUnit->Combine.OperandA[1]);
C_A = D_A = GR_CMBX_ZERO;
Cinv_A = FXTRUE;
Dinv_A = Ginv_A = FXFALSE;
@@ -672,20 +672,20 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* we cannot implement the formula properly.
*/
TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
+ texUnit->Combine.SourceA[0],
+ texUnit->Combine.OperandA[0],
incomingAlpha);
TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
+ texUnit->Combine.SourceA[1],
+ texUnit->Combine.OperandA[1],
incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) {
+ if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandA[0])) {
/*
* A is not inverted. So, choose it.
*/
Amode_A = GR_FUNC_MODE_X_MINUS_HALF;
if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1])) {
+ (texUnit->Combine.OperandA[1])) {
Bmode_A = GR_FUNC_MODE_X;
} else {
Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
@@ -697,7 +697,7 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
*/
Amode_A = GR_FUNC_MODE_ONE_MINUS_X;
if (!TEXENV_OPERAND_INVERTED
- (texUnit->CombineOperandA[1])) {
+ (texUnit->Combine.OperandA[1])) {
Bmode_A = GR_FUNC_MODE_X_MINUS_HALF;
} else {
/*
@@ -724,16 +724,16 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* not support it properly.
*/
TEXENV_SETUP_ARG_A(A_A,
- texUnit->CombineSourceA[0],
- texUnit->CombineOperandA[0],
+ texUnit->Combine.SourceA[0],
+ texUnit->Combine.OperandA[0],
incomingAlpha);
TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->CombineOperandA[0]);
+ texUnit->Combine.OperandA[0]);
TEXENV_SETUP_ARG_A(B_A,
- texUnit->CombineSourceA[1],
- texUnit->CombineOperandA[1],
+ texUnit->Combine.SourceA[1],
+ texUnit->Combine.OperandA[1],
incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) {
+ if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandA[1])) {
Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
}
else {
@@ -748,8 +748,8 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
* specify some kind of alpha value.
*/
TEXENV_SETUP_ARG_A(C_A,
- texUnit->CombineSourceA[2],
- texUnit->CombineOperandA[2],
+ texUnit->Combine.SourceA[2],
+ texUnit->Combine.OperandA[2],
incomingAlpha);
Cinv_A = FXFALSE;
D_A = GR_CMBX_B;