Browse Source

Remove ENABLE_* flags, ctx->_Enabled.

Replace with ctx->Texture._TexMatEnabled, ctx->Texture._TexGenEnabled.
tags/mesa_3_5
Keith Whitwell 24 years ago
parent
commit
ed39a43b8c

+ 1
- 29
src/mesa/main/debug.c View File

/* $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
} }




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 )
{ {

+ 1
- 9
src/mesa/main/enable.c View File

/* $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
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) {
_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;
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) {
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)
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)
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)

+ 13
- 35
src/mesa/main/mtypes.h View File

/* $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
#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 | \
#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_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_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].
/* = (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];


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];

+ 1
- 2
src/mesa/main/points.c View File

/* $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
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;
} }

+ 7
- 7
src/mesa/main/state.c View File

/* $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
{ {
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) {


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);
} }
} }
} }
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 |
ENABLE_TEXMAT_ANY);
ctx->Texture._TexMatEnabled = 0;
ctx->Texture._TexGenEnabled = 0;


/* Update texture unit state. /* Update texture unit state.
*/ */
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) {

+ 2
- 2
src/mesa/swrast_setup/ss_vb.c View File

/* $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
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);
} }

+ 14
- 6
src/mesa/tnl/t_vb_texgen.c View File

/* $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







static GLuint all_bits[5] = { static GLuint all_bits[5] = {
0, 0,
VEC_SIZE_1, VEC_SIZE_1,


#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[],
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 );


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);



+ 4
- 4
src/mesa/tnl/t_vb_texmat.c View File

/* $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
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;
* 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]);

Loading…
Cancel
Save