#include "tnl/t_pipeline.h"
+/*#define EXPERIMENTAL_COMBINE_MODE*/
+
static GLuint ROP[16] = {
HC_HROP_BLACK, /* GL_CLEAR 0 */
HC_HROP_DPa, /* GL_AND s & d */
return v;
}
+
+/**
+ * Convert the shift value for the \c GL_COMBINE post-scale to the hardware
+ * bits. It would have been easier if the values used by the hardware matched
+ * the shift counts, but they don't. A simple table look-up does the trick.
+ *
+ * \param c Shift count for RGB (color) post-scale.
+ * \param a Shift count for alpha post-scale.
+ *
+ * \returns Bits for \c HTXnTBLCop to set the scale factor.
+ */
+
+__inline__ unsigned
+get_combine_shift_factor( unsigned c, unsigned a )
+{
+ static const unsigned c_shift_table[3] = {
+ HC_HTXnTBLCshift_No, HC_HTXnTBLCshift_1, HC_HTXnTBLCshift_2
+ };
+ static const unsigned a_shift_table[3] = {
+ HC_HTXnTBLAshift_No, HC_HTXnTBLAshift_1, HC_HTXnTBLAshift_2
+ };
+
+ return c_shift_table[ c ] | a_shift_table[ a ];
+}
+
+
void viaChooseTextureState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
}
#endif
+#ifdef DEBUG
+ if (VIA_DEBUG) {
+ struct gl_texture_object *texObj0 = texUnit0->_Current;
+ struct gl_texture_object *texObj1 = texUnit1->_Current;
+
+ fprintf(stderr, "env mode: 0x%04x / 0x%04x\n", texUnit0->EnvMode, texUnit1->EnvMode);
+
+ if ( (texObj0 != NULL) && (texObj0->Image[0][0] != NULL) )
+ fprintf(stderr, "format 0: 0x%04x\n", texObj0->Image[0][0]->Format);
+
+ if ( (texObj1 != NULL) && (texObj1->Image[0][0] != NULL) )
+ fprintf(stderr, "format 1: 0x%04x\n", texObj1->Image[0][0]->Format);
+ }
+#endif
+
+
if (texUnit0->_ReallyEnabled) {
struct gl_texture_object *texObj = texUnit0->_Current;
struct gl_texture_image *texImage = texObj->Image[0][0];
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode %x\n",texUnit0->EnvMode);
#endif
+
switch (texUnit0->EnvMode) {
+#ifndef EXPERIMENTAL_COMBINE_MODE
case GL_MODULATE:
switch (texImage->Format) {
case GL_ALPHA:
break;
}
break;
+#else
+ default:
+#endif
/*=* John Sheng [2003.7.18] texture combine *=*/
case GL_COMBINE:
- switch (texUnit0->Combine.ModeRGB) {
+ switch (texUnit0->_CurrentCombine->ModeRGB) {
case GL_REPLACE:
- switch (texUnit0->Combine.SourceRGB[0]) {
+ vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+ HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
+ HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
+ HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+
+ vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
+
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Tex;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Atex;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Atex;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
}
break;
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_HTXnTBLRC;
-
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
break;
case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+ case GL_SRC_ALPHA:
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
break;
case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
break;
}
break;
case GL_PRIMARY_COLOR :
- switch (texUnit0->Combine.OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
+ case GL_SRC_COLOR:
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Dif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Adif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Adif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
}
break;
case GL_PREVIOUS :
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Dif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Adif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Adif;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
break;
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
- case GL_MODULATE:
+ case GL_MODULATE: {
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
+ HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- switch (texUnit0->Combine.OperandRGB[0]) {
+ vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+ HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->Combine.OperandRGB[1]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->Combine.SourceRGB[0]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
+ vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
else {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Atex;
}
break;
}
- switch (texUnit0->Combine.SourceRGB[1]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
+ }
case GL_ADD:
case GL_SUBTRACT :
- if (texUnit0->Combine.ModeRGB==GL_ADD) {
+ if (texUnit0->_CurrentCombine->ModeRGB==GL_ADD) {
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
}
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->Combine.OperandRGB[1]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->Combine.SourceRGB[0]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->Combine.SourceRGB[1]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_ADD_SIGNED :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->Combine.OperandRGB[1]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->Combine.SourceRGB[0]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->Combine.SourceRGB[1]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->Combine.OperandRGB[1]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->Combine.OperandRGB[2]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[2]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
AlphaCombine[2]=0;
AlphaCombine[2]=1;
break;
}
- switch (texUnit0->Combine.SourceRGB[0]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->Combine.SourceRGB[1]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch (texUnit0->Combine.SourceRGB[2]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
}
- switch (texUnit0->Combine.ModeA) {
+ switch (texUnit0->_CurrentCombine->ModeA) {
case GL_REPLACE:
- switch (texUnit0->Combine.SourceA[0]) {
+ switch (texUnit0->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_CONSTANT :
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_PRIMARY_COLOR :
case GL_PREVIOUS :
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
}
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_MODULATE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
vmesa->regHTXnTBLRFog_0 = 0x0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit0->Combine.OperandA[1]) {
+ switch (texUnit0->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->Combine.SourceA[0]) {
+ switch (texUnit0->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit0->Combine.SourceA[1]) {
+ switch (texUnit0->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_ADD:
case GL_SUBTRACT :
- if(texUnit0->Combine.ModeA==GL_ADD) {
+ if(texUnit0->_CurrentCombine->ModeA==GL_ADD) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
}
else {
vmesa->regHTXnTBLRFog_0 = 0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->Combine.OperandA[1]) {
+ switch (texUnit0->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
break;
}
- switch (texUnit0->Combine.SourceA[0]) {
+ switch (texUnit0->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->Combine.SourceA[1]) {
+ switch (texUnit0->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_ADD_SIGNED :
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->Combine.OperandA[1]) {
+ switch (texUnit0->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
break;
case GL_ONE_MINUS_SRC_ALPHA:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit0->Combine.SourceA[0]) {
+ switch (texUnit0->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->Combine.SourceA[1]) {
+ switch (texUnit0->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
vmesa->regHTXnTBLRAa_0 = 0x0;
vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit0->Combine.OperandA[0]) {
+ switch (texUnit0->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->Combine.OperandA[1]) {
+ switch (texUnit0->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit0->Combine.OperandA[2]) {
+ switch (texUnit0->_CurrentCombine->OperandA[2]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit0->Combine.SourceA[0]) {
+ switch (texUnit0->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->Combine.SourceA[1]) {
+ switch (texUnit0->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch (texUnit0->Combine.SourceA[2]) {
+ switch (texUnit0->_CurrentCombine->SourceA[2]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit0->Combine.ScaleShiftA) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_DOT3_RGB :
case GL_DOT3_RGBA :
break;
- }
+ }
+
+ vmesa->regHTXnTBLCop_0 |=
+ get_combine_shift_factor(texUnit0->_CurrentCombine->ScaleShiftRGB,
+ texUnit0->_CurrentCombine->ScaleShiftA);
+
break;
+#ifndef EXPERIMENTAL_COMBINE_MODE
/*=* John Sheng [2003.7.18] texture add *=*/
case GL_ADD:
switch(texImage->Format) {
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit0->Combine.OperandRGB[0]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit0->Combine.OperandRGB[1]) {
+ switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit0->Combine.SourceRGB[0]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit0->Combine.SourceRGB[1]) {
+ switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
break;
default:
break;
+#endif
}
}
else {
texObj->WrapT );
switch (texUnit1->EnvMode) {
+#ifndef EXPERIMENTAL_COMBINE_MODE
case GL_MODULATE:
switch (texImage->Format) {
case GL_ALPHA:
break;
}
break;
+#else
+ default:
+#endif
/*=* John Sheng [2003.7.18] texture combine *=*/
case GL_COMBINE:
- switch (texUnit1->Combine.ModeRGB) {
+ switch (texUnit1->_CurrentCombine->ModeRGB) {
case GL_REPLACE:
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PRIMARY_COLOR :
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PREVIOUS :
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_MODULATE:
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_ADD:
case GL_SUBTRACT :
- if (texUnit1->Combine.ModeRGB==GL_ADD) {
+ if (texUnit1->_CurrentCombine->ModeRGB==GL_ADD) {
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
}
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_ADD_SIGNED :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->Combine.OperandRGB[2]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[2]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
AlphaCombine[2]=0;
AlphaCombine[2]=1;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch (texUnit1->Combine.SourceRGB[2]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_2;
- break;
- }
break;
case GL_DOT3_RGB :
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
break;
}
- switch (texUnit1->Combine.ModeA) {
+ switch (texUnit1->_CurrentCombine->ModeA) {
case GL_REPLACE:
- switch (texUnit1->Combine.SourceA[0]) {
+ switch (texUnit1->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_CONSTANT :
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_PRIMARY_COLOR :
case GL_PREVIOUS :
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
}
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_MODULATE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
vmesa->regHTXnTBLRFog_0 = 0x0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit1->Combine.OperandA[1]) {
+ switch (texUnit1->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->Combine.SourceA[0]) {
+ switch (texUnit1->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit1->Combine.SourceA[1]) {
+ switch (texUnit1->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_ADD:
case GL_SUBTRACT :
- if(texUnit1->Combine.ModeA==GL_ADD) {
+ if(texUnit1->_CurrentCombine->ModeA==GL_ADD) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
}
else {
vmesa->regHTXnTBLRFog_0 = 0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->Combine.OperandA[1]) {
+ switch (texUnit1->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
break;
}
- switch (texUnit1->Combine.SourceA[0]) {
+ switch (texUnit1->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->Combine.SourceA[1]) {
+ switch (texUnit1->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_ADD_SIGNED :
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->Combine.OperandA[1]) {
+ switch (texUnit1->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
break;
case GL_ONE_MINUS_SRC_ALPHA:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit1->Combine.SourceA[0]) {
+ switch (texUnit1->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->Combine.SourceA[1]) {
+ switch (texUnit1->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
vmesa->regHTXnTBLRAa_0 = 0x0;
vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit1->Combine.OperandA[0]) {
+ switch (texUnit1->_CurrentCombine->OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->Combine.OperandA[1]) {
+ switch (texUnit1->_CurrentCombine->OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit1->Combine.OperandA[2]) {
+ switch (texUnit1->_CurrentCombine->OperandA[2]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit1->Combine.SourceA[0]) {
+ switch (texUnit1->_CurrentCombine->SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->Combine.SourceA[1]) {
+ switch (texUnit1->_CurrentCombine->SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch (texUnit1->Combine.SourceA[2]) {
+ switch (texUnit1->_CurrentCombine->SourceA[2]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit1->Combine.ScaleShiftA) {
- case 1:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
- break;
- case 2:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_1;
- break;
- case 4:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_2;
- break;
- }
break;
case GL_DOT3_RGB :
case GL_DOT3_RGBA :
break;
}
- break;
+ vmesa->regHTXnTBLCop_1 |=
+ get_combine_shift_factor(texUnit1->_CurrentCombine->ScaleShiftRGB,
+ texUnit1->_CurrentCombine->ScaleShiftA);
+ break;
+#ifndef EXPERIMENTAL_COMBINE_MODE
/*=* John Sheng [2003.7.18] texture add *=*/
case GL_ADD:
switch(texImage->Format) {
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->Combine.OperandRGB[0]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit1->Combine.OperandRGB[1]) {
+ switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit1->Combine.SourceRGB[0]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit1->Combine.SourceRGB[1]) {
+ switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
break;
default:
break;
+#endif
}
}
vmesa->dirty |= VIA_UPLOAD_TEXTURE;
+
+#ifdef DEBUG
+ if (VIA_DEBUG) {
+ fprintf( stderr, "Csat_0 / Cop_0 = 0x%08x / 0x%08x\n",
+ vmesa->regHTXnTBLCsat_0, vmesa->regHTXnTBLCop_0 );
+ fprintf( stderr, "Asat_0 = 0x%08x\n",
+ vmesa->regHTXnTBLAsat_0 );
+ fprintf( stderr, "RCb_0 / RAa_0 = 0x%08x / 0x%08x\n",
+ vmesa->regHTXnTBLRCb_0, vmesa->regHTXnTBLRAa_0 );
+ fprintf( stderr, "RCa_0 / RCc_0 = 0x%08x / 0x%08x\n",
+ vmesa->regHTXnTBLRCa_0, vmesa->regHTXnTBLRCc_0 );
+ fprintf( stderr, "RCbias_0 = 0x%08x\n",
+ vmesa->regHTXnTBLRCbias_0 );
+ }
+#endif
}
else {
if (ctx->Fog.Enabled)