From 0dfe50f1a6cc5e1f979ac65cca4ed9359d18869d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 1 Feb 2014 19:14:38 -0800 Subject: 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 Reviewed-by: Jordan Justen Reviewed-by: Ian Romanick Reviewed-by: Brian Paul --- src/mesa/drivers/common/meta.c | 138 ++++++++++++++++++++--------------------- src/mesa/main/api_arrayelt.c | 4 +- src/mesa/main/api_validate.c | 36 +++++------ src/mesa/main/arrayobj.c | 8 +-- src/mesa/main/attrib.c | 32 +++++----- src/mesa/main/bufferobj.c | 8 +-- src/mesa/main/context.c | 4 +- src/mesa/main/enable.c | 20 +++--- src/mesa/main/ffvertex_prog.c | 2 +- src/mesa/main/get.c | 18 +++--- src/mesa/main/getstring.c | 18 +++--- src/mesa/main/mtypes.h | 4 +- src/mesa/main/state.c | 6 +- src/mesa/main/varray.c | 54 ++++++++-------- src/mesa/vbo/vbo_exec_array.c | 42 ++++++------- src/mesa/vbo/vbo_save_api.c | 4 +- 16 files changed, 199 insertions(+), 199 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 8d9a037f92d..f4995db594e 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -164,7 +164,7 @@ struct save_state GLuint EnvMode; /* unit[0] only */ /** MESA_META_VERTEX */ - struct gl_array_object *ArrayObj; + struct gl_array_object *VAO; struct gl_buffer_object *ArrayBufferObj; /** MESA_META_VIEWPORT */ @@ -221,7 +221,7 @@ struct temp_texture */ struct blit_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint DepthFP; GLuint ShaderProg; @@ -235,7 +235,7 @@ struct blit_state */ struct clear_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint ShaderProg; GLint ColorLocation; @@ -252,7 +252,7 @@ struct clear_state */ struct copypix_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; }; @@ -262,7 +262,7 @@ struct copypix_state */ struct drawpix_state { - GLuint ArrayObj; + GLuint VAO; GLuint StencilFP; /**< Fragment program for drawing stencil images */ GLuint DepthFP; /**< Fragment program for drawing depth images */ @@ -274,7 +274,7 @@ struct drawpix_state */ struct bitmap_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; struct temp_texture Tex; /**< separate texture from other meta ops */ }; @@ -295,7 +295,7 @@ struct glsl_sampler { */ struct gen_mipmap_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint FBO; GLuint Sampler; @@ -313,7 +313,7 @@ struct gen_mipmap_state */ struct decompress_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO, FBO, RBO, Sampler; GLint Width, Height; }; @@ -323,7 +323,7 @@ struct decompress_state */ struct drawtex_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; }; @@ -729,8 +729,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) if (state & MESA_META_VERTEX) { /* save vertex array object state */ - _mesa_reference_array_object(ctx, &save->ArrayObj, - ctx->Array.ArrayObj); + _mesa_reference_array_object(ctx, &save->VAO, + ctx->Array.VAO); _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, ctx->Array.ArrayBufferObj); /* set some default state? */ @@ -1095,8 +1095,8 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL); /* restore vertex array object */ - _mesa_BindVertexArray(save->ArrayObj->Name); - _mesa_reference_array_object(ctx, &save->ArrayObj, NULL); + _mesa_BindVertexArray(save->VAO->Name); + _mesa_reference_array_object(ctx, &save->VAO, NULL); } if (state & MESA_META_VIEWPORT) { @@ -1463,12 +1463,12 @@ setup_ff_blit_framebuffer(struct blit_state *blit) }; struct vertex verts[4]; - if (blit->ArrayObj == 0) { + if (blit->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &blit->ArrayObj); - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_GenVertexArrays(1, &blit->VAO); + _mesa_BindVertexArray(blit->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &blit->VBO); @@ -1510,11 +1510,11 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, assert(_mesa_is_desktop_gl(ctx) || texture_2d); /* Check if already initialized */ - if (blit->ArrayObj == 0) { + if (blit->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &blit->ArrayObj); - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_GenVertexArrays(1, &blit->VAO); + _mesa_BindVertexArray(blit->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &blit->VBO); @@ -1687,7 +1687,7 @@ blitframebuffer_texture(struct gl_context *ctx, setup_ff_blit_framebuffer(&ctx->Meta->Blit); } - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindVertexArray(blit->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO); _mesa_GenSamplers(1, &sampler); @@ -1872,7 +1872,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, setup_ff_blit_framebuffer(blit); } - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindVertexArray(blit->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO); /* Continue with "normal" approach which involves copying the src rect @@ -2002,9 +2002,9 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, static void meta_glsl_blit_cleanup(struct blit_state *blit) { - if (blit->ArrayObj) { - _mesa_DeleteVertexArrays(1, &blit->ArrayObj); - blit->ArrayObj = 0; + if (blit->VAO) { + _mesa_DeleteVertexArrays(1, &blit->VAO); + blit->VAO = 0; _mesa_DeleteBuffers(1, &blit->VBO); blit->VBO = 0; } @@ -2049,12 +2049,12 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) _mesa_meta_begin(ctx, metaSave); - if (clear->ArrayObj == 0) { + if (clear->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &clear->ArrayObj); - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_GenVertexArrays(1, &clear->VAO); + _mesa_BindVertexArray(clear->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &clear->VBO); @@ -2067,7 +2067,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) _mesa_EnableClientState(GL_COLOR_ARRAY); } else { - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindVertexArray(clear->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO); } @@ -2182,12 +2182,12 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) GLuint vs, gs = 0, fs; bool has_integer_textures; - if (clear->ArrayObj != 0) + if (clear->VAO != 0) return; /* create vertex array object */ - _mesa_GenVertexArrays(1, &clear->ArrayObj); - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_GenVertexArrays(1, &clear->VAO); + _mesa_BindVertexArray(clear->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &clear->VBO); @@ -2291,10 +2291,10 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) static void meta_glsl_clear_cleanup(struct clear_state *clear) { - if (clear->ArrayObj == 0) + if (clear->VAO == 0) return; - _mesa_DeleteVertexArrays(1, &clear->ArrayObj); - clear->ArrayObj = 0; + _mesa_DeleteVertexArrays(1, &clear->VAO); + clear->VAO = 0; _mesa_DeleteBuffers(1, &clear->VBO); clear->VBO = 0; _mesa_DeleteObjectARB(clear->ShaderProg); @@ -2359,7 +2359,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers) ctx->Color.ClearColor.f); } - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindVertexArray(clear->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO); /* GL_COLOR_BUFFER_BIT */ @@ -2472,12 +2472,12 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (copypix->ArrayObj == 0) { + if (copypix->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, ©pix->ArrayObj); - _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_GenVertexArrays(1, ©pix->VAO); + _mesa_BindVertexArray(copypix->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, ©pix->VBO); @@ -2492,7 +2492,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } else { - _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_BindVertexArray(copypix->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, copypix->VBO); } @@ -2548,9 +2548,9 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, static void meta_drawpix_cleanup(struct drawpix_state *drawpix) { - if (drawpix->ArrayObj != 0) { - _mesa_DeleteVertexArrays(1, &drawpix->ArrayObj); - drawpix->ArrayObj = 0; + if (drawpix->VAO != 0) { + _mesa_DeleteVertexArrays(1, &drawpix->VAO); + drawpix->VAO = 0; } if (drawpix->StencilFP != 0) { @@ -2844,11 +2844,11 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, verts[3].t = tex->Ttop; } - if (drawpix->ArrayObj == 0) { + if (drawpix->VAO == 0) { /* one-time setup: create vertex array object */ - _mesa_GenVertexArrays(1, &drawpix->ArrayObj); + _mesa_GenVertexArrays(1, &drawpix->VAO); } - _mesa_BindVertexArray(drawpix->ArrayObj); + _mesa_BindVertexArray(drawpix->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &vbo); @@ -3020,12 +3020,12 @@ _mesa_meta_Bitmap(struct gl_context *ctx, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (bitmap->ArrayObj == 0) { + if (bitmap->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &bitmap->ArrayObj); - _mesa_BindVertexArray(bitmap->ArrayObj); + _mesa_GenVertexArrays(1, &bitmap->VAO); + _mesa_BindVertexArray(bitmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &bitmap->VBO); @@ -3042,7 +3042,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx, _mesa_EnableClientState(GL_COLOR_ARRAY); } else { - _mesa_BindVertexArray(bitmap->ArrayObj); + _mesa_BindVertexArray(bitmap->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, bitmap->VBO); } @@ -3386,11 +3386,11 @@ setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap) GLfloat x, y, tex[3]; }; - if (mipmap->ArrayObj == 0) { + if (mipmap->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &mipmap->ArrayObj); - _mesa_BindVertexArray(mipmap->ArrayObj); + _mesa_GenVertexArrays(1, &mipmap->VAO); + _mesa_BindVertexArray(mipmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &mipmap->VBO); @@ -3469,11 +3469,11 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, void *mem_ctx; /* Check if already initialized */ - if (mipmap->ArrayObj == 0) { + if (mipmap->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &mipmap->ArrayObj); - _mesa_BindVertexArray(mipmap->ArrayObj); + _mesa_GenVertexArrays(1, &mipmap->VAO); + _mesa_BindVertexArray(mipmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &mipmap->VBO); @@ -3572,10 +3572,10 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap) { - if (mipmap->ArrayObj == 0) + if (mipmap->VAO == 0) return; - _mesa_DeleteVertexArrays(1, &mipmap->ArrayObj); - mipmap->ArrayObj = 0; + _mesa_DeleteVertexArrays(1, &mipmap->VAO); + mipmap->VAO = 0; _mesa_DeleteBuffers(1, &mipmap->VBO); mipmap->VBO = 0; @@ -3651,7 +3651,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_set_enable(ctx, target, GL_TRUE); } - _mesa_BindVertexArray(mipmap->ArrayObj); + _mesa_BindVertexArray(mipmap->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, mipmap->VBO); samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ? @@ -3970,8 +3970,8 @@ meta_decompress_cleanup(struct decompress_state *decompress) _mesa_DeleteRenderbuffers(1, &decompress->RBO); } - if (decompress->ArrayObj != 0) { - _mesa_DeleteVertexArrays(1, &decompress->ArrayObj); + if (decompress->VAO != 0) { + _mesa_DeleteVertexArrays(1, &decompress->VAO); _mesa_DeleteBuffers(1, &decompress->VBO); } @@ -4076,10 +4076,10 @@ decompress_texture_image(struct gl_context *ctx, } /* setup VBO data */ - if (decompress->ArrayObj == 0) { + if (decompress->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &decompress->ArrayObj); - _mesa_BindVertexArray(decompress->ArrayObj); + _mesa_GenVertexArrays(1, &decompress->VAO); + _mesa_BindVertexArray(decompress->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &decompress->VBO); @@ -4094,7 +4094,7 @@ decompress_texture_image(struct gl_context *ctx, _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } else { - _mesa_BindVertexArray(decompress->ArrayObj); + _mesa_BindVertexArray(decompress->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, decompress->VBO); } @@ -4289,13 +4289,13 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (drawtex->ArrayObj == 0) { + if (drawtex->VAO == 0) { /* one-time setup */ GLint active_texture; /* create vertex array object */ - _mesa_GenVertexArrays(1, &drawtex->ArrayObj); - _mesa_BindVertexArray(drawtex->ArrayObj); + _mesa_GenVertexArrays(1, &drawtex->VAO); + _mesa_BindVertexArray(drawtex->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &drawtex->VBO); @@ -4319,7 +4319,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, _mesa_ClientActiveTexture(GL_TEXTURE0 + active_texture); } else { - _mesa_BindVertexArray(drawtex->ArrayObj); + _mesa_BindVertexArray(drawtex->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawtex->VBO); } 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(); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 16aee3be7a4..fd27f4b86a7 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -287,15 +287,15 @@ static void check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, const void *elements, GLint basevertex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; const void *elemMap; GLint i, k; - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) { elemMap = ctx->Driver.MapBufferRange(ctx, 0, - ctx->Array.ArrayObj->ElementArrayBufferObj->Size, + ctx->Array.VAO->ElementArrayBufferObj->Size, GL_MAP_READ_BIT, - ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Array.VAO->ElementArrayBufferObj); elements = ADD_POINTERS(elements, elemMap); } @@ -324,7 +324,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, } if (_mesa_is_bufferobj(arrayObj->ElementArrayBufferObj)) { - ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj); } for (k = 0; k < Elements(arrayObj->_VertexAttrib); k++) { @@ -352,7 +352,7 @@ print_draw_arrays(struct gl_context *ctx, { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.VAO; int i; printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", @@ -405,7 +405,7 @@ recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->_VertexAttrib; + struct gl_client_array *vertexAttrib = ctx->Array.VAO->_VertexAttrib; const struct gl_client_array **inputs = &exec->array.inputs[0]; GLbitfield64 const_inputs = 0x0; GLuint i; @@ -883,15 +883,15 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLvoid *map = ctx->Driver.MapBufferRange(ctx, 0, - ctx->Array.ArrayObj->ElementArrayBufferObj->Size, + ctx->Array.VAO->ElementArrayBufferObj->Size, GL_MAP_READ_BIT, - ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Array.VAO->ElementArrayBufferObj); switch (type) { case GL_UNSIGNED_BYTE: { const GLubyte *us = (const GLubyte *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size; i++) { + for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size; i++) { printf("%02x ", us[i]); if (i % 32 == 31) printf("\n"); @@ -903,7 +903,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLushort *us = (const GLushort *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 2; i++) { + for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 2; i++) { printf("%04x ", us[i]); if (i % 16 == 15) printf("\n"); @@ -915,7 +915,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLuint *us = (const GLuint *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 4; i++) { + for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 4; i++) { printf("%08x ", us[i]); if (i % 8 == 7) printf("\n"); @@ -927,7 +927,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) ; } - ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj); } #endif @@ -955,7 +955,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, ib.count = count; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->ElementArrayBufferObj; ib.ptr = indices; prim[0].begin = 1; @@ -1041,7 +1041,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, /* _MaxElement was computed, so we can use it. * This path is used for drivers which need strict bounds checking. */ - max_element = ctx->Array.ArrayObj->_MaxElement; + max_element = ctx->Array.VAO->_MaxElement; } else { /* Generally, hardware drivers don't need to know the buffer bounds @@ -1097,7 +1097,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, " "base %d\n", start, end, type, count, - ctx->Array.ArrayObj->ElementArrayBufferObj->Name, + ctx->Array.VAO->ElementArrayBufferObj->Name, basevertex); } @@ -1350,13 +1350,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, * subranges of the index buffer as one large index buffer may lead to * us reading unmapped memory. */ - if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) + if (!_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) fallback = GL_TRUE; if (!fallback) { ib.count = (max_index_ptr - min_index_ptr) / index_type_size; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->ElementArrayBufferObj; ib.ptr = (void *)min_index_ptr; for (i = 0; i < primcount; i++) { @@ -1387,7 +1387,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, continue; ib.count = count[i]; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->ElementArrayBufferObj; ib.ptr = indices[i]; prim[0].begin = 1; @@ -1657,7 +1657,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx, ib.count = 0; /* unknown */ ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->ElementArrayBufferObj; ib.ptr = NULL; memset(prim, 0, sizeof(prim)); @@ -1705,7 +1705,7 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx, ib.count = 0; /* unknown */ ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->ElementArrayBufferObj; ib.ptr = NULL; prim[0].begin = 1; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 43243e606d1..01c4c0e7c6c 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1138,9 +1138,9 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, _ae_map_vbos(ctx); - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) + if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) indices = - ADD_POINTERS(ctx->Array.ArrayObj->ElementArrayBufferObj->Pointer, indices); + ADD_POINTERS(ctx->Array.VAO->ElementArrayBufferObj->Pointer, indices); vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK | VBO_SAVE_PRIM_NO_CURRENT_UPDATE)); -- cgit v1.2.3