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;
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;
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;
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!!!
*/
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));
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));
{
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;