diff options
author | Kenneth Graunke <[email protected]> | 2014-02-01 19:14:38 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-02-03 00:52:58 -0800 |
commit | 0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d (patch) | |
tree | 19a18b64de4bbfff6da38a854e8ef1b63d57ab2f /src/mesa/main | |
parent | 81144c049bc7c12e4edcdf28f91c3c024c6e8b2b (diff) |
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 <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/api_arrayelt.c | 4 | ||||
-rw-r--r-- | src/mesa/main/api_validate.c | 36 | ||||
-rw-r--r-- | src/mesa/main/arrayobj.c | 8 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 32 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 8 | ||||
-rw-r--r-- | src/mesa/main/context.c | 4 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 20 | ||||
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 2 | ||||
-rw-r--r-- | src/mesa/main/get.c | 18 | ||||
-rw-r--r-- | src/mesa/main/getstring.c | 18 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/state.c | 6 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 54 |
13 files changed, 107 insertions, 107 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index f439b706853..09f314b8e45 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1472,7 +1472,7 @@ check_vbo(AEcontext *actx, struct gl_buffer_object *vbo) static inline void update_derived_client_arrays(struct gl_context *ctx) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; if (arrayObj->NewArrays) { _mesa_update_array_object_client_arrays(ctx, arrayObj); @@ -1494,7 +1494,7 @@ _ae_update_state(struct gl_context *ctx) AEarray *aa = actx->arrays; /* non-indexed arrays (ex: glNormal) */ AEattrib *at = actx->attribs; /* indexed arrays (ex: glMultiTexCoord) */ GLuint i; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; actx->nr_vbos = 0; diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 6945584433e..41dfc3806e5 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; diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index fdcf172eae2..9b4e7dd881e 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -376,7 +376,7 @@ _mesa_update_array_object_client_arrays(struct gl_context *ctx, static void bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) { - struct gl_array_object * const oldObj = ctx->Array.ArrayObj; + struct gl_array_object * const oldObj = ctx->Array.VAO; struct gl_array_object *newObj = NULL; ASSERT(oldObj != NULL); @@ -391,7 +391,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) /* The spec says there is no array object named 0, but we use * one internally because it simplifies things. */ - newObj = ctx->Array.DefaultArrayObj; + newObj = ctx->Array.DefaultVAO; } else { /* non-default array object */ @@ -426,7 +426,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) } ctx->NewState |= _NEW_ARRAY; - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj); + _mesa_reference_array_object(ctx, &ctx->Array.VAO, newObj); /* Pass BindVertexArray call to device driver */ if (ctx->Driver.BindArrayObject && newObj) @@ -491,7 +491,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) * for that object reverts to zero and the default vertex array * becomes current." */ - if ( obj == ctx->Array.ArrayObj ) { + if ( obj == ctx->Array.VAO ) { _mesa_BindVertexArray(0); } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 7b7cf0ef3d1..53528cf9fe1 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1483,7 +1483,7 @@ copy_array_attrib(struct gl_context *ctx, /* skip RebindArrays */ if (!vbo_deleted) - copy_array_object(ctx, dest->ArrayObj, src->ArrayObj); + copy_array_object(ctx, dest->VAO, src->VAO); /* skip ArrayBufferObj */ /* skip ElementArrayBufferObj */ @@ -1499,15 +1499,15 @@ save_array_attrib(struct gl_context *ctx, { /* Set the Name, needed for restore, but do never overwrite. * Needs to match value in the object hash. */ - dest->ArrayObj->Name = src->ArrayObj->Name; + dest->VAO->Name = src->VAO->Name; /* And copy all of the rest. */ copy_array_attrib(ctx, dest, src, false); /* Just reference them here */ _mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj, src->ArrayBufferObj); - _mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj, - src->ArrayObj->ElementArrayBufferObj); + _mesa_reference_buffer_object(ctx, &dest->VAO->ElementArrayBufferObj, + src->VAO->ElementArrayBufferObj); } /** @@ -1530,13 +1530,13 @@ restore_array_attrib(struct gl_context *ctx, * The semantics of objects created using APPLE_vertex_array_objects behave * differently. These objects expect to be recreated by pop. Alas. */ - const bool arb_vao = (src->ArrayObj->Name != 0 - && src->ArrayObj->ARBsemantics); + const bool arb_vao = (src->VAO->Name != 0 + && src->VAO->ARBsemantics); - if (arb_vao && !_mesa_IsVertexArray(src->ArrayObj->Name)) + if (arb_vao && !_mesa_IsVertexArray(src->VAO->Name)) return; - _mesa_BindVertexArrayAPPLE(src->ArrayObj->Name); + _mesa_BindVertexArrayAPPLE(src->VAO->Name); /* Restore or recreate the buffer objects by the names ... */ if (!arb_vao @@ -1552,10 +1552,10 @@ restore_array_attrib(struct gl_context *ctx, } if (!arb_vao - || src->ArrayObj->ElementArrayBufferObj->Name == 0 - || _mesa_IsBuffer(src->ArrayObj->ElementArrayBufferObj->Name)) + || src->VAO->ElementArrayBufferObj->Name == 0 + || _mesa_IsBuffer(src->VAO->ElementArrayBufferObj->Name)) _mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, - src->ArrayObj->ElementArrayBufferObj->Name); + src->VAO->ElementArrayBufferObj->Name); } /** @@ -1567,14 +1567,14 @@ init_array_attrib_data(struct gl_context *ctx, struct gl_array_attrib *attrib) { /* Get a non driver gl_array_object. */ - attrib->ArrayObj = CALLOC_STRUCT( gl_array_object ); + attrib->VAO = CALLOC_STRUCT( gl_array_object ); - if (attrib->ArrayObj == NULL) { + if (attrib->VAO == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib"); return false; } - _mesa_initialize_array_object(ctx, attrib->ArrayObj, 0); + _mesa_initialize_array_object(ctx, attrib->VAO, 0); return true; } @@ -1589,8 +1589,8 @@ free_array_attrib_data(struct gl_context *ctx, { /* We use a non driver array object, so don't just unref since we would * end up using the drivers DeleteArrayObject function for deletion. */ - _mesa_delete_array_object(ctx, attrib->ArrayObj); - attrib->ArrayObj = 0; + _mesa_delete_array_object(ctx, attrib->VAO); + attrib->VAO = 0; _mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL); } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 1f0c683f817..eb2fd688590 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -80,7 +80,7 @@ get_buffer_target(struct gl_context *ctx, GLenum target) case GL_ARRAY_BUFFER_ARB: return &ctx->Array.ArrayBufferObj; case GL_ELEMENT_ARRAY_BUFFER_ARB: - return &ctx->Array.ArrayObj->ElementArrayBufferObj; + return &ctx->Array.VAO->ElementArrayBufferObj; case GL_PIXEL_PACK_BUFFER_EXT: return &ctx->Pack.BufferObj; case GL_PIXEL_UNPACK_BUFFER_EXT: @@ -451,8 +451,8 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, #if 0 /* unfortunately, these tests are invalid during context tear-down */ ASSERT(ctx->Array.ArrayBufferObj != bufObj); - ASSERT(ctx->Array.ArrayObj->ElementArrayBufferObj != bufObj); - ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); + ASSERT(ctx->Array.VAO->ElementArrayBufferObj != bufObj); + ASSERT(ctx->Array.VAO->Vertex.BufferObj != bufObj); #endif ASSERT(ctx->Driver.DeleteBuffer); @@ -1082,7 +1082,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]); if (bufObj) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; GLuint j; ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b818ab41a6b..b8c02d01dfa 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1188,8 +1188,8 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, NULL); - _mesa_reference_array_object(ctx, &ctx->Array.DefaultArrayObj, NULL); + _mesa_reference_array_object(ctx, &ctx->Array.VAO, NULL); + _mesa_reference_array_object(ctx, &ctx->Array.DefaultVAO, NULL); _mesa_free_attrib_data(ctx); _mesa_free_buffer_objects(ctx); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 640db84906e..04552f71e31 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -63,7 +63,7 @@ update_derived_primitive_restart_state(struct gl_context *ctx) static void client_state(struct gl_context *ctx, GLenum cap, GLboolean state) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; GLbitfield64 flag; GLboolean *var; @@ -1423,41 +1423,41 @@ _mesa_IsEnabled( GLenum cap ) case GL_VERTEX_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled; case GL_NORMAL_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; case GL_COLOR_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; case GL_INDEX_ARRAY: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj-> + return ctx->Array.VAO-> VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; case GL_TEXTURE_COORD_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj-> + return ctx->Array.VAO-> VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled; case GL_EDGE_FLAG_ARRAY: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; case GL_FOG_COORDINATE_ARRAY_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_FOG].Enabled; case GL_SECONDARY_COLOR_ARRAY_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; case GL_POINT_SIZE_ARRAY_OES: if (ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 4d71c55ee9f..c5583c9657c 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -228,7 +228,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) if (ctx->Point._Attenuated) key->point_attenuated = 1; - if (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) + if (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) key->point_array = 1; if (ctx->Texture._TexGenEnabled || diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 3016f41e42f..a74e13d7a94 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -642,7 +642,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: - array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; + array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; v->value_int = *(GLuint *) ((char *) array + d->offset); break; @@ -828,7 +828,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: buffer_obj = (struct gl_buffer_object **) - ((char *) ctx->Array.ArrayObj + d->offset); + ((char *) ctx->Array.VAO + d->offset); v->value_int = (*buffer_obj)->Name; break; case GL_ARRAY_BUFFER_BINDING_ARB: @@ -836,10 +836,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: v->value_int = - ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name; + ctx->Array.VAO->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name; break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name; + v->value_int = ctx->Array.VAO->ElementArrayBufferObj->Name; break; /* ARB_copy_buffer */ @@ -880,7 +880,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; break; case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name; break; case GL_FOG_COLOR: @@ -1188,7 +1188,7 @@ find_value(const char *func, GLenum pname, void **p, union value *v) *p = ((char *) ctx + d->offset); return d; case LOC_ARRAY: - *p = ((char *) ctx->Array.ArrayObj + d->offset); + *p = ((char *) ctx->Array.VAO + d->offset); return d; case LOC_TEXUNIT: unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1851,7 +1851,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor; return TYPE_INT; case GL_VERTEX_BINDING_OFFSET: @@ -1859,7 +1859,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset; return TYPE_INT; case GL_VERTEX_BINDING_STRIDE: @@ -1867,7 +1867,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; /* ARB_shader_image_load_store */ case GL_IMAGE_BINDING_NAME: { diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index b66e24788a4..6741267026b 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -200,42 +200,42 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_VERTEX_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr; break; case GL_NORMAL_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; break; case GL_COLOR_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; break; case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; break; case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_FOG].Ptr; break; case GL_INDEX_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; break; case GL_TEXTURE_COORD_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr; break; case GL_EDGE_FLAG_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; break; case GL_FEEDBACK_BUFFER_POINTER: if (ctx->API != API_OPENGL_COMPAT) @@ -250,7 +250,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_POINT_SIZE_ARRAY_POINTER_OES: if (ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr; break; case GL_DEBUG_CALLBACK_FUNCTION_ARB: if (!_mesa_is_desktop_gl(ctx)) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 925d204b3f5..f97cfc2e1fa 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1615,10 +1615,10 @@ struct gl_array_object struct gl_array_attrib { /** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */ - struct gl_array_object *ArrayObj; + struct gl_array_object *VAO; /** The default vertex array object */ - struct gl_array_object *DefaultArrayObj; + struct gl_array_object *DefaultVAO; /** Array objects (GL_ARB/APPLE_vertex_array_object) */ struct _mesa_HashTable *Objects; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index bdebbc14104..b6593dd1a0b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -417,11 +417,11 @@ _mesa_update_state_locked( struct gl_context *ctx ) } if (new_state & _NEW_ARRAY) - _mesa_update_array_object_client_arrays(ctx, ctx->Array.ArrayObj); + _mesa_update_array_object_client_arrays(ctx, ctx->Array.VAO); if (ctx->Const.CheckArrayBounds && new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) { - _mesa_update_array_object_max_element(ctx, ctx->Array.ArrayObj); + _mesa_update_array_object_max_element(ctx, ctx->Array.VAO); } out: @@ -439,7 +439,7 @@ _mesa_update_state_locked( struct gl_context *ctx ) new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); - ctx->Array.ArrayObj->NewArrays = 0x0; + ctx->Array.VAO->NewArrays = 0x0; } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index b73a396e25d..d4e50c3ff31 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -112,7 +112,7 @@ static void vertex_attrib_binding(struct gl_context *ctx, GLuint attribIndex, GLuint bindingIndex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; struct gl_vertex_attrib_array *array = &arrayObj->VertexAttrib[attribIndex]; if (array->VertexBinding != bindingIndex) { @@ -139,7 +139,7 @@ bind_vertex_buffer(struct gl_context *ctx, GLuint index, struct gl_buffer_object *vbo, GLintptr offset, GLsizei stride) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; struct gl_vertex_buffer_binding *binding = &arrayObj->VertexBinding[index]; if (binding->BufferObj != vbo || @@ -166,7 +166,7 @@ static void vertex_binding_divisor(struct gl_context *ctx, GLuint bindingIndex, GLuint divisor) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; struct gl_vertex_buffer_binding *binding = &arrayObj->VertexBinding[bindingIndex]; @@ -329,7 +329,7 @@ update_array_format(struct gl_context *ctx, elementSize = _mesa_bytes_per_vertex_attrib(size, type); assert(elementSize != -1); - array = &ctx->Array.ArrayObj->VertexAttrib[attrib]; + array = &ctx->Array.VAO->VertexAttrib[attrib]; array->Size = size; array->Type = type; array->Format = format; @@ -338,7 +338,7 @@ update_array_format(struct gl_context *ctx, array->RelativeOffset = relativeOffset; array->_ElementSize = elementSize; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib); + ctx->Array.VAO->NewArrays |= VERT_BIT(attrib); ctx->NewState |= _NEW_ARRAY; return true; @@ -384,7 +384,7 @@ update_array(struct gl_context *ctx, * The check for VBOs is handled below. */ if (ctx->API == API_OPENGL_CORE - && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) { + && (ctx->Array.VAO == ctx->Array.DefaultVAO)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)", func); return; @@ -407,7 +407,7 @@ update_array(struct gl_context *ctx, * to the ARRAY_BUFFER buffer object binding point (see section * 2.9.6), and the pointer argument is not NULL." */ - if (ptr != NULL && ctx->Array.ArrayObj->ARBsemantics && + if (ptr != NULL && ctx->Array.VAO->ARBsemantics && !_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func); return; @@ -422,7 +422,7 @@ update_array(struct gl_context *ctx, vertex_attrib_binding(ctx, attrib, attrib); /* The Stride and Ptr fields are not set by update_array_format() */ - array = &ctx->Array.ArrayObj->VertexAttrib[attrib]; + array = &ctx->Array.VAO->VertexAttrib[attrib]; array->Stride = stride; array->Ptr = (const GLvoid *) ptr; @@ -673,7 +673,7 @@ _mesa_EnableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + arrayObj = ctx->Array.VAO; ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); @@ -699,7 +699,7 @@ _mesa_DisableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + arrayObj = ctx->Array.VAO; ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); @@ -722,7 +722,7 @@ static GLuint get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, const char *caller) { - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + const struct gl_array_object *arrayObj = ctx->Array.VAO; const struct gl_vertex_attrib_array *array; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -801,7 +801,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function) return NULL; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); FLUSH_CURRENT(ctx, 0); return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)]; @@ -923,9 +923,9 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) return; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); - *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; + *pointer = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; } @@ -1314,7 +1314,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) return; } - ASSERT(genericIndex < Elements(ctx->Array.ArrayObj->VertexAttrib)); + ASSERT(genericIndex < Elements(ctx->Array.VAO->VertexAttrib)); /* The ARB_vertex_attrib_binding spec says: * @@ -1365,7 +1365,7 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, GLsizei stride) { GET_CURRENT_CONTEXT(ctx); - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + const struct gl_array_object *arrayObj = ctx->Array.VAO; struct gl_buffer_object *vbo; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1376,7 +1376,7 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexBuffer(No array object bound)"); return; @@ -1468,7 +1468,7 @@ _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, * - ..." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribFormat(No array object bound)"); return; @@ -1515,7 +1515,7 @@ _mesa_VertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type, * - ..." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribIFormat(No array object bound)"); return; @@ -1563,7 +1563,7 @@ _mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type, * that this is an oversight. */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribLFormat(No array object bound)"); return; @@ -1603,7 +1603,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribBinding(No array object bound)"); return; @@ -1633,7 +1633,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) } ASSERT(VERT_ATTRIB_GENERIC(attribIndex) < - Elements(ctx->Array.ArrayObj->VertexAttrib)); + Elements(ctx->Array.VAO->VertexAttrib)); vertex_attrib_binding(ctx, VERT_ATTRIB_GENERIC(attribIndex), VERT_ATTRIB_GENERIC(bindingIndex)); @@ -1657,7 +1657,7 @@ _mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor) * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexBindingDivisor(No array object bound)"); return; @@ -1758,7 +1758,7 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) void _mesa_print_arrays(struct gl_context *ctx) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; GLuint i; _mesa_update_array_object_max_element(ctx, arrayObj); @@ -1786,9 +1786,9 @@ _mesa_print_arrays(struct gl_context *ctx) void _mesa_init_varray(struct gl_context *ctx) { - ctx->Array.DefaultArrayObj = ctx->Driver.NewArrayObject(ctx, 0); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, - ctx->Array.DefaultArrayObj); + ctx->Array.DefaultVAO = ctx->Driver.NewArrayObject(ctx, 0); + _mesa_reference_array_object(ctx, &ctx->Array.VAO, + ctx->Array.DefaultVAO); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ ctx->Array.Objects = _mesa_NewHashTable(); |