From 6eb73cf6c1c3a8d4fe3f3f41b24e1d9a034fbdee Mon Sep 17 00:00:00 2001 From: alanh <> Date: Fri, 24 Nov 2000 18:38:46 +0000 Subject: [PATCH] Add new grStippleMode and grStipplePattern functions for Voodoo3 and Voodoo5. --- glide3x/h3/glide3/src/distate.c | 66 ++++++++++++++++++++++++++++++ glide3x/h3/glide3/src/fxglide.h | 25 +++++++++++ glide3x/h3/glide3/src/gglide.c.dri | 43 +++++++++++++++++++ glide3x/h3/glide3/src/glide.h | 18 ++++++++ glide3x/h5/glide3/src/distate.c | 65 +++++++++++++++++++++++++++++ glide3x/h5/glide3/src/fxglide.h | 20 +++++++++ glide3x/h5/glide3/src/gglide.c | 40 ++++++++++++++++++ glide3x/h5/glide3/src/glide.h | 18 ++++++++ 8 files changed, 295 insertions(+) diff --git a/glide3x/h3/glide3/src/distate.c b/glide3x/h3/glide3/src/distate.c index a23c66f..5c7669f 100644 --- a/glide3x/h3/glide3/src/distate.c +++ b/glide3x/h3/glide3/src/distate.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.1.1.1 1999/11/24 21:44:54 joseph + ** Initial checkin for SourceForge + ** ** ** 5 4/06/99 3:54p Dow ** Alt tab again. @@ -536,6 +539,55 @@ GR_DIENTRY(grDepthBufferMode, void , (GrDepthBufferMode_t mode) ) #undef FN_NAME } /* grDepthBufferMode */ +/*------------------------------------------------------------------- + Function: grStipplePattern + Date: 23-Nov-2000 + Implementor(s): alanh + Description: + + Arguments: + + Return: + -------------------------------------------------------------------*/ +#ifdef __linux__ +GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple)) +{ + #define FN_NAME "grStipplePattern" + + GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + + INVALIDATE(stipple); + + STOREARG(grStipplePattern, stipple); + + #undef FN_NAME +} /* grStipplePattern */ +#endif /* __linux__ */ + + /*------------------------------------------------------------------- + Function: grStippleMode + Date: 23-Nov-2000 + Implementor(s): alanh + Description: + + Arguments: + + Return: + -------------------------------------------------------------------*/ +#ifdef __linux__ +GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) ) +{ + #define FN_NAME "grStippleMode" + + GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + + INVALIDATE(fbzMode); + + STOREARG(grStippleMode, mode); + + #undef FN_NAME +} /* grStippleMode */ +#endif /* __linux__ */ /*------------------------------------------------------------------- Function: grDitherMode @@ -896,6 +948,9 @@ _grValidateState() _grDepthBufferFunction(LOADARG(grDepthBufferFunction, fnc)); _grDepthBufferMode(LOADARG(grDepthBufferMode, mode)); _grDitherMode(LOADARG(grDitherMode, mode)); +#ifdef __linux__ + _grStippleMode(LOADARG(grStippleMode, mode)); +#endif /* __linux__ */ _grSstOrigin(LOADARG(grSstOrigin, origin)); _grRenderBuffer(LOADARG(grRenderBuffer, buffer)); @@ -954,6 +1009,17 @@ _grValidateState() reg_cnt++; } +#ifdef __linux__ + if (NOTVALID(stipple)) { + gc->state.shadow.stipple = LOADARG(grStipplePattern, stipple); + REG_GROUP_BEGIN(BROADCAST_ID, stipple, 1, 0x01); + { + REG_GROUP_SET(hw, stipple, gc->state.shadow.stipple); + } + REG_GROUP_END(); + } +#endif /* __linux__ */ + if (NOTVALID(lfbMode)) { FxU32 lfbMode = gc->state.shadow.lfbMode; diff --git a/glide3x/h3/glide3/src/fxglide.h b/glide3x/h3/glide3/src/fxglide.h index d192f2f..032b99e 100644 --- a/glide3x/h3/glide3/src/fxglide.h +++ b/glide3x/h3/glide3/src/fxglide.h @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1.2.2 2000/10/03 08:18:09 alanh +** merge trunk into Glide3-64bit branch. +** ** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh ** Changes for Voodoo3 for 64bit architectures ** @@ -276,6 +279,7 @@ /* local */ #define GR_CDECL +#include "g3ext.h" #include "fxcmd.h" #include "gsfc.h" @@ -470,6 +474,7 @@ typedef struct { #define lfbModeBIT FXBIT(8) #define c0c1BIT FXBIT(9) #define chromaRangeBIT FXBIT(10) +#define stippleBIT FXBIT(11) /* ** lazy evaluate vertexlayout. ** it is not part of the registers so we add the bit in MSB @@ -770,6 +775,14 @@ typedef struct { struct { GrDitherMode_t mode; } grDitherModeArgs; +#ifdef __linux__ + struct { + GrStippleMode_t mode; + } grStippleModeArgs; + struct { + GrStipplePattern_t stipple; + } grStipplePatternArgs; +#endif /* __linux__ */ struct { GrBuffer_t buffer; } grRenderBufferArgs; @@ -1657,6 +1670,13 @@ _grColorCombine( GrCombineLocal_t local, GrCombineOther_t other, FxBool invert ); + +#ifdef __linux__ +void FX_CALL +grStipplePattern( + GrStipplePattern_t stipple); +#endif /* __linux__ */ + void FX_CALL grChromaRangeMode(GrChromaRangeMode_t mode); @@ -1699,6 +1719,11 @@ _grDepthBufferMode( GrDepthBufferMode_t mode ); void _grDitherMode( GrDitherMode_t mode ); +#ifdef __linux__ +void +_grStippleMode( GrStippleMode_t mode ); +#endif /* __linux__ */ + void _grRenderBuffer( GrBuffer_t buffer ); diff --git a/glide3x/h3/glide3/src/gglide.c.dri b/glide3x/h3/glide3/src/gglide.c.dri index 72c3aae..96bdffc 100644 --- a/glide3x/h3/glide3/src/gglide.c.dri +++ b/glide3x/h3/glide3/src/gglide.c.dri @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.1.1.1.2.4 2000/11/16 20:25:59 alanh +** fix a typo +** ** Revision 1.1.1.1.2.3 2000/11/16 18:56:48 alanh ** add a linux specific grRenderBuffer to fix switching between FRONT and ** BACK buffers. @@ -1913,6 +1916,46 @@ GR_ENTRY(grDisableAllEffects, void, (void)) grFogMode(GR_FOG_DISABLE); } /* grDisableAllEffects */ +/*--------------------------------------------------------------------------- +** grStippleMode +*/ + +#ifdef __linux__ +GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode)) +{ +#define FN_NAME "_grStippleMode" + FxU32 fbzMode; + GR_BEGIN_NOFIFOCHECK("_grStippleMode", 85); + GDBG_INFO_MORE(gc->myLevel, "(%d)\n", mode); + + fbzMode = gc->state.shadow.fbzMode; + + fbzMode &= ~(SST_ENSTIPPLE | SST_ENSTIPPLEPATTERN); + + switch (mode) { + case GR_STIPPLE_DISABLE: + break; + + case GR_STIPPLE_PATTERN: + fbzMode |= (SST_ENSTIPPLE | SST_ENSTIPPLEPATTERN); + break; + + case GR_STIPPLE_ROTATE: + fbzMode |= SST_ENSTIPPLE; + break; + } + + gc->state.shadow.fbzMode = fbzMode; + +#if !GLIDE3 + GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); + GR_SET(BROADCAST_ID, hw, fbzMode, fbzMode); + GR_CHECK_SIZE(); +#endif /* !GLIDE3 */ +#undef FN_NAME +} /* grStippleMode */ +#endif /* __linux__ */ + /*--------------------------------------------------------------------------- ** grDitherMode */ diff --git a/glide3x/h3/glide3/src/glide.h b/glide3x/h3/glide3/src/glide.h index b15ca6e..ade08db 100644 --- a/glide3x/h3/glide3/src/glide.h +++ b/glide3x/h3/glide3/src/glide.h @@ -52,6 +52,9 @@ extern "C" { typedef FxU32 GrColor_t; typedef FxU8 GrAlpha_t; typedef FxU32 GrMipMapId_t; +#ifdef __linux__ +typedef FxU32 GrStipplePattern_t; +#endif /* __linux__ */ typedef FxU8 GrFog_t; typedef AnyPtr GrContext_t; typedef int (FX_CALL *GrProc)(); @@ -250,6 +253,13 @@ typedef FxI32 GrDitherMode_t; #define GR_DITHER_2x2 0x1 #define GR_DITHER_4x4 0x2 +#ifdef __linux__ +typedef FxI32 GrStippleMode_t; +#define GR_STIPPLE_DISABLE 0x0 +#define GR_STIPPLE_PATTERN 0x1 +#define GR_STIPPLE_ROTATE 0x2 +#endif /* __linux__ */ + typedef FxI32 GrFogMode_t; #define GR_FOG_DISABLE 0x0 #define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1 @@ -699,6 +709,14 @@ grDisableAllEffects( void ); FX_ENTRY void FX_CALL grDitherMode( GrDitherMode_t mode ); +#ifdef __linux__ +FX_ENTRY void FX_CALL +grStippleMode( GrStippleMode_t mode ); + +FX_ENTRY void FX_CALL +grStipplePattern( GrStipplePattern_t mode ); +#endif /* __linux__ */ + FX_ENTRY void FX_CALL grFogColorValue( GrColor_t fogcolor ); diff --git a/glide3x/h5/glide3/src/distate.c b/glide3x/h5/glide3/src/distate.c index 699d3d9..bd38347 100644 --- a/glide3x/h5/glide3/src/distate.c +++ b/glide3x/h5/glide3/src/distate.c @@ -830,6 +830,32 @@ GR_EXT_ENTRY(grLfbConstantStencil, void , (GrStencil_t value) ) #undef FN_NAME } /* grLfbConstantStencil */ +/*------------------------------------------------------------------- + Function: grStipplePattern + Date: 23-Nov-2000 + Implementor(s): alanh + Description: + + Arguments: + + Return: + -------------------------------------------------------------------*/ +#ifdef __linux__ +GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple)) +{ + #define FN_NAME "grStipplePattern" + + GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + + INVALIDATE(stipple); + + STOREARG(grStipplePattern, stipple); + + #undef FN_NAME +} /* grStipplePattern */ +#endif /* __linux__ */ + + /*------------------------------------------------------------------- Function: grStencilOp Date: 03-June-99 @@ -980,6 +1006,31 @@ GR_EXT_ENTRY(grAlphaCombineExt, void , (GrACUColor_t a, #endif +/*------------------------------------------------------------------- + Function: grStippleMode + Date: 23-Nov-2000 + Implementor(s): alanh + Description: + + Arguments: + + Return: + -------------------------------------------------------------------*/ +#ifdef __linux__ +GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) ) +{ + #define FN_NAME "grStippleMode" + + GR_BEGIN_NOFIFOCHECK("grStippleMode\n", 85); + + INVALIDATE(fbzMode); + + STOREARG(grStippleMode, mode); + + #undef FN_NAME +} /* grStippleMode */ +#endif /* __linux__ */ + /*------------------------------------------------------------------- Function: grDitherMode Date: 07-Oct-97 @@ -2020,6 +2071,9 @@ _grValidateState() _grDepthBufferFunction(LOADARG(grDepthBufferFunction, fnc)); _grDepthBufferMode(LOADARG(grDepthBufferMode, mode)); _grDitherMode(LOADARG(grDitherMode, mode)); +#ifdef __linux__ + _grStippleMode(LOADARG(grStippleMode, mode)); +#endif /* __linux__ */ _grSstOrigin(LOADARG(grSstOrigin, origin)); _grRenderBuffer(LOADARG(grRenderBuffer, buffer)); /* tbext */ @@ -2232,6 +2286,17 @@ _grValidateState() REG_GROUP_END(); } +#ifdef __linux__ + if (NOTVALID(stipple)) { + gc->state.shadow.stipple = LOADARG(grStipplePattern, stipple); + REG_GROUP_BEGIN(BROADCAST_ID, stipple, 1, 0x01); + { + REG_GROUP_SET(hw, stipple, gc->state.shadow.stipple); + } + REG_GROUP_END(); + } +#endif /* __linux__ */ + if (NOTVALID(stencilOp)) { FxU32 stencilOp = gc->state.shadow.stencilOp; stencilOp &= ~(SST_STENCIL_SFAIL_OP | SST_STENCIL_ZFAIL_OP | SST_STENCIL_ZPASS_OP); diff --git a/glide3x/h5/glide3/src/fxglide.h b/glide3x/h5/glide3/src/fxglide.h index 8bcf2bc..fb390cd 100644 --- a/glide3x/h5/glide3/src/fxglide.h +++ b/glide3x/h5/glide3/src/fxglide.h @@ -743,6 +743,7 @@ typedef struct { #define combineModeBIT FXBIT(13) #define renderModeBIT FXBIT(14) #define tmuConfigBIT FXBIT(15) +#define stippleBIT FXBIT(16) /* Similar bits for TMU registers */ #define textureModeBIT FXBIT(0) @@ -1135,6 +1136,14 @@ typedef struct { struct { GrDitherMode_t mode; } grDitherModeArgs; +#ifdef __linux__ + struct { + GrStippleMode_t mode; + } grStippleModeArgs; + struct { + GrStipplePattern_t stipple; + } grStipplePatternArgs; +#endif /* __linux__ */ struct { GrBuffer_t buffer; } grRenderBufferArgs; @@ -2328,6 +2337,12 @@ grStencilFunc(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); void FX_CALL grStencilMask(GrStencil_t write_mask); +#ifdef __linux__ +void FX_CALL +grStipplePattern( + GrStipplePattern_t stipple); +#endif /* __linux__ */ + void FX_CALL grStencilOp( GrStencilOp_t stencil_fail, @@ -2502,6 +2517,11 @@ _grDepthBufferMode( GrDepthBufferMode_t mode ); void _grDitherMode( GrDitherMode_t mode ); +#ifdef __linux__ +void +_grStippleMode( GrStippleMode_t mode ); +#endif /* __linux__ */ + void _grRenderBuffer( GrBuffer_t buffer ); diff --git a/glide3x/h5/glide3/src/gglide.c b/glide3x/h5/glide3/src/gglide.c index 9f855df..ab337d4 100644 --- a/glide3x/h5/glide3/src/gglide.c +++ b/glide3x/h5/glide3/src/gglide.c @@ -3598,6 +3598,46 @@ GR_ENTRY(grDisableAllEffects, void, (void)) grFogMode(GR_FOG_DISABLE); } /* grDisableAllEffects */ +/*--------------------------------------------------------------------------- +** grStippleMode +*/ + +#ifdef __linux__ +GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode)) +{ +#define FN_NAME "_grStippleMode" + FxU32 fbzMode; + GR_BEGIN_NOFIFOCHECK("_grStippleMode", 85); + GDBG_INFO_MORE(gc->myLevel, "(%d)\n", mode); + + fbzMode = gc->state.shadow.fbzMode; + + fbzMode &= ~(SST_ENSTIPPLE | SST_ENSTIPPLEPATTERN); + + switch (mode) { + case GR_STIPPLE_DISABLE: + break; + + case GR_STIPPLE_PATTERN: + fbzMode |= (SST_ENSTIPPLE | SST_ENSTIPPLEPATTERN); + break; + + case GR_STIPPLE_ROTATE: + fbzMode |= SST_ENSTIPPLE; + break; + } + + gc->state.shadow.fbzMode = fbzMode; + +#if !GLIDE3 + GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1); + GR_SET(BROADCAST_ID, hw, fbzMode, fbzMode); + GR_CHECK_SIZE(); +#endif /* !GLIDE3 */ +#undef FN_NAME +} /* grStippleMode */ +#endif /* __linux__ */ + /*--------------------------------------------------------------------------- ** grDitherMode */ diff --git a/glide3x/h5/glide3/src/glide.h b/glide3x/h5/glide3/src/glide.h index 0c15a31..16b7700 100644 --- a/glide3x/h5/glide3/src/glide.h +++ b/glide3x/h5/glide3/src/glide.h @@ -52,6 +52,9 @@ extern "C" { typedef FxU32 GrColor_t; typedef FxU8 GrAlpha_t; typedef FxU32 GrMipMapId_t; +#ifdef __linux__ +typedef FxU32 GrStipplePattern_t; +#endif /* __linux__ */ typedef FxU8 GrFog_t; typedef AnyPtr GrContext_t; typedef int (FX_CALL *GrProc)(); @@ -240,6 +243,13 @@ typedef FxI32 GrDitherMode_t; #define GR_DITHER_2x2 0x1 #define GR_DITHER_4x4 0x2 +#ifdef __linux__ +typedef FxI32 GrStippleMode_t; +#define GR_STIPPLE_DISABLE 0x0 +#define GR_STIPPLE_PATTERN 0x1 +#define GR_STIPPLE_ROTATE 0x2 +#endif /* __linux__ */ + typedef FxI32 GrFogMode_t; #define GR_FOG_DISABLE 0x0 #define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1 @@ -734,6 +744,14 @@ grCoordinateSpace( GrCoordinateSpaceMode_t mode ); FX_ENTRY void FX_CALL grDepthRange( FxFloat n, FxFloat f ); +#ifdef __linux__ +FX_ENTRY void FX_CALL +grStippleMode( GrStippleMode_t mode ); + +FX_ENTRY void FX_CALL +grStipplePattern( GrStipplePattern_t mode ); +#endif /* __linux__ */ + FX_ENTRY void FX_CALL grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height );