summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-10-02 01:23:46 +0000
committerIan Romanick <[email protected]>2004-10-02 01:23:46 +0000
commit5b73371e05e48d1b835579b8db81b12df203ce67 (patch)
tree01e2afb1681134c2ca6858898fffe7764ebe0fc4
parent7ff3c9e4fc46e8fe2efc7ce2fe53255777f7b858 (diff)
Cut out all of the old texture environment code and rewrote it from
scratch. There were just too many cut-and-paste errors in the code, and it was too hard to follow. This fixes Mesa bugzilla #1508. #1509 is probably also fixed, but I'd like to do some more testing before I close that particular bug. Additionally, this cuts almost 4,600 lines of code from the driver.
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c4763
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texcombine.c382
4 files changed, 390 insertions, 4759 deletions
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index 1d43e5d8b90..baf1fe47b7e 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -30,6 +30,7 @@ DRIVER_SOURCES = \
via_texstate.c \
via_tris.c \
via_vb.c \
+ via_texcombine.c \
xf86drmVIA.c
C_SOURCES = \
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 4ac3a8cfa6e..5efd9a02260 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -451,6 +451,9 @@ extern void viaXMesaSetFrontClipRects(viaContextPtr vmesa);
extern void viaReAllocateBuffers(GLframebuffer *drawbuffer);
extern void viaXMesaWindowMoved(viaContextPtr vmesa);
+extern void viaTexCombineState(viaContextPtr vmesa,
+ const struct gl_tex_env_combine_state * combine, unsigned unit );
+
#define SUBPIXEL_X -.5
#define SUBPIXEL_Y -.5
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index bc7b713001d..f5b97de52c7 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -46,7 +46,6 @@
#include "tnl/t_pipeline.h"
-/*#define EXPERIMENTAL_COMBINE_MODE*/
static GLuint ROP[16] = {
HC_HROP_BLACK, /* GL_CLEAR 0 */
@@ -547,38 +546,13 @@ get_wrap_mode( GLenum sWrap, GLenum tWrap )
}
-/**
- * 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
@@ -609,7 +583,7 @@ void viaChooseTextureState(GLcontext *ctx)
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
@@ -670,2318 +644,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 */
@@ -2990,7 +653,6 @@ void viaChooseTextureState(GLcontext *ctx)
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);
@@ -3045,2424 +707,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
diff --git a/src/mesa/drivers/dri/unichrome/via_texcombine.c b/src/mesa/drivers/dri/unichrome/via_texcombine.c
new file mode 100644
index 00000000000..9559cb30cb5
--- /dev/null
+++ b/src/mesa/drivers/dri/unichrome/via_texcombine.c
@@ -0,0 +1,382 @@
+/*
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Ian Romanick <[email protected]>
+ */
+
+#include <stdio.h>
+
+#include "glheader.h"
+#include "context.h"
+#include "macros.h"
+#include "colormac.h"
+#include "enums.h"
+#include "dd.h"
+
+#include "mm.h"
+#include "via_context.h"
+#include "via_state.h"
+#include "via_tex.h"
+#include "via_vb.h"
+#include "via_tris.h"
+#include "via_ioctl.h"
+
+#include "swrast/swrast.h"
+#include "array_cache/acache.h"
+#include "tnl/tnl.h"
+#include "swrast_setup/swrast_setup.h"
+
+#include "tnl/t_pipeline.h"
+
+#define VIA_USE_ALPHA (HC_XTC_Adif - HC_XTC_Dif)
+
+#define INPUT_A_SHIFT 14
+#define INPUT_B_SHIFT 7
+#define INPUT_C_SHIFT 0
+#define INPUT_BiasC_SHIFT 14
+#define INPUT_BiasA_SHIFT 3
+
+#define CONST_ONE (HC_XTC_0 | HC_XTC_InvTOPC)
+
+static const unsigned color_operand_modifier[4] = {
+ 0,
+ HC_XTC_InvTOPC,
+ VIA_USE_ALPHA,
+ VIA_USE_ALPHA | HC_XTC_InvTOPC,
+};
+
+static const unsigned alpha_operand_modifier[2] = {
+ 0, HC_XTA_InvTOPA
+};
+
+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
+};
+
+
+/**
+ * Calculate the hardware state for the specified texture combine mode
+ *
+ * \bug
+ * For the alpha combine, \c GL_CONSTANT is still probably wrong.
+ *
+ * \bug
+ * All forms of DOT3 bumpmapping are completely untested, and are most
+ * likely wrong.
+ *
+ * \bug
+ * This code still fails progs/demos/texenv for all modes with \c GL_ALPHA
+ * textures. This was also the case with the code that Via supplied. It
+ * also fails for \c GL_REPLACE with \c GL_RGBA textures. Everything else
+ * that texenv tests looks good.
+ */
+void
+viaTexCombineState( viaContextPtr vmesa,
+ const struct gl_tex_env_combine_state * combine,
+ unsigned unit )
+{
+ unsigned color_arg[3];
+ unsigned alpha_arg[3];
+ unsigned color = 0;
+ unsigned alpha = 0;
+ unsigned bias = 0;
+ unsigned op = 0;
+ unsigned a_shift = combine->ScaleShiftRGB;
+ unsigned c_shift = combine->ScaleShiftA;
+ unsigned i;
+ unsigned constant_color[3];
+ unsigned ordered_constant_color[4];
+ unsigned constant_alpha = 0;
+ unsigned bias_alpha = 0;
+ const struct gl_texture_unit const * texUnit = & vmesa->glCtx->Texture.Unit[unit];
+ unsigned env_color[4];
+
+
+ CLAMPED_FLOAT_TO_UBYTE(env_color[0], texUnit->EnvColor[0]);
+ CLAMPED_FLOAT_TO_UBYTE(env_color[1], texUnit->EnvColor[1]);
+ CLAMPED_FLOAT_TO_UBYTE(env_color[2], texUnit->EnvColor[2]);
+ CLAMPED_FLOAT_TO_UBYTE(env_color[3], texUnit->EnvColor[3]);
+
+ (void) memset( constant_color, 0, sizeof( constant_color ) );
+ (void) memset( ordered_constant_color, 0, sizeof( ordered_constant_color ) );
+
+ for ( i = 0 ; i < combine->_NumArgsRGB ; i++ ) {
+ const GLint op = combine->OperandRGB[i] - GL_SRC_COLOR;
+
+ switch ( combine->SourceRGB[i] ) {
+ case GL_TEXTURE:
+ color_arg[i] = HC_XTC_Tex;
+ color_arg[i] += color_operand_modifier[op];
+ break;
+ case GL_CONSTANT:
+ color_arg[i] = HC_XTC_HTXnTBLRC;
+
+ switch( op ) {
+ case 0:
+ constant_color[i] = ((env_color[0] << 16)
+ | (env_color[1] << 8)
+ | env_color[2]);
+ break;
+ case 1:
+ constant_color[i] = ~((env_color[0] << 16)
+ | (env_color[1] << 8)
+ | env_color[2]) & 0x00ffffff;
+ break;
+ case 2:
+ constant_color[i] = ((env_color[3] << 16)
+ | (env_color[3] << 8)
+ | env_color[3]);
+ break;
+ case 3:
+ constant_color[i] = ~((env_color[3] << 16)
+ | (env_color[3] << 8)
+ | env_color[3]) & 0x00ffffff;
+ break;
+ }
+ break;
+ case GL_PRIMARY_COLOR:
+ color_arg[i] = HC_XTC_Dif;
+ color_arg[i] += color_operand_modifier[op];
+ break;
+ case GL_PREVIOUS:
+ color_arg[i] = (unit == 0) ? HC_XTC_Dif : HC_XTC_Cur;
+ color_arg[i] += color_operand_modifier[op];
+ break;
+ }
+ }
+
+ for ( i = 0 ; i < combine->_NumArgsA ; i++ ) {
+ const GLint op = combine->OperandA[i] - GL_SRC_ALPHA;
+
+ switch ( combine->SourceA[i] ) {
+ case GL_TEXTURE:
+ alpha_arg[i] = HC_XTA_Atex;
+ alpha_arg[i] += alpha_operand_modifier[op];
+ break;
+ case GL_CONSTANT:
+ alpha_arg[i] = HC_XTA_HTXnTBLRA;
+ constant_alpha = (op == 0)
+ ? env_color[3] : ~(env_color[3]) & 0x000000ff;
+ break;
+ case GL_PRIMARY_COLOR:
+ alpha_arg[i] = HC_XTA_Adif;
+ alpha_arg[i] += alpha_operand_modifier[op];
+ break;
+ case GL_PREVIOUS:
+ alpha_arg[i] = (unit == 0) ? HC_XTA_Adif : HC_XTA_Acur;
+ alpha_arg[i] += alpha_operand_modifier[op];
+ break;
+ }
+ }
+
+
+ /* On the Unichrome, all combine operations take on some form of:
+ *
+ * A * (B op Bias) + C
+ *
+ * 'op' can be selected as add, subtract, min, max, or mask. The min, max
+ * and mask modes are currently unused. With the exception of DOT3, all
+ * standard GL_COMBINE modes can be implemented simply by selecting the
+ * correct inputs for A, B, C, and Bias and the correct operation for op.
+ */
+
+ color = HC_HTXnTBLCsat_MASK;
+ alpha = HC_HTXnTBLAsat_MASK;
+
+ switch( combine->ModeRGB ) {
+ /* A = 0, B = 0, C = arg0, Bias = 0
+ */
+ case GL_REPLACE:
+ bias |= (color_arg[0] << INPUT_BiasC_SHIFT);
+ ordered_constant_color[3] = constant_color[0];
+ break;
+
+ /* A = arg[0], B = arg[1], C = 0, Bias = 0
+ */
+ case GL_MODULATE:
+ color |= (color_arg[0] << INPUT_A_SHIFT)
+ | (color_arg[1] << INPUT_B_SHIFT);
+
+ ordered_constant_color[0] = constant_color[0];
+ ordered_constant_color[1] = constant_color[1];
+ break;
+
+ /* A = 1.0, B = arg[0], C = 0, Bias = arg[1]
+ */
+ case GL_ADD:
+ case GL_SUBTRACT:
+ if ( combine->ModeRGB == GL_SUBTRACT ) {
+ op |= HC_HTXnTBLCop_Sub;
+ }
+
+ color |= (color_arg[0] << INPUT_B_SHIFT)
+ | (CONST_ONE << INPUT_A_SHIFT);
+
+ bias |= (color_arg[1] << INPUT_BiasC_SHIFT);
+ ordered_constant_color[1] = constant_color[0];
+ ordered_constant_color[3] = constant_color[1];
+ break;
+
+ /* A = 0, B = arg[0], C = arg[1], Bias = 0.5
+ */
+ case GL_ADD_SIGNED:
+ color |= (color_arg[0] << INPUT_B_SHIFT)
+ | (color_arg[1] << INPUT_C_SHIFT);
+ bias |= HC_HTXnTBLCbias_HTXnTBLRC;
+ op |= HC_HTXnTBLCop_Sub;
+
+ ordered_constant_color[1] = constant_color[0];
+ ordered_constant_color[2] = constant_color[1];
+ ordered_constant_color[3] = 0x00808080;
+ break;
+
+ /* A = arg[2], B = arg[0], C = arg[1], Bias = arg[1]
+ */
+ case GL_INTERPOLATE:
+ op |= HC_HTXnTBLCop_Sub;
+
+ color |= (color_arg[2] << INPUT_A_SHIFT) |
+ (color_arg[0] << INPUT_B_SHIFT) |
+ (color_arg[1] << INPUT_C_SHIFT);
+ bias |= (color_arg[1] << INPUT_BiasC_SHIFT);
+
+ ordered_constant_color[0] = constant_color[2];
+ ordered_constant_color[1] = constant_color[0];
+ ordered_constant_color[2] = constant_color[1];
+ ordered_constant_color[3] = constant_color[1];
+ break;
+
+ /* At this point this code is completely untested. It appears that the
+ * Unichrome has the same limitation as the Radeon R100. The only
+ * supported post-scale when doing DOT3 bumpmapping is 1x.
+ */
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ c_shift = 2;
+ a_shift = 2;
+ color |= (color_arg[0] << INPUT_A_SHIFT) |
+ (color_arg[1] << INPUT_B_SHIFT);
+ op |= HC_HTXnTBLDOT4;
+ break;
+ }
+
+
+ /* The alpha blend stage has the annoying quirk of not having a
+ * hard-wired 0 input, like the color stage. As a result, we have
+ * to program the constant register with 0 and use that as our
+ * 0 input.
+ */
+
+ switch( combine->ModeA ) {
+ /* A = 0, B = 0, C = 0, Bias = arg0
+ */
+ case GL_REPLACE:
+ bias |= (alpha_arg[0] << INPUT_BiasA_SHIFT);
+
+ alpha |= (HC_XTA_HTXnTBLRA << INPUT_A_SHIFT) |
+ (HC_XTA_HTXnTBLRA << INPUT_B_SHIFT) |
+ (HC_XTA_HTXnTBLRA << INPUT_C_SHIFT);
+ break;
+
+ /* A = arg[0], B = arg[1], C = 0, Bias = 0
+ */
+ case GL_MODULATE:
+ alpha |= (alpha_arg[1] << INPUT_A_SHIFT)
+ | (alpha_arg[0] << INPUT_B_SHIFT)
+ | (HC_XTA_HTXnTBLRA << INPUT_C_SHIFT);
+
+ bias |= (HC_XTA_HTXnTBLRA << INPUT_BiasA_SHIFT);
+ break;
+
+ /* A = 0, B = arg[0], C = 0, Bias = arg[1]
+ */
+ case GL_ADD:
+ case GL_SUBTRACT:
+ if ( combine->ModeA == GL_SUBTRACT ) {
+ op |= HC_HTXnTBLAop_Sub;
+ }
+
+ alpha |= (HC_XTA_HTXnTBLRA << INPUT_A_SHIFT) |
+ (alpha_arg[0] << INPUT_B_SHIFT) |
+ (HC_XTA_HTXnTBLRA << INPUT_C_SHIFT);
+ bias |= (alpha_arg[1] << INPUT_BiasA_SHIFT);
+ break;
+
+ /* A = 0, B = arg[0], C = arg[1], Bias = 0.5
+ */
+ case GL_ADD_SIGNED:
+ op |= HC_HTXnTBLAop_Sub;
+
+ alpha |= (alpha_arg[0] << INPUT_B_SHIFT)
+ | (alpha_arg[1] << INPUT_C_SHIFT);
+ bias |= (HC_XTA_HTXnTBLRA << INPUT_BiasA_SHIFT);
+
+ bias_alpha = 0x00000080;
+ break;
+
+ /* A = arg[2], B = arg[0], C = arg[1], Bias = arg[1]
+ */
+ case GL_INTERPOLATE:
+ op |= HC_HTXnTBLAop_Sub;
+
+ alpha |= (alpha_arg[2] << INPUT_A_SHIFT) |
+ (alpha_arg[0] << INPUT_B_SHIFT) |
+ (alpha_arg[1] << INPUT_C_SHIFT);
+ bias |= (alpha_arg[1] << INPUT_BiasA_SHIFT);
+ break;
+ }
+
+
+ op |= c_shift_table[ c_shift ] | a_shift_table[ a_shift ];
+
+
+ if ( unit == 0 ) {
+ vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
+
+ vmesa->regHTXnTBLCsat_0 = color;
+ vmesa->regHTXnTBLAsat_0 = alpha;
+ vmesa->regHTXnTBLCop_0 = op | bias;
+ vmesa->regHTXnTBLRAa_0 = bias_alpha | (constant_alpha << 16);
+
+ vmesa->regHTXnTBLRCa_0 = ordered_constant_color[0];
+ vmesa->regHTXnTBLRCb_0 = ordered_constant_color[1];
+ vmesa->regHTXnTBLRCc_0 = ordered_constant_color[2];
+ vmesa->regHTXnTBLRCbias_0 = ordered_constant_color[3];
+ }
+ else {
+ vmesa->regHTXnTBLMPfog_1 = HC_HTXnTBLMPfog_Fog;
+
+ vmesa->regHTXnTBLCsat_1 = color;
+ vmesa->regHTXnTBLAsat_1 = alpha;
+ vmesa->regHTXnTBLCop_1 = op | bias;
+ vmesa->regHTXnTBLRAa_1 = bias_alpha | (constant_alpha << 16);
+ }
+}
+