#include "tnl/t_pipeline.h"
-/*#define EXPERIMENTAL_COMBINE_MODE*/
static GLuint ROP[16] = {
HC_HROP_BLACK, /* GL_CLEAR 0 */
}
-/**
- * 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);
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1];
/*=* John Sheng [2003.7.18] texture combine *=*/
- GLboolean AlphaCombine[3];
+
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#endif
if (texUnit0->_ReallyEnabled) {
struct gl_texture_object *texObj = texUnit0->_Current;
struct gl_texture_image *texImage = texObj->Image[0][0];
- GLint r, g, b, a;
+
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "texUnit0->_ReallyEnabled\n");
#endif
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:
- /* C = Cf, A = At*Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt*Cf, A = Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt*Cf, A = At*Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It*Cf, A = It*Af
- * RGB part.
- * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct*Cf, A = Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_MODULATE: GL_RGB\n");
-#endif
- break;
- case GL_RGBA:
- /* C = Ct*Cf, A = At*Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias
- | HC_HTXnTBLAshift_No;
-
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_MODULATE: GL_RGBA\n");
-#endif
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = At*Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Adif | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt*Cf, A = Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt*Cf, A = At*Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It*Cf, A = It*Af
- * RGB part.
- * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct*Cf, A = Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct*Cf, A = At*Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Dif | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_DECAL:
- switch (texImage->Format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined.
- */
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_DECAL: GL_RGB\n");
-#endif
- break;
- case GL_RGBA:
- /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf
- * RGB part.
- * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_DECAL: GL_RGBA\n");
-#endif
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined.
- */
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_COLOR_INDEX: GL_RGB\n");
-#endif
- break;
- case GL_RGBA:
- /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf
- * RGB part.
- * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_COLOR_INDEX: GL_RGBA\n");
-#endif
- break;
- }
- break;
- }
- break;
- case GL_BLEND:
- switch (texImage->Format) {
- case GL_ALPHA:
- /* C = Cf, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac
- * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af
- * RGB part.
- * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = (a << 8);
- break;
- case GL_RGB:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_BLEND: GL_RGB\n");
-#endif
- break;
- case GL_RGBA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_BLEND: GL_RGBA\n");
-#endif
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac
- * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af
- * RGB part.
- * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = (a << 8);
- break;
- case GL_RGB:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_REPLACE:
- switch (texImage->Format) {
- case GL_ALPHA:
- /* C = Cf, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It, A = It
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_REPLACE: GL_RGB\n");
-#endif
- break;
- case GL_RGBA:
- /* C = Ct, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
-#ifdef DEBUG
- if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode: GL_REPLACE: GL_RGBA\n");
-#endif
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It, A = It
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- 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 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- }
- break;
- }
- break;
-#else
- default:
-#endif
- /*=* John Sheng [2003.7.18] texture combine *=*/
- case GL_COMBINE:
- switch (texUnit0->_CurrentCombine->ModeRGB) {
- case GL_REPLACE:
- 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->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Tex;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Atex;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Atex;
- break;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- 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->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- break;
- }
- break;
- case GL_PRIMARY_COLOR :
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Dif;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Adif;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Adif;
- break;
- }
- break;
- case GL_PREVIOUS :
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Dif;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Dif;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Adif;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_InvCbias | HC_HTXnTBLCbias_Adif;
- break;
- }
- break;
- }
- break;
-
- case GL_MODULATE: {
- 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_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
-
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCa_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- break;
- }
- case GL_ADD:
- case GL_SUBTRACT :
- if (texUnit0->_CurrentCombine->ModeRGB==GL_ADD) {
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
- }
- else {
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- 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->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_InvTOPC;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_InvTOPC;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCc_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCc_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Adif;
- }
- break;
- }
- break;
- case GL_ADD_SIGNED :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC|
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
- vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCbias_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCbias_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Dif;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Adif;
- }
- break;
- }
- break;
- case GL_INTERPOLATE :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_InvTOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_InvTOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[2]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
- AlphaCombine[2]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[2]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
- AlphaCombine[2]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[2]=1;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Atex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_HTXnTBLRC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCc_0 = (r << 16) | (g << 8) | b;
- vmesa->regHTXnTBLRCbias_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCc_0 = (a << 16) | (a << 8) | a;
- vmesa->regHTXnTBLRCbias_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Adif;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[2]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCa_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- }
- break;
- }
- switch (texUnit0->_CurrentCombine->ModeA) {
- case GL_REPLACE:
- switch (texUnit0->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_Atex;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = a;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = a;
- break;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_Adif;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_MODULATE:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a<<16;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a<<8;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- break;
- case GL_ADD:
- case GL_SUBTRACT :
- if(texUnit0->_CurrentCombine->ModeA==GL_ADD) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub | HC_HTXnTBLAbias_HTXnTBLRAbias;
- }
- vmesa->regHTXnTBLRFog_0 = 0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
- break;
- }
- break;
- case GL_ADD_SIGNED :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- 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->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
- break;
- }
- break;
- case GL_INTERPOLATE :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit0->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_InvTOPA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandA[2]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceA[2]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 16);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
- 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) {
- case GL_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_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Atex |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- /*=* John Sheng [2003.7.18] texenv *=*/
- /*vmesa->regHTXnTBLRAa_0 = 0x0;*/
- vmesa->regHTXnTBLRAa_0 = (255<<16) | (255<<8) | 255;;
- vmesa->regHTXnTBLRFog_0 = 0x0 | 255<<16;
- break;
- case GL_RGB:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch(texObj->Palette.Format) {
- case GL_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_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Atex |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0 | 255<<16;
- break;
- case GL_RGB:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- }
- break;
- }
- break;
- /*=* John Sheng [2003.7.18] texture dot3 *=*/
- case GL_DOT3_RGB :
- case GL_DOT3_RGBA :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLDOT4 | HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_2 | HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit0->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- break;
- }
- switch (texUnit0->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- break;
- }
- switch (texUnit0->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- break;
- }
- break;
- default:
- break;
-#endif
- }
+ viaTexCombineState( vmesa, texUnit0->_CurrentCombine, 0 );
}
else {
/* Should turn Cs off if actually no Cs */
if (texUnit1->_ReallyEnabled) {
struct gl_texture_object *texObj = texUnit1->_Current;
struct gl_texture_image *texImage = texObj->Image[0][0];
- GLint r, g, b, a;
if (texImage->Border) {
FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE);
vmesa->regHTXnMPMD_1 |= get_wrap_mode( texObj->WrapS,
texObj->WrapT );
- switch (texUnit1->EnvMode) {
-#ifndef EXPERIMENTAL_COMBINE_MODE
- case GL_MODULATE:
- switch (texImage->Format) {
- case GL_ALPHA:
- /* C = Cf, A = At*Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Acur | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt*Cf, A = Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt*Cf, A = At*Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It*Cf, A = It*Af
- * RGB part.
- * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct*Cf, A = Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct*Cf, A = At*Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias
- | HC_HTXnTBLAshift_No;
-
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = At*Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_0 | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Acur | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt*Cf, A = Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt*Cf, A = At*Af
- * RGB part.
- * Ca = Lt, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It*Cf, A = It*Af
- * RGB part.
- * Ca = It, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = It, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct*Cf, A = Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct*Cf, A = At*Af
- * RGB part.
- * Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Cur | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_DECAL:
- switch (texImage->Format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined.
- */
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf
- * RGB part.
- * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined.
- */
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = (1-At)*Cf+At*Ct, A = Af --> At*(Ct-Cf)+Cf
- * RGB part.
- * Ca = At, Cb = Ct, Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Atex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Tex |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_BLEND:
- switch (texImage->Format) {
- case GL_ALPHA:
- /* C = Cf, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_INTENSITY:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac
- * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af
- * RGB part.
- * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Acur;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Sub |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = (a << 8);
- break;
- case GL_RGB:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- /* C = (1-Lt)*Cf+Lt*Cc, A = At*Af --> Lt*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Lt, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- case GL_INTENSITY:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-It)*Cf+It*Cc, A = (1-It)*Af+It*Ac
- * --> It*(Cc-Cf)+Cf, It*(Ac-Af)+Af
- * RGB part.
- * Ca = It, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = It, Ab = Ac(Reg), Cop = -, Ac = Af, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Acur;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Sub |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = (a << 8);
- break;
- case GL_RGB:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- /* C = (1-Ct)*Cf+Ct*Cc, A = At*Af --> Ct*(Cc-Cf)+Cf
- * RGB part.
- * Ca = Ct, Cb = Cc(Reg), Cop = -, Cc = Cf, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_HTXnTBLRC |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Cur;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Sub |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCb_1 = (r << 16) | (g << 8) | b;
- /* Alpha part.
- * Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Acur |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- vmesa->regHTXnTBLRFog_1 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_REPLACE:
- switch (texImage->Format) {
- case GL_ALPHA:
- /* C = Cf, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It, A = It
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch (texObj->Palette.Format) {
- case GL_ALPHA:
- /* C = Cf, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Cf, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Cur |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE:
- /* C = Lt, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- /* C = Lt, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Lt, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_INTENSITY:
- /* C = It, A = It
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = It, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = It, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGB:
- /* C = Ct, A = Af
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Acur | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- case GL_RGBA:
- /* C = Ct, A = At
- * RGB part.
- * Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
- */
- vmesa->regHTXnTBLCsat_1 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
- HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLCop_1 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
- /* Alpha part.
- * Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
- */
- vmesa->regHTXnTBLAsat_1 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_1 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_1 = 0x0;
- break;
- }
- break;
- }
- break;
-#else
- default:
-#endif
- /*=* John Sheng [2003.7.18] texture combine *=*/
- case GL_COMBINE:
- switch (texUnit1->_CurrentCombine->ModeRGB) {
- case GL_REPLACE:
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- switch (texUnit1->_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;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- 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->_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;
- 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 (texUnit1->_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;
- case GL_PREVIOUS :
- switch (texUnit1->_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;
- }
- break;
-
- case GL_MODULATE:
- 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_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCa_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- break;
- case GL_ADD:
- case GL_SUBTRACT :
- if (texUnit1->_CurrentCombine->ModeRGB==GL_ADD) {
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
- }
- else {
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub |
- 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->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_InvTOPC;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_InvTOPC;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCc_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCc_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Adif;
- }
- break;
- }
- break;
- case GL_ADD_SIGNED :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC|
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
- vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_HTXnTBLRC;
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLRCbias_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCbias_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[1]==0) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Dif;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Adif;
- }
- break;
- }
- break;
- case GL_INTERPOLATE :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
- AlphaCombine[0]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_InvTOPC;
- AlphaCombine[0]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_InvTOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
- AlphaCombine[1]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_InvTOPC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_InvCbias;
- AlphaCombine[1]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[2]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
- AlphaCombine[2]=0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[2]=0;
- break;
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
- AlphaCombine[2]=1;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_InvTOPC;
- AlphaCombine[2]=1;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCb_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Adif;
- }
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Atex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_HTXnTBLRC;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCc_0 = (r << 16) | (g << 8) | b;
- vmesa->regHTXnTBLRCbias_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCc_0 = (a << 16) | (a << 8) | a;
- vmesa->regHTXnTBLRCbias_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Adif;
- }
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[2]) {
- case GL_TEXTURE:
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Atex;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- }
- else {
- vmesa->regHTXnTBLRCa_0 = (a << 16) | (a << 8) | a;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- if (AlphaCombine[0]==0) {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- }
- else {
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Adif;
- }
- break;
- }
- break;
-
- case GL_DOT3_RGB :
- case GL_DOT3_RGBA :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLDOT4 | HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_2 | HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- break;
- }
- break;
-
- }
- switch (texUnit1->_CurrentCombine->ModeA) {
- case GL_REPLACE:
- switch (texUnit1->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Atex;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_Atex;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- }
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = a;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = a;
- break;
- }
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_Adif;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- }
- break;
- }
- break;
- case GL_MODULATE:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a<<16;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a<<8;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- break;
- case GL_ADD:
- case GL_SUBTRACT :
- if(texUnit1->_CurrentCombine->ModeA==GL_ADD) {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
- }
- else {
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub | HC_HTXnTBLAbias_HTXnTBLRAbias;
- }
- vmesa->regHTXnTBLRFog_0 = 0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
- break;
- }
- break;
- case GL_ADD_SIGNED :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
- break;
- }
- 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->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
- break;
- }
- break;
- case GL_INTERPOLATE :
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit1->_CurrentCombine->OperandA[0]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandA[1]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_InvTOPA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandA[2]) {
- case GL_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 8);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= a;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- vmesa->regHTXnTBLRFog_0 |= a;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceA[2]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 |= (a << 16);
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
- break;
- }
- break;
- case GL_DOT3_RGB :
- case GL_DOT3_RGBA :
- 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) {
- case GL_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_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Atex |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- /*=* John Sheng [2003.7.18] texenv *=*/
- /*vmesa->regHTXnTBLRAa_0 = 0x0;*/
- vmesa->regHTXnTBLRAa_0 = (255<<16) | (255<<8) | 255;;
- vmesa->regHTXnTBLRFog_0 = 0x0 | 255<<16;
- break;
- case GL_RGB:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_COLOR_INDEX:
- switch(texObj->Palette.Format) {
- case GL_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_Dif |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Adif | HC_HTXnTBLAb_TOPA |
- HC_HTXnTBLAb_Atex | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_LUMINANCE:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_LUMINANCE_ALPHA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- case GL_INTENSITY:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Atex |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_Adif;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0 | 255<<16;
- break;
- case GL_RGB:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- break;
- case GL_RGBA:
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC | HC_HTXnTBLCb_TOPC |
- HC_HTXnTBLCb_Tex | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_Dif;
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLRCa_0 = (255<<16) | (255<<8) | 255;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- break;
- }
- break;
- }
- break;
- /*=* John Sheng [2003.7.18] texture dot3 *=*/
- case GL_DOT3_RGB :
- case GL_DOT3_RGBA :
- vmesa->regHTXnTBLCop_0 = HC_HTXnTBLDOT4 | HC_HTXnTBLCop_Add |
- HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
- HC_HTXnTBLCshift_2 | HC_HTXnTBLAop_Add |
- HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
- vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
- HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- vmesa->regHTXnTBLRFog_0 = 0x0;
- vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
- HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
- HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
- HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
- vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->_CurrentCombine->OperandRGB[0]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
- break;
- }
- switch (texUnit1->_CurrentCombine->OperandRGB[1]) {
- case GL_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[0]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_HTXnTBLRC;
- vmesa->regHTXnTBLRCa_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
- break;
- }
- switch (texUnit1->_CurrentCombine->SourceRGB[1]) {
- case GL_TEXTURE:
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
- break;
- case GL_CONSTANT :
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[0], r);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
- CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_HTXnTBLRC;
- vmesa->regHTXnTBLRCb_0 = (r << 16) | (g << 8) | b;
- break;
- case GL_PRIMARY_COLOR :
- case GL_PREVIOUS :
- vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Dif;
- break;
- }
- break;
- default:
- break;
-#endif
- }
+ viaTexCombineState( vmesa, texUnit1->_CurrentCombine, 1 );
}
vmesa->dirty |= VIA_UPLOAD_TEXTURE;