[Mesa-dev] [PATCH 02/10] mesa: Replace _NEW_ARRAY_* bits with VERT_BIT_*
Mathias Fröhlich
Mathias.Froehlich at gmx.net
Fri Nov 11 09:07:54 PST 2011
Consolidate the two distinct set of flags to use VERT_BIT_*.
---
src/mesa/main/arrayobj.c | 2 +-
src/mesa/main/enable.c | 20 ++++++++++----------
src/mesa/main/mtypes.h | 37 ++-----------------------------------
src/mesa/main/varray.c | 36 ++++++++++++++++++------------------
4 files changed, 31 insertions(+), 64 deletions(-)
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 1283940..5524f1f 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -380,7 +380,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id,
GLboolean genRequired)
}
ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
+ ctx->Array.NewState |= VERT_BIT_ALL;
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj);
/* Pass BindVertexArray call to device driver */
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b2c7724..e9b7fa0 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -60,41 +60,41 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean
state)
switch (cap) {
case GL_VERTEX_ARRAY:
var = &arrayObj->Vertex.Enabled;
- flag = _NEW_ARRAY_VERTEX;
+ flag = VERT_BIT_POS;
break;
case GL_NORMAL_ARRAY:
var = &arrayObj->Normal.Enabled;
- flag = _NEW_ARRAY_NORMAL;
+ flag = VERT_BIT_NORMAL;
break;
case GL_COLOR_ARRAY:
var = &arrayObj->Color.Enabled;
- flag = _NEW_ARRAY_COLOR0;
+ flag = VERT_BIT_COLOR0;
break;
case GL_INDEX_ARRAY:
var = &arrayObj->Index.Enabled;
- flag = _NEW_ARRAY_INDEX;
+ flag = VERT_BIT_COLOR_INDEX;
break;
case GL_TEXTURE_COORD_ARRAY:
var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
- flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
+ flag = VERT_BIT_TEX(ctx->Array.ActiveTexture);
break;
case GL_EDGE_FLAG_ARRAY:
var = &arrayObj->EdgeFlag.Enabled;
- flag = _NEW_ARRAY_EDGEFLAG;
+ flag = VERT_BIT_EDGEFLAG;
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
var = &arrayObj->FogCoord.Enabled;
- flag = _NEW_ARRAY_FOGCOORD;
+ flag = VERT_BIT_FOG;
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
var = &arrayObj->SecondaryColor.Enabled;
- flag = _NEW_ARRAY_COLOR1;
+ flag = VERT_BIT_COLOR1;
break;
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_OES:
var = &arrayObj->PointSize.Enabled;
- flag = _NEW_ARRAY_POINT_SIZE;
+ flag = VERT_BIT_POINT_SIZE;
break;
#endif
@@ -120,7 +120,7 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean
state)
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
var = &arrayObj->VertexAttrib[n].Enabled;
- flag = _NEW_ARRAY_ATTRIB(n);
+ flag = VERT_BIT_GENERIC(n);
}
break;
#endif /* FEATURE_NV_vertex_program */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3dbe1fe..19a8e5d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1648,7 +1648,7 @@ struct gl_array_object
*/
struct gl_client_array VertexAttrib[MAX_VERTEX_GENERIC_ATTRIBS];
- /** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */
+ /** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield _Enabled;
/**
@@ -1681,7 +1681,7 @@ struct gl_array_attrib
GLboolean PrimitiveRestart;
GLuint RestartIndex;
- GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */
+ GLbitfield NewState; /**< mask of VERT_BIT_* values */
GLboolean RebindArrays; /**< whether the VBO module should rebind arrays
*/
/* GL_ARB_vertex_buffer_object */
@@ -3077,39 +3077,6 @@ struct gl_matrix_stack
/**
- * \name Bits to track array state changes
- *
- * Also used to summarize array enabled.
- */
-/*@{*/
-#define _NEW_ARRAY_VERTEX VERT_BIT_POS
-#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
-#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
-#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
-#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
-#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
-#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
-#define _NEW_ARRAY_EDGEFLAG VERT_BIT_EDGEFLAG
-#define _NEW_ARRAY_POINT_SIZE VERT_BIT_COLOR_INDEX /* aliased */
-#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
-#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
-#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
-#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
-#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
-#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
-#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
-#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0 VERT_BIT_GENERIC0 /* start at bit 16 */
-#define _NEW_ARRAY_ALL 0xffffffff
-
-
-#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
-#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
-/*@}*/
-
-
-
-/**
* \name A bunch of flags that we think might be useful to drivers.
*
* Set in the __struct gl_contextRec::_TriangleCaps bitfield.
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index f1a57c1..b85ab49 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -238,7 +238,7 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei
stride, const GLvoid *ptr)
legalTypes |= BYTE_BIT;
update_array(ctx, "glVertexPointer",
- &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX,
+ &ctx->Array.ArrayObj->Vertex, VERT_BIT_POS,
legalTypes, 2, 4,
size, type, stride, GL_FALSE, GL_FALSE, ptr);
}
@@ -256,7 +256,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const
GLvoid *ptr )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glNormalPointer",
- &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
+ &ctx->Array.ArrayObj->Normal, VERT_BIT_NORMAL,
legalTypes, 3, 3,
3, type, stride, GL_TRUE, GL_FALSE, ptr);
}
@@ -276,7 +276,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei
stride, const GLvoid *ptr)
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glColorPointer",
- &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
+ &ctx->Array.ArrayObj->Color, VERT_BIT_COLOR0,
legalTypes, 3, BGRA_OR_4,
size, type, stride, GL_TRUE, GL_FALSE, ptr);
}
@@ -290,7 +290,7 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride,
const GLvoid *ptr)
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glFogCoordPointer",
- &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
+ &ctx->Array.ArrayObj->FogCoord, VERT_BIT_FOG,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
@@ -305,7 +305,7 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const
GLvoid *ptr)
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glIndexPointer",
- &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
+ &ctx->Array.ArrayObj->Index, VERT_BIT_COLOR_INDEX,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
@@ -325,7 +325,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glSecondaryColorPointer",
- &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1,
+ &ctx->Array.ArrayObj->SecondaryColor, VERT_BIT_COLOR1,
legalTypes, 3, BGRA_OR_4,
size, type, stride, GL_TRUE, GL_FALSE, ptr);
}
@@ -351,7 +351,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei
stride,
update_array(ctx, "glTexCoordPointer",
&ctx->Array.ArrayObj->TexCoord[unit],
- _NEW_ARRAY_TEXCOORD(unit),
+ VERT_BIT_TEX(unit),
legalTypes, 1, 4,
size, type, stride, GL_FALSE, GL_FALSE,
ptr);
@@ -368,7 +368,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glEdgeFlagPointer",
- &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
+ &ctx->Array.ArrayObj->EdgeFlag, VERT_BIT_EDGEFLAG,
legalTypes, 1, 1,
1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr);
}
@@ -388,7 +388,7 @@ _mesa_PointSizePointer(GLenum type, GLsizei stride, const
GLvoid *ptr)
}
update_array(ctx, "glPointSizePointer",
- &ctx->Array.ArrayObj->PointSize, _NEW_ARRAY_POINT_SIZE,
+ &ctx->Array.ArrayObj->PointSize, VERT_BIT_POINT_SIZE,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
@@ -423,7 +423,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size,
GLenum type,
update_array(ctx, "glVertexAttribPointerNV",
&ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
+ VERT_BIT_GENERIC(index),
legalTypes, 1, BGRA_OR_4,
size, type, stride, normalized, GL_FALSE, ptr);
}
@@ -458,7 +458,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size,
GLenum type,
update_array(ctx, "glVertexAttribPointer",
&ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
+ VERT_BIT_GENERIC(index),
legalTypes, 1, BGRA_OR_4,
size, type, stride, normalized, GL_FALSE, ptr);
}
@@ -490,7 +490,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size,
GLenum type,
update_array(ctx, "glVertexAttribIPointer",
&ctx->Array.ArrayObj->VertexAttrib[index],
- _NEW_ARRAY_ATTRIB(index),
+ VERT_BIT_GENERIC(index),
legalTypes, 1, 4,
size, type, stride, normalized, integer, ptr);
}
@@ -513,8 +513,8 @@ _mesa_EnableVertexAttribArrayARB(GLuint index)
FLUSH_VERTICES(ctx, _NEW_ARRAY);
ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE;
- ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index);
- ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+ ctx->Array.ArrayObj->_Enabled |= VERT_BIT_GENERIC(index);
+ ctx->Array.NewState |= VERT_BIT_GENERIC(index);
}
@@ -534,8 +534,8 @@ _mesa_DisableVertexAttribArrayARB(GLuint index)
FLUSH_VERTICES(ctx, _NEW_ARRAY);
ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE;
- ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index);
- ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+ ctx->Array.ArrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
+ ctx->Array.NewState |= VERT_BIT_GENERIC(index);
}
@@ -1004,7 +1004,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count)
ctx->Array.LockCount = count;
ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
+ ctx->Array.NewState |= VERT_BIT_ALL;
}
@@ -1025,7 +1025,7 @@ _mesa_UnlockArraysEXT( void )
ctx->Array.LockFirst = 0;
ctx->Array.LockCount = 0;
ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= _NEW_ARRAY_ALL;
+ ctx->Array.NewState |= VERT_BIT_ALL;
}
--
1.7.4.4
More information about the mesa-dev
mailing list