From 0ee5f6203c125898fdffbec8d5eea9269aa1559e Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Tue, 23 Dec 2003 14:11:22 +0000 Subject: reverted TMUs for proper multitexturing --- src/mesa/drivers/glide/fxsetup.c | 48 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/glide/fxsetup.c') diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 9738d6ea60..c00bd83f78 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -868,8 +868,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) struct tdfx_texcombine tex0, tex1; GrCombineLocal_t localc, locala; 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 envmode, ifmt, unitsmode; int tmu0 = 0, tmu1 = 1; @@ -973,7 +973,7 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) break; } case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */ - if (tmu1 == FX_TMU1) { + if (tmu0 == FX_TMU1) { tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; @@ -1087,6 +1087,48 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx) alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; break; } + + case (FX_UM_E0_REPLACE | FX_UM_E1_ADD): /* Vulpine Sky */ + { + GLboolean isalpha[FX_NUM_TMU]; + + isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA); + isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA); + + if (isalpha[FX_TMU1]) { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + tex1.InvertRGB = FXTRUE; + } else { + tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorRGB = GR_COMBINE_FACTOR_NONE; + tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE; + } + + if (isalpha[FX_TMU0]) { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; + } else { + tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorRGB = GR_COMBINE_FACTOR_ONE; + tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE; + } + + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + break; + } default: fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: Unexpected dual texture mode encountered\n"); return; -- cgit v1.2.3