summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/glide/fxsetup.h
diff options
context:
space:
mode:
authorDaniel Borca <[email protected]>2003-12-23 14:11:22 +0000
committerDaniel Borca <[email protected]>2003-12-23 14:11:22 +0000
commit0ee5f6203c125898fdffbec8d5eea9269aa1559e (patch)
tree7120d157cec96a80d4515a79f3c2c83675a23806 /src/mesa/drivers/glide/fxsetup.h
parentfabb9734ddd1a9b43e7835190f2f4828add2db3c (diff)
reverted TMUs for proper multitexturing
Diffstat (limited to 'src/mesa/drivers/glide/fxsetup.h')
-rw-r--r--src/mesa/drivers/glide/fxsetup.h123
1 files changed, 121 insertions, 2 deletions
diff --git a/src/mesa/drivers/glide/fxsetup.h b/src/mesa/drivers/glide/fxsetup.h
index f4435bf0de5..d1c8d9dc05d 100644
--- a/src/mesa/drivers/glide/fxsetup.h
+++ b/src/mesa/drivers/glide/fxsetup.h
@@ -379,6 +379,29 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
break;
/* COMBINE_EXT */
case GL_COMBINE_EXT:
+#if 0/*666*/
+{
+ fprintf(stderr, "Texture Unit %d\n", textureset);
+ fprintf(stderr, " GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode));
+ fprintf(stderr, " GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB));
+ fprintf(stderr, " GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeA));
+ fprintf(stderr, " GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[0]));
+ fprintf(stderr, " GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[1]));
+ fprintf(stderr, " GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[2]));
+ fprintf(stderr, " GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[0]));
+ fprintf(stderr, " GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[1]));
+ fprintf(stderr, " GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[2]));
+ fprintf(stderr, " GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[0]));
+ fprintf(stderr, " GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[1]));
+ fprintf(stderr, " GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[2]));
+ fprintf(stderr, " GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[0]));
+ fprintf(stderr, " GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[1]));
+ fprintf(stderr, " GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[2]));
+ fprintf(stderr, " GL_RGB_SCALE = %d\n", 1 << texUnit->CombineScaleShiftRGB);
+ fprintf(stderr, " GL_ALPHA_SCALE = %d\n", 1 << texUnit->CombineScaleShiftA);
+ fprintf(stderr, " GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", envColor[0], envColor[1], envColor[2], envColor[3]);
+}
+#endif
/* [dBorca] Hack alert:
* INCOMPLETE!!!
*/
@@ -410,6 +433,70 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
texUnit->CombineOperandRGB[1]);
colorComb.SourceD = GR_CMBX_ZERO;
break;
+ case GL_REPLACE:
+ /* Arg0 == (A + 0) * 1 + 0 */
+ TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ localc, locala);
+ TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
+ texUnit->CombineOperandRGB[0]);
+ colorComb.SourceB = GR_CMBX_ZERO;
+ colorComb.ModeB = GR_FUNC_MODE_ZERO;
+ colorComb.SourceC = GR_CMBX_ZERO;
+ colorComb.InvertC = FXTRUE;
+ colorComb.SourceD = GR_CMBX_ZERO;
+ break;
+ case GL_ADD:
+ /* Arg0 + Arg1 = (A + B) * 1 + 0 */
+ TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ localc, locala);
+ TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
+ texUnit->CombineOperandRGB[0]);
+ TEXENV_SETUP_ARG_RGB(colorComb.SourceB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ localc, locala);
+ TEXENV_SETUP_MODE_RGB(colorComb.ModeB,
+ texUnit->CombineOperandRGB[1]);
+ colorComb.SourceC = GR_CMBX_ZERO;
+ colorComb.InvertC = FXTRUE;
+ colorComb.SourceD = GR_CMBX_ZERO;
+ break;
+ case GL_INTERPOLATE_EXT:
+ /* Arg0 * Arg2 + Arg1 * (1 - Arg2) ==
+ * (Arg0 - Arg1) * Arg2 + Arg1 == (A - B) * C + D
+ */
+ TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ localc, locala);
+ TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
+ texUnit->CombineOperandRGB[0]);
+ TEXENV_SETUP_ARG_RGB(colorComb.SourceB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ localc, locala);
+ if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) {
+ /* Hack alert!!! This case is wrong!!! */
+ fprintf(stderr, "COMBINE_EXT_color: WRONG!!!\n");
+ colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
+ } else {
+ colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
+ }
+ /*
+ * The Source/Operand for the C value must
+ * specify some kind of alpha value.
+ */
+ TEXENV_SETUP_ARG_A(colorComb.SourceC,
+ texUnit->CombineSourceRGB[2],
+ texUnit->CombineOperandRGB[2],
+ locala);
+ colorComb.InvertC = FXFALSE;
+ colorComb.SourceD = GR_CMBX_B;
+ break;
default:
fprintf(stderr, "COMBINE_EXT_color: %s\n",
_mesa_lookup_enum_by_nr(texUnit->CombineModeRGB));
@@ -434,6 +521,38 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
texUnit->CombineOperandA[1]);
alphaComb.SourceD = GR_CMBX_ZERO;
break;
+ case GL_REPLACE:
+ /* Arg0 == (A + 0) * 1 + 0 */
+ TEXENV_SETUP_ARG_A(alphaComb.SourceA,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ locala);
+ TEXENV_SETUP_MODE_A(alphaComb.ModeA,
+ texUnit->CombineOperandA[0]);
+ alphaComb.SourceB = GR_CMBX_ZERO;
+ alphaComb.ModeB = GR_FUNC_MODE_ZERO;
+ alphaComb.SourceC = GR_CMBX_ZERO;
+ alphaComb.InvertC = FXTRUE;
+ alphaComb.SourceD = GR_CMBX_ZERO;
+ break;
+ case GL_ADD:
+ /* Arg0 + Arg1 = (A + B) * 1 + 0 */
+ TEXENV_SETUP_ARG_A(alphaComb.SourceA,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ locala);
+ TEXENV_SETUP_MODE_A(alphaComb.ModeA,
+ texUnit->CombineOperandA[0]);
+ TEXENV_SETUP_ARG_A(alphaComb.SourceB,
+ texUnit->CombineSourceA[1],
+ texUnit->CombineOperandA[1],
+ locala);
+ TEXENV_SETUP_MODE_A(alphaComb.ModeB,
+ texUnit->CombineOperandA[1]);
+ alphaComb.SourceC = GR_CMBX_ZERO;
+ alphaComb.InvertC = FXTRUE;
+ alphaComb.SourceD = GR_CMBX_ZERO;
+ break;
default:
fprintf(stderr, "COMBINE_EXT_alpha: %s\n",
_mesa_lookup_enum_by_nr(texUnit->CombineModeA));
@@ -1037,8 +1156,8 @@ fxSetupTextureDoubleTMUNapalm_NoLock(GLcontext * ctx)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti0, *ti1;
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D;
+ struct gl_texture_object *tObj0 = ctx->Texture.Unit[1].Current2D;
+ struct gl_texture_object *tObj1 = ctx->Texture.Unit[0].Current2D;
GLuint unitsmode;
int tmu0 = 0, tmu1 = 1;