summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-03-29 21:16:25 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-03-29 21:16:25 +0000
commited39a43b8cb2e1cf69b097fc89365cde470ebf51 (patch)
treee886defa720e33ec795c7ffb7941fcab5c5b8e1d
parent2780ed4b978b32a08be6eecb0e923250e7b907ee (diff)
Remove ENABLE_* flags, ctx->_Enabled.
Replace with ctx->Texture._TexMatEnabled, ctx->Texture._TexGenEnabled.
-rw-r--r--src/mesa/main/debug.c30
-rw-r--r--src/mesa/main/enable.c10
-rw-r--r--src/mesa/main/mtypes.h48
-rw-r--r--src/mesa/main/points.c3
-rw-r--r--src/mesa/main/state.c14
-rw-r--r--src/mesa/swrast_setup/ss_vb.c4
-rw-r--r--src/mesa/tnl/t_vb_texgen.c20
-rw-r--r--src/mesa/tnl/t_vb_texmat.c8
8 files changed, 43 insertions, 94 deletions
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index ee52963d34..7a3a88edf2 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -1,4 +1,4 @@
-/* $Id: debug.c,v 1.11 2001/03/29 17:08:26 keithw Exp $ */
+/* $Id: debug.c,v 1.12 2001/03/29 21:16:25 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -60,34 +60,6 @@ void _mesa_print_state( const char *msg, GLuint state )
}
-void _mesa_print_enable_flags( const char *msg, GLuint flags )
-{
- fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & ENABLE_LIGHT) ? "light, " : "",
- (flags & ENABLE_FOG) ? "fog, " : "",
- (flags & ENABLE_USERCLIP) ? "userclip, " : "",
- (flags & ENABLE_TEXGEN0) ? "tex-gen-0, " : "",
- (flags & ENABLE_TEXGEN1) ? "tex-gen-1, " : "",
- (flags & ENABLE_TEXGEN2) ? "tex-gen-2, " : "",
- (flags & ENABLE_TEXGEN3) ? "tex-gen-3, " : "",
- (flags & ENABLE_TEXGEN4) ? "tex-gen-4, " : "",
- (flags & ENABLE_TEXGEN5) ? "tex-gen-5, " : "",
- (flags & ENABLE_TEXGEN6) ? "tex-gen-6, " : "",
- (flags & ENABLE_TEXGEN7) ? "tex-gen-7, " : "",
- (flags & ENABLE_TEXMAT0) ? "tex-mat-0, " : "",
- (flags & ENABLE_TEXMAT1) ? "tex-mat-1, " : "",
- (flags & ENABLE_TEXMAT2) ? "tex-mat-2, " : "",
- (flags & ENABLE_TEXMAT3) ? "tex-mat-3, " : "",
- (flags & ENABLE_TEXMAT4) ? "tex-mat-4, " : "",
- (flags & ENABLE_TEXMAT5) ? "tex-mat-5, " : "",
- (flags & ENABLE_TEXMAT6) ? "tex-mat-6, " : "",
- (flags & ENABLE_TEXMAT7) ? "tex-mat-7, " : "",
- (flags & ENABLE_NORMALIZE) ? "normalize, " : "",
- (flags & ENABLE_RESCALE) ? "rescale, " : "");
-}
void _mesa_print_tri_caps( const char *name, GLuint flags )
{
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 4eff8043bc..173b4b0f22 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.47 2001/03/29 17:08:26 keithw Exp $ */
+/* $Id: enable.c,v 1.48 2001/03/29 21:16:25 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -175,7 +175,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.ClipEnabled[p] = state;
if (state) {
- ctx->_Enabled |= ENABLE_USERCLIP;
ctx->Transform._AnyClip++;
if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
@@ -189,9 +188,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p],
ctx->ProjectionMatrix.inv );
- } else {
- if (--ctx->Transform._AnyClip == 0)
- ctx->_Enabled &= ~ENABLE_USERCLIP;
}
}
break;
@@ -235,7 +231,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Enabled = state;
- ctx->_Enabled ^= ENABLE_FOG;
break;
case GL_HISTOGRAM:
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
@@ -272,7 +267,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state;
- ctx->_Enabled ^= ENABLE_LIGHT;
if ((ctx->Light.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
@@ -427,7 +421,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.Normalize = state;
- ctx->_Enabled ^= ENABLE_NORMALIZE;
break;
case GL_POINT_SMOOTH:
if (ctx->Point.SmoothFlag==state)
@@ -474,7 +467,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.RescaleNormals = state;
- ctx->_Enabled ^= ENABLE_RESCALE;
break;
case GL_SCISSOR_TEST:
if (ctx->Scissor.Enabled==state)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 66290fd7fa..8113a243d4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.37 2001/03/29 17:08:26 keithw Exp $ */
+/* $Id: mtypes.h,v 1.38 2001/03/29 21:16:25 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -703,16 +703,9 @@ struct gl_stencil_attrib {
#define TEXGEN_REFLECTION_MAP_NV 0x8
#define TEXGEN_NORMAL_MAP_NV 0x10
-#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP)
-#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \
- TEXGEN_REFLECTION_MAP_NV)
#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_MAP_NV)
-#define TEXGEN_NEED_VERTICES (TEXGEN_OBJ_LINEAR | \
- TEXGEN_EYE_LINEAR | \
- TEXGEN_REFLECTION_MAP_NV | \
- TEXGEN_SPHERE_MAP )
#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_MAP_NV | \
@@ -730,36 +723,19 @@ struct gl_stencil_attrib {
#define ENABLE_TEXGEN5 0x20
#define ENABLE_TEXGEN6 0x40
#define ENABLE_TEXGEN7 0x80
-#define ENABLE_TEXMAT0 0x100 /* Ie. not the identity matrix */
-#define ENABLE_TEXMAT1 0x200
-#define ENABLE_TEXMAT2 0x400
-#define ENABLE_TEXMAT3 0x800
-#define ENABLE_TEXMAT4 0x1000
-#define ENABLE_TEXMAT5 0x2000
-#define ENABLE_TEXMAT6 0x4000
-#define ENABLE_TEXMAT7 0x8000
-#define ENABLE_LIGHT 0x10000
-#define ENABLE_FOG 0x20000
-#define ENABLE_USERCLIP 0x40000
-#define ENABLE_NORMALIZE 0x100000
-#define ENABLE_RESCALE 0x200000
-#define ENABLE_POINT_ATTEN 0x400000
-
-
-#define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \
- ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \
- ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \
- ENABLE_TEXGEN6 | ENABLE_TEXGEN7)
-
-#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \
- ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \
- ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \
- ENABLE_TEXMAT6 | ENABLE_TEXMAT7)
+
+#define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
+#define ENABLE_TEXMAT1 0x2
+#define ENABLE_TEXMAT2 0x4
+#define ENABLE_TEXMAT3 0x8
+#define ENABLE_TEXMAT4 0x10
+#define ENABLE_TEXMAT5 0x20
+#define ENABLE_TEXMAT6 0x40
+#define ENABLE_TEXMAT7 0x80
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
-
/*
* If teximage is color-index, texelOut returns GLchan[1].
* If teximage is depth, texelOut returns GLfloat[1].
@@ -931,7 +907,10 @@ struct gl_texture_attrib {
/* = (Unit[0]._ReallyEnabled << 0) | */
/* (Unit[1]._ReallyEnabled << 4) | */
/* (Unit[2]._ReallyEnabled << 8) | etc... */
+
GLuint _GenFlags; /* for texgen */
+ GLuint _TexGenEnabled;
+ GLuint _TexMatEnabled;
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
@@ -1536,7 +1515,6 @@ struct __GLcontextRec {
GLuint NewState; /* bitwise-or of _NEW_* flags */
/* Derived */
- GLuint _Enabled; /* bitwise-or of ENABLE_* flags */
GLuint _TriangleCaps; /* bitwise-or of DD_* flags */
GLuint _ImageTransferState;/* bitwise-or of IMAGE_*_BIT flags */
GLfloat _EyeZDir[3];
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 493a96c0e9..54583c7b4e 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.30 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: points.c,v 1.31 2001/03/29 21:16:25 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -102,7 +102,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
params[2] != 0.0);
if (tmp != ctx->Point._Attenuated) {
- ctx->_Enabled ^= ENABLE_POINT_ATTEN;
ctx->_TriangleCaps ^= DD_POINT_ATTEN;
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 4ba7776f4a..5586f7e4bd 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.63 2001/03/29 17:08:26 keithw Exp $ */
+/* $Id: state.c,v 1.64 2001/03/29 21:16:25 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -712,7 +712,7 @@ update_texture_matrices( GLcontext *ctx )
{
GLuint i;
- ctx->_Enabled &= ~ENABLE_TEXMAT_ANY;
+ ctx->Texture._TexMatEnabled = 0;
for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->TextureMatrix[i].flags & MAT_DIRTY) {
@@ -723,7 +723,7 @@ update_texture_matrices( GLcontext *ctx )
if (ctx->Texture.Unit[i]._ReallyEnabled &&
ctx->TextureMatrix[i].type != MATRIX_IDENTITY)
- ctx->_Enabled |= ENABLE_TEXMAT0 << i;
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
}
}
}
@@ -746,8 +746,8 @@ update_texture_state( GLcontext *ctx )
ctx->Texture._GenFlags = 0;
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
- ctx->_Enabled &= ~(ENABLE_TEXGEN_ANY |
- ENABLE_TEXMAT_ANY);
+ ctx->Texture._TexMatEnabled = 0;
+ ctx->Texture._TexGenEnabled = 0;
/* Update texture unit state.
*/
@@ -831,12 +831,12 @@ update_texture_state( GLcontext *ctx )
texUnit->_GenFlags |= texUnit->_GenBitR;
}
- ctx->_Enabled |= ENABLE_TEXGEN0 << i;
+ ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i);
ctx->Texture._GenFlags |= texUnit->_GenFlags;
}
if (ctx->TextureMatrix[i].type != MATRIX_IDENTITY)
- ctx->_Enabled |= ENABLE_TEXMAT0 << i;
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
}
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
diff --git a/src/mesa/swrast_setup/ss_vb.c b/src/mesa/swrast_setup/ss_vb.c
index eb3e0ec3fc..f9d1d01997 100644
--- a/src/mesa/swrast_setup/ss_vb.c
+++ b/src/mesa/swrast_setup/ss_vb.c
@@ -1,4 +1,4 @@
-/* $Id: ss_vb.c,v 1.11 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: ss_vb.c,v 1.12 2001/03/29 21:16:26 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -298,7 +298,7 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx)
else
funcindex = 0;
-/* printSetupFlags("software setup func", funcindex); */
+ if (0) printSetupFlags("software setup func", funcindex);
swsetup->BuildProjVerts = setup_func[funcindex];
ASSERT(setup_func[funcindex] != rs_invalid);
}
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index cbc7778ea9..78ac09db25 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texgen.c,v 1.6 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_texgen.c,v 1.7 2001/03/29 21:16:26 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -78,7 +78,6 @@ struct texgen_stage_data {
-
static GLuint all_bits[5] = {
0,
VEC_SIZE_1,
@@ -89,6 +88,12 @@ static GLuint all_bits[5] = {
#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4)
+#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP)
+#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV)
+
+
+
/*
*/
static void build_m3(GLfloat f[][3], GLfloat m[],
@@ -532,7 +537,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if (ctx->_Enabled & ENABLE_TEXGEN(i)) {
+ if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i)))
store->TexgenFunc[i]( ctx, store, i );
@@ -595,18 +600,21 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLuint i;
stage->active = 0;
- if (ctx->_Enabled & ENABLE_TEXGEN_ANY) {
+ if (ctx->Texture._TexGenEnabled) {
GLuint inputs = 0;
GLuint outputs = 0;
- if (ctx->Texture._GenFlags & TEXGEN_NEED_VERTICES)
+ if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR)
+ inputs |= VERT_OBJ;
+
+ if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)
inputs |= VERT_EYE;
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
inputs |= VERT_NORM;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if (ctx->_Enabled & ENABLE_TEXGEN(i))
+ if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
{
outputs |= VERT_TEX(i);
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 6fd08d480b..2eb6c943d7 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texmat.c,v 1.4 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_texmat.c,v 1.5 2001/03/29 21:16:26 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -60,11 +60,11 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLuint i;
stage->active = 0;
- if (ctx->_Enabled & ENABLE_TEXMAT_ANY) {
+ if (ctx->Texture._TexMatEnabled) {
GLuint flags = 0;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if (ctx->_Enabled & ENABLE_TEXMAT(i))
+ if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
flags |= VERT_TEX(i);
stage->active = 1;
@@ -84,7 +84,7 @@ static GLboolean run_texmat_stage( GLcontext *ctx,
* identity, so we don't have to check that here.
*/
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if (ctx->_Enabled & ENABLE_TEXMAT(i)) {
+ if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
if (stage->changed_inputs & VERT_TEX(i))
(void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i],
VB->TexCoordPtr[i]);