Remove ENABLE_* flags, ctx->_Enabled.

Replace with ctx->Texture._TexMatEnabled, ctx->Texture._TexGenEnabled.
This commit is contained in:
Keith Whitwell
2001-03-29 21:16:25 +00:00
parent 2780ed4b97
commit ed39a43b8c
8 changed files with 42 additions and 93 deletions

View File

@@ -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 * 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 ) void _mesa_print_tri_caps( const char *name, GLuint flags )
{ {

View File

@@ -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 * Mesa 3-D graphics library
@@ -175,7 +175,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.ClipEnabled[p] = state; ctx->Transform.ClipEnabled[p] = state;
if (state) { if (state) {
ctx->_Enabled |= ENABLE_USERCLIP;
ctx->Transform._AnyClip++; ctx->Transform._AnyClip++;
if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { 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], _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p], ctx->Transform.EyeUserPlane[p],
ctx->ProjectionMatrix.inv ); ctx->ProjectionMatrix.inv );
} else {
if (--ctx->Transform._AnyClip == 0)
ctx->_Enabled &= ~ENABLE_USERCLIP;
} }
} }
break; break;
@@ -235,7 +231,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return; return;
FLUSH_VERTICES(ctx, _NEW_FOG); FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Enabled = state; ctx->Fog.Enabled = state;
ctx->_Enabled ^= ENABLE_FOG;
break; break;
case GL_HISTOGRAM: case GL_HISTOGRAM:
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {
@@ -272,7 +267,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return; return;
FLUSH_VERTICES(ctx, _NEW_LIGHT); FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state; ctx->Light.Enabled = state;
ctx->_Enabled ^= ENABLE_LIGHT;
if ((ctx->Light.Enabled && if ((ctx->Light.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
@@ -427,7 +421,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return; return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.Normalize = state; ctx->Transform.Normalize = state;
ctx->_Enabled ^= ENABLE_NORMALIZE;
break; break;
case GL_POINT_SMOOTH: case GL_POINT_SMOOTH:
if (ctx->Point.SmoothFlag==state) if (ctx->Point.SmoothFlag==state)
@@ -474,7 +467,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return; return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.RescaleNormals = state; ctx->Transform.RescaleNormals = state;
ctx->_Enabled ^= ENABLE_RESCALE;
break; break;
case GL_SCISSOR_TEST: case GL_SCISSOR_TEST:
if (ctx->Scissor.Enabled==state) if (ctx->Scissor.Enabled==state)

View File

@@ -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 * Mesa 3-D graphics library
@@ -703,16 +703,9 @@ struct gl_stencil_attrib {
#define TEXGEN_REFLECTION_MAP_NV 0x8 #define TEXGEN_REFLECTION_MAP_NV 0x8
#define TEXGEN_NORMAL_MAP_NV 0x10 #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 | \ #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \ TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_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 | \ #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \ TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_MAP_NV | \ TEXGEN_NORMAL_MAP_NV | \
@@ -730,36 +723,19 @@ struct gl_stencil_attrib {
#define ENABLE_TEXGEN5 0x20 #define ENABLE_TEXGEN5 0x20
#define ENABLE_TEXGEN6 0x40 #define ENABLE_TEXGEN6 0x40
#define ENABLE_TEXGEN7 0x80 #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_TEXMAT0 0x1 /* Ie. not the identity matrix */
#define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \ #define ENABLE_TEXMAT1 0x2
ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \ #define ENABLE_TEXMAT2 0x4
ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \ #define ENABLE_TEXMAT3 0x8
ENABLE_TEXGEN6 | ENABLE_TEXGEN7) #define ENABLE_TEXMAT4 0x10
#define ENABLE_TEXMAT5 0x20
#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \ #define ENABLE_TEXMAT6 0x40
ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \ #define ENABLE_TEXMAT7 0x80
ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \
ENABLE_TEXMAT6 | ENABLE_TEXMAT7)
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
/* /*
* If teximage is color-index, texelOut returns GLchan[1]. * If teximage is color-index, texelOut returns GLchan[1].
* If teximage is depth, texelOut returns GLfloat[1]. * If teximage is depth, texelOut returns GLfloat[1].
@@ -931,7 +907,10 @@ struct gl_texture_attrib {
/* = (Unit[0]._ReallyEnabled << 0) | */ /* = (Unit[0]._ReallyEnabled << 0) | */
/* (Unit[1]._ReallyEnabled << 4) | */ /* (Unit[1]._ReallyEnabled << 4) | */
/* (Unit[2]._ReallyEnabled << 8) | etc... */ /* (Unit[2]._ReallyEnabled << 8) | etc... */
GLuint _GenFlags; /* for texgen */ GLuint _GenFlags; /* for texgen */
GLuint _TexGenEnabled;
GLuint _TexMatEnabled;
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
@@ -1536,7 +1515,6 @@ struct __GLcontextRec {
GLuint NewState; /* bitwise-or of _NEW_* flags */ GLuint NewState; /* bitwise-or of _NEW_* flags */
/* Derived */ /* Derived */
GLuint _Enabled; /* bitwise-or of ENABLE_* flags */
GLuint _TriangleCaps; /* bitwise-or of DD_* flags */ GLuint _TriangleCaps; /* bitwise-or of DD_* flags */
GLuint _ImageTransferState;/* bitwise-or of IMAGE_*_BIT flags */ GLuint _ImageTransferState;/* bitwise-or of IMAGE_*_BIT flags */
GLfloat _EyeZDir[3]; GLfloat _EyeZDir[3];

View File

@@ -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 * Mesa 3-D graphics library
@@ -102,7 +102,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
params[2] != 0.0); params[2] != 0.0);
if (tmp != ctx->Point._Attenuated) { if (tmp != ctx->Point._Attenuated) {
ctx->_Enabled ^= ENABLE_POINT_ATTEN;
ctx->_TriangleCaps ^= DD_POINT_ATTEN; ctx->_TriangleCaps ^= DD_POINT_ATTEN;
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN; ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -712,7 +712,7 @@ update_texture_matrices( GLcontext *ctx )
{ {
GLuint i; GLuint i;
ctx->_Enabled &= ~ENABLE_TEXMAT_ANY; ctx->Texture._TexMatEnabled = 0;
for (i=0; i < ctx->Const.MaxTextureUnits; i++) { for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->TextureMatrix[i].flags & MAT_DIRTY) { if (ctx->TextureMatrix[i].flags & MAT_DIRTY) {
@@ -723,7 +723,7 @@ update_texture_matrices( GLcontext *ctx )
if (ctx->Texture.Unit[i]._ReallyEnabled && if (ctx->Texture.Unit[i]._ReallyEnabled &&
ctx->TextureMatrix[i].type != MATRIX_IDENTITY) 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->Texture._GenFlags = 0;
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN; ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN; ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
ctx->_Enabled &= ~(ENABLE_TEXGEN_ANY | ctx->Texture._TexMatEnabled = 0;
ENABLE_TEXMAT_ANY); ctx->Texture._TexGenEnabled = 0;
/* Update texture unit state. /* Update texture unit state.
*/ */
@@ -831,12 +831,12 @@ update_texture_state( GLcontext *ctx )
texUnit->_GenFlags |= texUnit->_GenBitR; texUnit->_GenFlags |= texUnit->_GenBitR;
} }
ctx->_Enabled |= ENABLE_TEXGEN0 << i; ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i);
ctx->Texture._GenFlags |= texUnit->_GenFlags; ctx->Texture._GenFlags |= texUnit->_GenFlags;
} }
if (ctx->TextureMatrix[i].type != MATRIX_IDENTITY) 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) { if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {

View File

@@ -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 * Mesa 3-D graphics library
@@ -298,7 +298,7 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx)
else else
funcindex = 0; funcindex = 0;
/* printSetupFlags("software setup func", funcindex); */ if (0) printSetupFlags("software setup func", funcindex);
swsetup->BuildProjVerts = setup_func[funcindex]; swsetup->BuildProjVerts = setup_func[funcindex];
ASSERT(setup_func[funcindex] != rs_invalid); ASSERT(setup_func[funcindex] != rs_invalid);
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -78,7 +78,6 @@ struct texgen_stage_data {
static GLuint all_bits[5] = { static GLuint all_bits[5] = {
0, 0,
VEC_SIZE_1, 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 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[], static void build_m3(GLfloat f[][3], GLfloat m[],
@@ -532,7 +537,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
GLuint i; GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; 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))) if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i)))
store->TexgenFunc[i]( ctx, store, i ); store->TexgenFunc[i]( ctx, store, i );
@@ -595,18 +600,21 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLuint i; GLuint i;
stage->active = 0; stage->active = 0;
if (ctx->_Enabled & ENABLE_TEXGEN_ANY) { if (ctx->Texture._TexGenEnabled) {
GLuint inputs = 0; GLuint inputs = 0;
GLuint outputs = 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; inputs |= VERT_EYE;
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
inputs |= VERT_NORM; inputs |= VERT_NORM;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) 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); outputs |= VERT_TEX(i);

View File

@@ -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 * Mesa 3-D graphics library
@@ -60,11 +60,11 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLuint i; GLuint i;
stage->active = 0; stage->active = 0;
if (ctx->_Enabled & ENABLE_TEXMAT_ANY) { if (ctx->Texture._TexMatEnabled) {
GLuint flags = 0; GLuint flags = 0;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) 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); flags |= VERT_TEX(i);
stage->active = 1; stage->active = 1;
@@ -84,7 +84,7 @@ static GLboolean run_texmat_stage( GLcontext *ctx,
* identity, so we don't have to check that here. * identity, so we don't have to check that here.
*/ */
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) 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)) if (stage->changed_inputs & VERT_TEX(i))
(void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i], (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i],
VB->TexCoordPtr[i]); VB->TexCoordPtr[i]);