summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-10-30 13:31:59 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-10-30 13:31:59 +0000
commita96308c37db0bc0086a017d318bc3504aa5f0b1a (patch)
tree0010de3aa19901acf13b57e57e7ba465abffa95e /src/mesa/drivers
parenta4575499679d9d91055a35c7673b81872ec127cb (diff)
Replace the flags Mesa was using for ctx->NewState with a new set
based on the GL attribute groups. Introduced constants describing the circumstances under which some key derived values can change: _SWRAST_NEW_RASTERMASK -- ctx->RasterMask _SWRAST_NEW_TRIANGLE -- The software rasterizer's triangle function _DD_NEW_FEEDBACK -- the 'DD_FEEDBACK' bit in ctx->TriangleCaps These are helpful in deciding whether you need to recalculate state if your recalculation involves reference to a derived value.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/glide/fxdd.c27
-rw-r--r--src/mesa/drivers/glide/fxddtex.c5
-rw-r--r--src/mesa/drivers/glide/fxdrv.h30
-rw-r--r--src/mesa/drivers/x11/xm_api.c18
-rw-r--r--src/mesa/drivers/x11/xm_tri.c24
5 files changed, 91 insertions, 13 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index b69b6999ea..3811770558 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -831,7 +831,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
fxMesa->glCtx->Const.MaxTextureLevels=9;
fxMesa->glCtx->Const.MaxTextureSize=256;
fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
- fxMesa->new_state = NEW_ALL;
+ fxMesa->new_state = _NEW_ALL;
fxDDSetupInit();
fxDDCvaInit();
@@ -888,7 +888,7 @@ void fxDDInitExtensions( GLcontext *ctx )
gl_extensions_disable(ctx, "GL_EXT_blend_color");
gl_extensions_disable(ctx, "GL_EXT_fog_coord");
- gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0);
+ gl_extensions_add(ctx, GL_TRUE, "3DFX_set_global_palette", 0);
if (!fxMesa->haveTwoTMUs)
gl_extensions_disable(ctx, "GL_EXT_texture_env_add");
@@ -1022,9 +1022,6 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
}
-
-#define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|NEW_PROJECTION|NEW_TEXTURE_MATRIX|NEW_USER_CLIP|NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE))
-
static void fxDDUpdateDDPointers(GLcontext *ctx)
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
@@ -1033,23 +1030,26 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE))
fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n");
- if (new_state & (NEW_RASTER_OPS|NEW_TEXTURING))
+ if (new_state & _FX_NEW_FALLBACK)
fxMesa->is_in_hardware = fxIsInHardware(ctx);
if (fxMesa->is_in_hardware) {
if (fxMesa->new_state)
fxSetupFXUnits(ctx);
- if(new_state & INTERESTED) {
+ if (new_state & _FX_NEW_RENDERSTATE) {
fxDDChooseRenderState( ctx );
+
fxMesa->RenderVBTables=fxDDChooseRenderVBTables(ctx);
fxMesa->RenderVBClippedTab=fxMesa->RenderVBTables[0];
fxMesa->RenderVBCulledTab=fxMesa->RenderVBTables[1];
fxMesa->RenderVBRawTab=fxMesa->RenderVBTables[2];
-
- ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx);
}
-
+
+ if (new_state & _FX_NEW_SETUP_FUNCTION)
+ ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx);
+
+
ctx->Driver.PointsFunc=fxMesa->PointsFunc;
ctx->Driver.LineFunc=fxMesa->LineFunc;
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
@@ -1075,6 +1075,13 @@ void fxSetupDDPointers(GLcontext *ctx)
fprintf(stderr,"fxmesa: fxSetupDDPointers()\n");
}
+ ctx->Driver.UpdateStateNotify = (_FX_NEW_SETUP_FUNCTION|
+ _FX_NEW_RENDERSTATE|
+ _FX_NEW_FALLBACK|
+ _SWRAST_NEW_TRIANGLE|
+ _SWRAST_NEW_LINE|
+ _SWRAST_NEW_POINT);
+
ctx->Driver.UpdateState=fxDDUpdateDDPointers;
ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan;
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 3c628d2fcf..553dc8f86a 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -340,7 +340,10 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
FREE(ti);
tObj->DriverData = NULL;
- ctx->NewState |= NEW_TEXTURING;
+/* Pushed into core: Set _NEW_TEXTURE whenever a bound texture is
+ * deleted (changes bound texture id).
+ */
+/* ctx->NewState |= _NEW_TEXTURE; */
}
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index e3a865b0d4..412f3cb15d 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -412,6 +412,36 @@ struct tfxMesaVertexBuffer {
#endif
+
+
+/* Covers the state referenced by IsInHardware:
+ */
+#define _FX_NEW_FALLBACK (_NEW_TEXTURE| \
+ _NEW_HINT| \
+ _NEW_STENCIL| \
+ _NEW_BUFFERS| \
+ _NEW_COLOR| \
+ _NEW_LIGHT)
+
+/* Covers the state referenced by fxDDChooseRenderState and
+ * fxDDChoseRenderVBTables.
+ */
+#define _FX_NEW_RENDERSTATE (_NEW_RENDERMODE | \
+ _DD_NEW_FLATSHADE | \
+ _DD_NEW_TRI_LIGHT_TWOSIDE| \
+ _DD_NEW_MULTIDRAW | \
+ _NEW_POINT | \
+ _NEW_LINE | \
+ _NEW_POLYGON)
+
+/* Covers the state referenced by fxDDChooseSetupFunction.
+ */
+#define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
+ _NEW_FOG| \
+ _NEW_TEXTURE| \
+ _NEW_COLOR) \
+
+
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
*/
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 4434fbfa2b..b8ba18316a 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,4 +1,4 @@
-/* $Id: xm_api.c,v 1.3 2000/10/30 08:39:38 joukj Exp $ */
+/* $Id: xm_api.c,v 1.4 2000/10/30 13:32:03 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1655,6 +1655,22 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
c->gl_ctx->Driver.UpdateState = xmesa_update_state;
+ /* These flags cover all the tests made in UpdateState, plus what
+ * the software rasterizer needs to choose line,point and triangle
+ * functions.
+ */
+ c->gl_ctx->Driver.UpdateStateNotify = (_NEW_POINT|
+ _NEW_TEXTURE|
+ _NEW_LINE|
+ _NEW_LIGHT|
+ _NEW_DEPTH|
+ _NEW_POLYGON|
+ _NEW_TEXTURE|
+ _SWRAST_NEW_RASTERMASK|
+ _SWRAST_NEW_TRIANGLE|
+ _SWRAST_NEW_LINE|
+ _SWRAST_NEW_POINT);
+
#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
c->driContextPriv = driContextPriv;
#endif
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 5392c0f353..b0d134a259 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1,4 +1,4 @@
-/* $Id: xm_tri.c,v 1.4 2000/09/28 22:44:32 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.5 2000/10/30 13:32:03 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -106,6 +106,7 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer, Y); \
GLint len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -141,6 +142,7 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -174,6 +176,7 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -207,6 +210,7 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -240,6 +244,7 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -275,6 +280,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
DEPTH_TYPE z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -308,6 +314,7 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -342,6 +349,7 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx,
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
XDITHER_SETUP(yy); \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -377,6 +385,7 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx,
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
XDITHER_SETUP(yy); \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -411,6 +420,7 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
{ \
GLint i, len = RIGHT-LEFT; \
LOOKUP_SETUP; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -444,6 +454,7 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -477,6 +488,7 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -508,6 +520,7 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -539,6 +552,7 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -568,6 +582,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -597,6 +612,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -631,6 +647,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
DEPTH_TYPE z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -660,6 +677,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
DEPTH_TYPE z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -693,6 +711,7 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
{ \
GLint i, xx = LEFT, len = RIGHT-LEFT; \
FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, Y)); \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -723,6 +742,7 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
FLAT_DITHER_ROW_SETUP(yy); \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -756,6 +776,7 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++,xx++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
@@ -790,6 +811,7 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
+ (void) fffog; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \