summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/savage/savage_3d_reg.h347
-rw-r--r--src/mesa/drivers/dri/savage/savage_bci.h33
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c124
3 files changed, 74 insertions, 430 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_3d_reg.h b/src/mesa/drivers/dri/savage/savage_3d_reg.h
index d2971c48f58..a96d581adae 100644
--- a/src/mesa/drivers/dri/savage/savage_3d_reg.h
+++ b/src/mesa/drivers/dri/savage/savage_3d_reg.h
@@ -681,351 +681,4 @@ typedef union savage_registers_t {
((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-/*AlphaFunc*/
-#define LCS_A_NEVER 0x0200
-#define LCS_A_LESS 0x0201
-#define LCS_A_EQUAL 0x0202
-#define LCS_A_LEQUAL 0x0203
-#define LCS_A_GREATER 0x0204
-#define LCS_A_NOTEQUAL 0x0205
-#define LCS_A_GEQUAL 0x0206
-#define LCS_A_ALWAYS 0x0207
-/*stencilFunc*/
-#define LCS_S_NEVER 0x0200
-#define LCS_S_LESS 0x0201
-#define LCS_S_EQUAL 0x0202
-#define LCS_S_LEQUAL 0x0203
-#define LCS_S_GREATER 0x0204
-#define LCS_S_NOTEQUAL 0x0205
-#define LCS_S_GEQUAL 0x0206
-#define LCS_S_ALWAYS 0x0207
-/*depthFunc*/
-
-#define LCS_Z_NEVER 0x0200
-#define LCS_Z_LESS 0x0201
-#define LCS_Z_EQUAL 0x0202
-#define LCS_Z_LEQUAL 0x0203
-#define LCS_Z_GREATER 0x0204
-#define LCS_Z_NOTEQUAL 0x0205
-#define LCS_Z_GEQUAL 0x0206
-#define LCS_Z_ALWAYS 0x0207
-#if 0
-#define LCS_UPDATE_LINEWIDTH (0x1<<15)
-#define LCS_LINEWIDTH_MASK (0x7<<12)
-#define LCS_LINEWIDTH_SHIFT 12
-#define LCS_LINEWIDTH_0_5 (0x1<<12)
-#define LCS_LINEWIDTH_1_0 (0x2<<12)
-#define LCS_LINEWIDTH_2_0 (0x4<<12)
-#define LCS_LINEWIDTH_3_0 (0x6<<12)
-#define LCS_UPDATE_ALPHA_INTERP (0x1<<11)
-#define LCS_ALPHA_FLAT (0x1<<10)
-#define LCS_ALPHA_INTERP (0x0<<10)
-#define LCS_UPDATE_FOG_INTERP (0x1<<9)
-#define LCS_FOG_INTERP (0x0<<8)
-#define LCS_FOG_FLAT (0x1<<8)
-#define LCS_UPDATE_SPEC_INTERP (0x1<<7)
-#define LCS_SPEC_INTERP (0x0<<6)
-#define LCS_SPEC_FLAT (0x1<<6)
-#define LCS_UPDATE_RGB_INTERP (0x1<<5)
-#define LCS_RGB_INTERP (0x0<<4)
-#define LCS_RGB_FLAT (0x1<<4)
-#define LCS_UPDATE_CULL_MODE (0x1<<3)
-#define LCS_CULL_MASK (0x7<<0)
-#define LCS_CULL_DISABLE (0x1<<0)
-#define LCS_CULL_CW (0x2<<0)
-#define LCS_CULL_CCW (0x3<<0)
-#define LCS_CULL_BOTH (0x4<<0)
-
-#define LCS_INTERP_FLAT (LCS_ALPHA_FLAT|LCS_RGB_FLAT|LCS_SPEC_FLAT)
-#define LCS_UPDATE_INTERP (LCS_UPDATE_ALPHA_INTERP| \
- LCS_UPDATE_RGB_INTERP| \
- LCS_UPDATE_SPEC_INTERP)
-
-#endif
-
-/*#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24))*/
-#define PR_TRIANGLES (0x0<<18)
-/*#define PR_TRISTRIP_0 (0x1<<18)*/
-/*#define PR_TRISTRIP_1 (0x2<<18)*/
-/*#define PR_TRIFAN (0x3<<18)*/
-#define PR_POLYGON (0x4<<18)
-#define PR_LINES (0x5<<18)
-/*#define PR_LINESTRIP (0x6<<18)*/
-/*#define PR_RECTS (0x7<<18)*/
-
-/* GFXRENDERSTATE_MAP_COORD_SETS, p116
- */
-#define GFX_OP_MAP_COORD_SETS ((0x3<<29)|(0x1c<<24)|(0x1<<19))
-#define MCS_COORD_ID_SHIFT 16
-#define MCS_COORD_0 (0<<16)
-#define MCS_COORD_1 (1<<16)
-#define MCS_UPDATE_NORMALIZED (1<<15)
-#define MCS_NORMALIZED_COORDS_MASK (1<<14)
-#define MCS_NORMALIZED_COORDS (1<<14)
-#define MCS_UPDATE_V_STATE (1<<7)
-#define MCS_V_STATE_MASK (0x3<<4)
-#define MCS_V_WRAP (0x0<<4)
-#define MCS_V_MIRROR (0x1<<4)
-#define MCS_V_CLAMP (0x2<<4)
-#define MCS_V_WRAP_SHORTEST (0x3<<4)
-#define MCS_UPDATE_U_STATE (1<<3)
-#define MCS_U_STATE_MASK (0x3<<0)
-#define MCS_U_WRAP (0x0<<0)
-#define MCS_U_MIRROR (0x1<<0)
-#define MCS_U_CLAMP (0x2<<0)
-#define MCS_U_WRAP_SHORTEST (0x3<<0)
-
-#define GFX_OP_MAP_TEXELS ((0x3<<29)|(0x1c<<24)|(0x0<<19))
-#define MT_UPDATE_TEXEL1_STATE (1<<15)
-#define MT_TEXEL1_DISABLE (0<<14)
-#define MT_TEXEL1_ENABLE (1<<14)
-#define MT_TEXEL1_COORD0 (0<<11)
-#define MT_TEXEL1_COORD1 (1<<11)
-#define MT_TEXEL1_MAP0 (0<<8)
-#define MT_TEXEL1_MAP1 (1<<8)
-#define MT_UPDATE_TEXEL0_STATE (1<<7)
-#define MT_TEXEL0_DISABLE (0<<6)
-#define MT_TEXEL0_ENABLE (1<<6)
-#define MT_TEXEL0_COORD0 (0<<3)
-#define MT_TEXEL0_COORD1 (1<<3)
-#define MT_TEXEL0_MAP0 (0<<0)
-#define MT_TEXEL0_MAP1 (1<<0)
-
-#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
-
-/* GFXRENDERSTATE_MAP_ALPHA_BLEND_STAGES, p132
- */
-#define GFX_OP_MAP_ALPHA_STAGES ((0x3<<29)|(0x1<<24))
-#define MA_STAGE_SHIFT 20
-#define MA_STAGE_0 (0<<20)
-#define MA_STAGE_1 (1<<20)
-#define MA_STAGE_2 (2<<20)
-#define MA_UPDATE_ARG1 (1<<18)
-#define MA_ARG1_MASK ((0x7<<15)|(0x1<<13))
-#define MA_ARG1_ALPHA_FACTOR (0x1<<15)
-#define MA_ARG1_ITERATED_ALPHA (0x3<<15)
-#define MA_ARG1_CURRENT_ALPHA (0x5<<15)
-#define MA_ARG1_TEX0_ALPHA (0x6<<15)
-#define MA_ARG1_TEX1_ALPHA (0x7<<15)
-#define MA_ARG1_INVERT (0x1<<13)
-#define MA_ARG1_DONT_INVERT (0x0<<13)
-#define MA_UPDATE_ARG2 (1<<12)
-#define MA_ARG2_MASK ((0x7<<8)|(0x1<<6))
-#define MA_ARG2_ALPHA_FACTOR (0x1<<8)
-#define MA_ARG2_ITERATED_ALPHA (0x3<<8)
-#define MA_ARG2_CURRENT_ALPHA (0x5<<8)
-#define MA_ARG2_TEX0_ALPHA (0x6<<8)
-#define MA_ARG2_TEX1_ALPHA (0x7<<8)
-#define MA_ARG2_INVERT (0x1<<6)
-#define MA_ARG2_DONT_INVERT (0x0<<6)
-#define MA_UPDATE_OP (1<<5)
-#define MA_OP_MASK (0xf)
-#define MA_OP_ARG1 (0x1)
-#define MA_OP_ARG2 (0x2)
-#define MA_OP_MODULATE (0x3)
-#define MA_OP_MODULATE_X2 (0x4)
-#define MA_OP_MODULATE_X4 (0x5)
-#define MA_OP_ADD (0x6)
-#define MA_OP_ADD_SIGNED (0x7)
-#define MA_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MA_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MA_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MA_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-
-
-/* GFXRENDERSTATE_MAP_COLOR_BLEND_STAGES, p129
- */
-#define GFX_OP_MAP_COLOR_STAGES ((0x3<<29)|(0x0<<24))
-#define MC_STAGE_SHIFT 20
-#define MC_STAGE_0 (0<<20)
-#define MC_STAGE_1 (1<<20)
-#define MC_STAGE_2 (2<<20)
-#define MC_UPDATE_DEST (1<<19)
-#define MC_DEST_MASK (1<<18)
-#define MC_DEST_CURRENT (0<<18)
-#define MC_DEST_ACCUMULATOR (1<<18)
-#define MC_UPDATE_ARG1 (1<<17)
-#define MC_ARG1_MASK ((0x7<<14)|(0x1<<13)|(0x1<<12))
-#define MC_ARG1_ONE (0x0<<14)
-#define MC_ARG1_COLOR_FACTOR (0x1<<14)
-#define MC_ARG1_ACCUMULATOR (0x2<<14)
-#define MC_ARG1_ITERATED_COLOR (0x3<<14)
-#define MC_ARG1_SPECULAR_COLOR (0x4<<14)
-#define MC_ARG1_CURRENT_COLOR (0x5<<14)
-#define MC_ARG1_TEX0_COLOR (0x6<<14)
-#define MC_ARG1_TEX1_COLOR (0x7<<14)
-#define MC_ARG1_DONT_REPLICATE_ALPHA (0x0<<13)
-#define MC_ARG1_REPLICATE_ALPHA (0x1<<13)
-#define MC_ARG1_DONT_INVERT (0x0<<12)
-#define MC_ARG1_INVERT (0x1<<12)
-#define MC_UPDATE_ARG2 (1<<11)
-#define MC_ARG2_MASK ((0x7<<8)|(0x1<<7)|(0x1<<6))
-#define MC_ARG2_ONE (0x0<<8)
-#define MC_ARG2_COLOR_FACTOR (0x1<<8)
-#define MC_ARG2_ACCUMULATOR (0x2<<8)
-#define MC_ARG2_ITERATED_COLOR (0x3<<8)
-#define MC_ARG2_SPECULAR_COLOR (0x4<<8)
-#define MC_ARG2_CURRENT_COLOR (0x5<<8)
-#define MC_ARG2_TEX0_COLOR (0x6<<8)
-#define MC_ARG2_TEX1_COLOR (0x7<<8)
-#define MC_ARG2_DONT_REPLICATE_ALPHA (0x0<<7)
-#define MC_ARG2_REPLICATE_ALPHA (0x1<<7)
-#define MC_ARG2_DONT_INVERT (0x0<<6)
-#define MC_ARG2_INVERT (0x1<<6)
-#define MC_UPDATE_OP (1<<5)
-#define MC_OP_MASK (0xf)
-#define MC_OP_DISABLE (0x0)
-#define MC_OP_ARG1 (0x1)
-#define MC_OP_ARG2 (0x2)
-#define MC_OP_MODULATE (0x3)
-#define MC_OP_MODULATE_X2 (0x4)
-#define MC_OP_MODULATE_X4 (0x5)
-#define MC_OP_ADD (0x6)
-#define MC_OP_ADD_SIGNED (0x7)
-#define MC_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MC_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MC_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MC_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-#define MC_OP_LIN_BLEND_TEX0_COLOR (0x12)
-#define MC_OP_LIN_BLEND_TEX1_COLOR (0x13)
-#define MC_OP_SUBTRACT (0x14)
-
-/* GFXRENDERSTATE_MAP_PALETTE_LOAD, p128
- *
- * Format:
- * 0: GFX_OP_MAP_PALETTE_LOAD
- * 1: 16bpp color[0]
- * ...
- * 256: 16bpp color[255]
- */
-#define GFX_OP_MAP_PALETTE_LOAD ((0x3<<29)|(0x1d<<24)|(0x82<<16)|0xff)
-
-/* GFXRENDERSTATE_MAP_LOD_CONTROL, p127
- */
-#define GFX_OP_MAP_LOD_CTL ((0x3<<29)|(0x1c<<24)|(0x4<<19))
-#define MLC_MAP_ID_SHIFT 16
-#define MLC_MAP_0 (0<<16)
-#define MLC_MAP_1 (1<<16)
-#define MLC_UPDATE_DITHER_WEIGHT (1<<10)
-#define MLC_DITHER_WEIGHT_MASK (0x3<<8)
-#define MLC_DITHER_WEIGHT_FULL (0x0<<8)
-#define MLC_DITHER_WEIGHT_50 (0x1<<8)
-#define MLC_DITHER_WEIGHT_25 (0x2<<8)
-#define MLC_DITHER_WEIGHT_12 (0x3<<8)
-#define MLC_UPDATE_LOD_BIAS (1<<7)
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-/* GFXRENDERSTATE_MAP_LOD_LIMITS, p126
- */
-#define GFX_OP_MAP_LOD_LIMITS ((0x3<<29)|(0x1c<<24)|(0x3<<19))
-#define MLL_MAP_ID_SHIFT 16
-#define MLL_MAP_0 (0<<16)
-#define MLL_MAP_1 (1<<16)
-#define MLL_UPDATE_MAX_MIP (1<<13)
-#define MLL_MAX_MIP_SHIFT 5
-#define MLL_MAX_MIP_MASK (0xff<<5)
-#define MLL_MAX_MIP_ONE (0x10<<5)
-#define MLL_UPDATE_MIN_MIP (1<<4)
-#define MLL_MIN_MIP_SHIFT 0
-#define MLL_MIN_MIP_MASK (0xf<<0)
-
-/* GFXRENDERSTATE_MAP_FILTER, p124
- */
-#define GFX_OP_MAP_FILTER ((0x3<<29)|(0x1c<<24)|(0x2<<19))
-#define MF_MAP_ID_SHIFT 16
-#define MF_MAP_0 (0<<16)
-#define MF_MAP_1 (1<<16)
-#define MF_UPDATE_ANISOTROPIC (1<<12)
-#define MF_ANISOTROPIC_MASK (1<<10)
-#define MF_ANISOTROPIC_ENABLE (1<<10)
-#define MF_UPDATE_MIP_FILTER (1<<9)
-#define MF_MIP_MASK (0x3<<6)
-#define MF_MIP_NONE (0x0<<6)
-#define MF_MIP_NEAREST (0x1<<6)
-#define MF_MIP_DITHER (0x2<<6)
-#define MF_MIP_LINEAR (0x3<<6)
-#define MF_UPDATE_MAG_FILTER (1<<5)
-#define MF_MAG_MASK (1<<3)
-#define MF_MAG_LINEAR (1<<3)
-#define MF_MAG_NEAREST (0<<3)
-#define MF_UPDATE_MIN_FILTER (1<<2)
-#define MF_MIN_MASK (1<<0)
-#define MF_MIN_LINEAR (1<<0)
-#define MF_MIN_NEAREST (0<<0)
-
-/* GFXRENDERSTATE_MAP_INFO, p118
- */
-#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2)
-#define MI1_MAP_ID_SHIFT 28
-#define MI1_MAP_0 (0<<28)
-#define MI1_MAP_1 (1<<28)
-#define MI1_FMT_MASK (0x7<<24)
-#define MI1_FMT_8CI (0x0<<24)
-#define MI1_FMT_8BPP (0x1<<24)
-#define MI1_FMT_16BPP (0x2<<24)
-#define MI1_FMT_422 (0x5<<24)
-#define MI1_PF_MASK (0x3<<21)
-#define MI1_PF_8CI_RGB565 (0x0<<21)
-#define MI1_PF_8CI_ARGB1555 (0x1<<21)
-#define MI1_PF_8CI_ARGB4444 (0x2<<21)
-#define MI1_PF_8CI_AY88 (0x3<<21)
-#define MI1_PF_16BPP_RGB565 (0x0<<21)
-#define MI1_PF_16BPP_ARGB1555 (0x1<<21)
-#define MI1_PF_16BPP_ARGB4444 (0x2<<21)
-#define MI1_PF_16BPP_AY88 (0x3<<21)
-#define MI1_PF_422_YCRCB_SWAP_Y (0x0<<21)
-#define MI1_PF_422_YCRCB (0x1<<21)
-#define MI1_PF_422_YCRCB_SWAP_UV (0x2<<21)
-#define MI1_PF_422_YCRCB_SWAP_YUV (0x3<<21)
-#define MI1_OUTPUT_CHANNEL_MASK (0x3<<19)
-#define MI1_COLOR_CONV_ENABLE (1<<18)
-#define MI1_VERT_STRIDE_MASK (1<<17)
-#define MI1_VERT_STRIDE_1 (1<<17)
-#define MI1_VERT_OFFSET_MASK (1<<16)
-#define MI1_VERT_OFFSET_1 (1<<16)
-#define MI1_ENABLE_FENCE_REGS (1<<10)
-#define MI1_TILED_SURFACE (1<<9)
-#define MI1_TILE_WALK_X (0<<8)
-#define MI1_TILE_WALK_Y (1<<8)
-#define MI1_PITCH_MASK (0xf<<0)
-#define MI2_DIMENSIONS_ARE_LOG2 (1<<31)
-#define MI2_DIMENSIONS_ARE_EXACT (0<<31)
-#define MI2_HEIGHT_SHIFT 16
-#define MI2_HEIGHT_MASK (0x1ff<<16)
-#define MI2_WIDTH_SHIFT 0
-#define MI2_WIDTH_MASK (0x1ff<<0)
-#define MI3_BASE_ADDR_MASK (~0xf)
-
-#define SAVAGE_VFMT_T0 (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_1 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define SAVAGE_VFMT_T0T1 (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_2 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define GFX_OP_VERTEX_FMT ((0x3<<29)|(0x5<<24))
-#define VF_TEXCOORD_COUNT_SHIFT 8
-#define VF_TEXCOORD_COUNT_0 (0<<8)
-#define VF_TEXCOORD_COUNT_1 (1<<8)
-#define VF_TEXCOORD_COUNT_2 (2<<8)
-#define VF_SPEC_FOG_ENABLE (1<<7)
-#define VF_RGBA_ENABLE (1<<6)
-#define VF_Z_OFFSET_ENABLE (1<<5)
-#define VF_XYZ (0x1<<1)
-#define VF_XYZW (0x2<<1)
-#define VF_XY (0x3<<1)
-#define VF_XYW (0x4<<1)
-
-/* Master data transfer engine */
-#define MDT_SRCADD_ALIGMENT (~0x1fUL)
-#define MDT_SRC_PCI 0x1
-#define MDT_SRC_AGP 0x3
#endif
-
-
diff --git a/src/mesa/drivers/dri/savage/savage_bci.h b/src/mesa/drivers/dri/savage/savage_bci.h
index 9b3ca2e25d7..3c91e01f210 100644
--- a/src/mesa/drivers/dri/savage/savage_bci.h
+++ b/src/mesa/drivers/dri/savage/savage_bci.h
@@ -130,16 +130,17 @@ typedef enum {
*************************/
typedef enum {
- ZCF_Never,
- ZCF_Less,
- ZCF_Equal,
- ZCF_LessEqual,
- ZCF_Greater,
- ZCF_NotEqual,
- ZCF_GreaterEqual,
- ZCF_Always
-}ZCmpFunc; /* same for Alpha test compare function*/
-
+ CF_Never,
+ CF_Less,
+ CF_Equal,
+ CF_LessEqual,
+ CF_Greater,
+ CF_NotEqual,
+ CF_GreaterEqual,
+ CF_Always
+}ZCmpFunc; /* same for Alpha test and Stencil test compare function */
+
+typedef ZCmpFunc ACmpFunc;
typedef enum {
ZDS_16i, /* .16 fixed*/
@@ -428,17 +429,7 @@ typedef enum
* stencil control
*/
-typedef enum
-{
- STC_COMP_Never,
- STC_COMP_Less,
- STC_COMP_Equal,
- STC_COMP_LessEqual,
- STC_COMP_Greater,
- STC_COMP_NotEqual,
- STC_COMP_GreaterEqual,
- STC_COMP_Always
-} StencilCompareMode;
+typedef ZCmpFunc SCmpFunc;
typedef enum
{
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index 5e79e4abf1e..6b297448d59 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -230,25 +230,25 @@ static void savageBlendFunc_s4(GLcontext *ctx)
if(ctx->Color.AlphaEnabled)
{
- int a;
+ ACmpFunc a;
GLubyte alphaRef;
CLAMPED_FLOAT_TO_UBYTE(alphaRef,ctx->Color.AlphaRef);
switch(ctx->Color.AlphaFunc) {
- case GL_NEVER: a = LCS_A_NEVER; break;
- case GL_ALWAYS: a = LCS_A_ALWAYS; break;
- case GL_LESS: a = LCS_A_LESS; break;
- case GL_LEQUAL: a = LCS_A_LEQUAL; break;
- case GL_EQUAL: a = LCS_A_EQUAL; break;
- case GL_GREATER: a = LCS_A_GREATER; break;
- case GL_GEQUAL: a = LCS_A_GEQUAL; break;
- case GL_NOTEQUAL: a = LCS_A_NOTEQUAL; break;
- default:return;
+ case GL_NEVER: a = CF_Never; break;
+ case GL_ALWAYS: a = CF_Always; break;
+ case GL_LESS: a = CF_Less; break;
+ case GL_LEQUAL: a = CF_LessEqual; break;
+ case GL_EQUAL: a = CF_Equal; break;
+ case GL_GREATER: a = CF_Greater; break;
+ case GL_GEQUAL: a = CF_GreaterEqual; break;
+ case GL_NOTEQUAL: a = CF_NotEqual; break;
+ default:return;
}
imesa->regs.s4.drawCtrl1.ni.alphaTestEn = GL_TRUE;
- imesa->regs.s4.drawCtrl1.ni.alphaTestCmpFunc = a & 0x0F;
+ imesa->regs.s4.drawCtrl1.ni.alphaTestCmpFunc = a;
imesa->regs.s4.drawCtrl0.ni.alphaRefVal = alphaRef;
}
else
@@ -398,25 +398,25 @@ static void savageBlendFunc_s3d(GLcontext *ctx)
if(ctx->Color.AlphaEnabled)
{
- GLint a;
+ ACmpFunc a;
GLubyte alphaRef;
CLAMPED_FLOAT_TO_UBYTE(alphaRef,ctx->Color.AlphaRef);
switch(ctx->Color.AlphaFunc) {
- case GL_NEVER: a = LCS_A_NEVER; break;
- case GL_ALWAYS: a = LCS_A_ALWAYS; break;
- case GL_LESS: a = LCS_A_LESS; break;
- case GL_LEQUAL: a = LCS_A_LEQUAL; break;
- case GL_EQUAL: a = LCS_A_EQUAL; break;
- case GL_GREATER: a = LCS_A_GREATER; break;
- case GL_GEQUAL: a = LCS_A_GEQUAL; break;
- case GL_NOTEQUAL: a = LCS_A_NOTEQUAL; break;
- default:return;
+ case GL_NEVER: a = CF_Never; break;
+ case GL_ALWAYS: a = CF_Always; break;
+ case GL_LESS: a = CF_Less; break;
+ case GL_LEQUAL: a = CF_LessEqual; break;
+ case GL_EQUAL: a = CF_Equal; break;
+ case GL_GREATER: a = CF_Greater; break;
+ case GL_GEQUAL: a = CF_GreaterEqual; break;
+ case GL_NOTEQUAL: a = CF_NotEqual; break;
+ default:return;
}
imesa->regs.s3d.drawCtrl.ni.alphaTestEn = GL_TRUE;
- imesa->regs.s3d.drawCtrl.ni.alphaTestCmpFunc = a & 0x07;
+ imesa->regs.s3d.drawCtrl.ni.alphaTestCmpFunc = a;
imesa->regs.s3d.drawCtrl.ni.alphaRefVal = alphaRef;
}
else
@@ -452,7 +452,7 @@ static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB,
static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- int zmode;
+ ZCmpFunc zmode;
#define depthIndex 0
/* set up z-buffer control register (global)
@@ -461,20 +461,20 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
*/
switch(func) {
- case GL_NEVER: zmode = LCS_Z_NEVER; break;
- case GL_ALWAYS: zmode = LCS_Z_ALWAYS; break;
- case GL_LESS: zmode = LCS_Z_LESS; break;
- case GL_LEQUAL: zmode = LCS_Z_LEQUAL; break;
- case GL_EQUAL: zmode = LCS_Z_EQUAL; break;
- case GL_GREATER: zmode = LCS_Z_GREATER; break;
- case GL_GEQUAL: zmode = LCS_Z_GEQUAL; break;
- case GL_NOTEQUAL: zmode = LCS_Z_NOTEQUAL; break;
- default:return;
+ case GL_NEVER: zmode = CF_Never; break;
+ case GL_ALWAYS: zmode = CF_Always; break;
+ case GL_LESS: zmode = CF_Less; break;
+ case GL_LEQUAL: zmode = CF_LessEqual; break;
+ case GL_EQUAL: zmode = CF_Equal; break;
+ case GL_GREATER: zmode = CF_Greater; break;
+ case GL_GEQUAL: zmode = CF_GreaterEqual; break;
+ case GL_NOTEQUAL: zmode = CF_NotEqual; break;
+ default:return;
}
if (ctx->Depth.Test)
{
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = zmode & 0x0F;
+ imesa->regs.s4.zBufCtrl.ni.zCmpFunc = zmode;
imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = ctx->Depth.Mask;
imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_TRUE;
#if 1
@@ -492,7 +492,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
#if HW_STENCIL
if(imesa->hw_stencil)
{
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = LCS_Z_ALWAYS & 0x0F;
+ imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = GL_FALSE;
imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_FALSE;
@@ -505,7 +505,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
if (imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn == GL_FALSE)
{
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = LCS_Z_ALWAYS & 0x0F;
+ imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
}
else
@@ -524,7 +524,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- int zmode;
+ ZCmpFunc zmode;
#define depthIndex 0
/* set up z-buffer control register (global)
@@ -532,20 +532,20 @@ static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func)
* set up z read/write watermarks register (global)
*/
switch(func) {
- case GL_NEVER: zmode = LCS_Z_NEVER; break;
- case GL_ALWAYS: zmode = LCS_Z_ALWAYS; break;
- case GL_LESS: zmode = LCS_Z_LESS; break;
- case GL_LEQUAL: zmode = LCS_Z_LEQUAL; break;
- case GL_EQUAL: zmode = LCS_Z_EQUAL; break;
- case GL_GREATER: zmode = LCS_Z_GREATER; break;
- case GL_GEQUAL: zmode = LCS_Z_GEQUAL; break;
- case GL_NOTEQUAL: zmode = LCS_Z_NOTEQUAL; break;
- default:return;
+ case GL_NEVER: zmode = CF_Never; break;
+ case GL_ALWAYS: zmode = CF_Always; break;
+ case GL_LESS: zmode = CF_Less; break;
+ case GL_LEQUAL: zmode = CF_LessEqual; break;
+ case GL_EQUAL: zmode = CF_Equal; break;
+ case GL_GREATER: zmode = CF_Greater; break;
+ case GL_GEQUAL: zmode = CF_GreaterEqual; break;
+ case GL_NOTEQUAL: zmode = CF_NotEqual; break;
+ default:return;
}
if (ctx->Depth.Test)
{
imesa->regs.s3d.zBufCtrl.ni.zBufEn = GL_TRUE;
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = zmode & 0x0F;
+ imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = zmode;
imesa->regs.s3d.zBufCtrl.ni.zUpdateEn = ctx->Depth.Mask;
imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites = GL_TRUE;
@@ -556,7 +556,7 @@ static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func)
else
{
if (imesa->regs.s3d.zBufCtrl.ni.drawUpdateEn == GL_FALSE) {
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = LCS_Z_ALWAYS & 0x0F;
+ imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = CF_Always;
imesa->regs.s3d.zBufCtrl.ni.zBufEn = GL_TRUE;
}
else
@@ -1016,7 +1016,7 @@ static void savageDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
static void savageStencilFunc(GLcontext *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- int a=0;
+ SCmpFunc a=0;
if (ctx->Stencil.Enabled)
{
@@ -1024,19 +1024,19 @@ static void savageStencilFunc(GLcontext *ctx)
switch (ctx->Stencil.Function[0])
{
- case GL_NEVER: a = LCS_S_NEVER; break;
- case GL_ALWAYS: a = LCS_S_ALWAYS; break;
- case GL_LESS: a = LCS_S_LESS; break;
- case GL_LEQUAL: a = LCS_S_LEQUAL; break;
- case GL_EQUAL: a = LCS_S_EQUAL; break;
- case GL_GREATER: a = LCS_S_GREATER; break;
- case GL_GEQUAL: a = LCS_S_GEQUAL; break;
- case GL_NOTEQUAL: a = LCS_S_NOTEQUAL; break;
- default:
- break;
+ case GL_NEVER: a = CF_Never; break;
+ case GL_ALWAYS: a = CF_Always; break;
+ case GL_LESS: a = CF_Less; break;
+ case GL_LEQUAL: a = CF_LessEqual; break;
+ case GL_EQUAL: a = CF_Equal; break;
+ case GL_GREATER: a = CF_Greater; break;
+ case GL_GEQUAL: a = CF_GreaterEqual; break;
+ case GL_NOTEQUAL: a = CF_NotEqual; break;
+ default:
+ break;
}
- imesa->regs.s4.stencilCtrl.ni.cmpFunc = (GLuint)a & 0x0F;
+ imesa->regs.s4.stencilCtrl.ni.cmpFunc = a;
imesa->regs.s4.stencilCtrl.ni.stencilEn = GL_TRUE;
imesa->regs.s4.stencilCtrl.ni.readMask = ctx->Stencil.ValueMask[0];
imesa->regs.s4.stencilCtrl.ni.writeMask = ctx->Stencil.WriteMask[0];
@@ -1140,7 +1140,7 @@ static void savageStencilFunc(GLcontext *ctx)
if (imesa->regs.s4.zBufCtrl.ni.zBufEn != GL_TRUE)
{
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = LCS_Z_ALWAYS & 0x0F;
+ imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = GL_FALSE;
}
@@ -1612,7 +1612,7 @@ static void savageDDInitState_s4( savageContextPtr imesa )
imesa->regs.s4.destCtrl.ui = 1<<7;
#endif
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = LCS_Z_LESS;
+ imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Less;
imesa->regs.s4.zBufCtrl.ni.wToZEn = GL_TRUE;
/*imesa->regs.s4.ZBufCtrl.ni.floatZEn = GL_TRUE;*/
imesa->regs.s4.texBlendCtrl[0].ui = TBC_NoTexMap;
@@ -1675,7 +1675,7 @@ static void savageDDInitState_s3d( savageContextPtr imesa )
imesa->regs.s3d.destCtrl.ui = 1<<7;
#endif
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = LCS_Z_LESS & 0x07;
+ imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = CF_Less;
#if 0
imesa->regs.s3d.drawCtrl.ni.xyOffsetEn = 1;
#endif