summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2014-02-01 19:14:38 -0800
committerKenneth Graunke <kenneth@whitecape.org>2014-02-03 00:52:58 -0800
commit0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d (patch)
tree19a18b64de4bbfff6da38a854e8ef1b63d57ab2f /src/mesa/main/api_validate.c
parent81144c049bc7c12e4edcdf28f91c3c024c6e8b2b (diff)
downloadexternal_mesa3d-0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d.zip
external_mesa3d-0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d.tar.gz
external_mesa3d-0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d.tar.bz2
mesa: Rename ArrayObj to VAO and DefaultArrayObj to DefaultVAO.
When reading through the Mesa drawing code, it's not immediately obvious to me that "ArrayObj" (gl_array_object) is the Vertex Array Object (VAO) state. The comment above the structure explains this, but readers still have to remember this and translate accordingly. Out of context, "array object" is a fairly vague. Even in context, "array" has a lot of meanings: glDrawArrays, vertex data stored in user arrays, gl_client_arrays, gl_vertex_attrib_arrays, and so on. Using the term "VAO" immediately associates these fields with the OpenGL concept, clarifying the situation and aiding programmer sanity. Completely generated by: $ find . -type f -print0 | xargs -0 sed -i \ -e 's/ArrayObj;/VAO;/g' \ -e 's/->ArrayObj/->VAO/g' \ -e 's/Array\.ArrayObj/Array.VAO/g' \ -e 's/Array\.DefaultArrayObj/Array.DefaultVAO/g' v2: Rerun command to resolve conflicts with Ian's meta patches. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 6945584..41dfc38 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -113,14 +113,14 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
case API_OPENGLES2:
/* For ES2, we can draw if any vertex array is enabled (and we
* should always have a vertex program/shader). */
- if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current)
+ if (ctx->Array.VAO->_Enabled == 0x0 || !ctx->VertexProgram._Current)
return GL_FALSE;
break;
case API_OPENGLES:
/* For OpenGL ES, only draw if we have vertex positions
*/
- if (!ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
+ if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled)
return GL_FALSE;
break;
@@ -141,8 +141,8 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
/* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
* array [0]).
*/
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
- ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
+ return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
+ ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
}
}
break;
@@ -180,15 +180,15 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
memset(&ib, 0, sizeof(ib));
ib.type = type;
ib.ptr = indices;
- ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
+ ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
if ((int)(min + basevertex) < 0 ||
- max + basevertex >= ctx->Array.ArrayObj->_MaxElement) {
+ max + basevertex >= ctx->Array.VAO->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
_mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
- max, ctx->Array.ArrayObj->_MaxElement);
+ max, ctx->Array.VAO->_MaxElement);
return GL_FALSE;
}
@@ -435,10 +435,10 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
@@ -493,12 +493,12 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
for (i = 0; i < primcount; i++) {
if (index_bytes(type, count[i]) >
- ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
+ ctx->Array.VAO->ElementArrayBufferObj->Size) {
_mesa_warning(ctx,
"glMultiDrawElements index out of buffer bounds");
return GL_FALSE;
@@ -570,10 +570,10 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds");
return GL_FALSE;
}
@@ -620,7 +620,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
- if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
+ if (start + count > (GLint) ctx->Array.VAO->_MaxElement)
return GL_FALSE;
}
@@ -689,7 +689,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
- if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
+ if (first + count > (GLint) ctx->Array.VAO->_MaxElement)
return GL_FALSE;
}
@@ -769,10 +769,10 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
/* Vertex buffer object tests */
- if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
/* use indices in the buffer object */
/* make sure count doesn't go outside buffer bounds */
- if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
+ if (index_bytes(type, count) > ctx->Array.VAO->ElementArrayBufferObj->Size) {
_mesa_warning(ctx,
"glDrawElementsInstanced index out of buffer bounds");
return GL_FALSE;
@@ -901,7 +901,7 @@ valid_draw_indirect_elements(struct gl_context *ctx,
* If no element array buffer is bound, an INVALID_OPERATION error is
* generated.
*/
- if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ if (!_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no buffer bound to GL_ELEMENT_ARRAY_BUFFER)", name);
return GL_FALSE;