diff options
author | marha <marha@users.sourceforge.net> | 2014-02-07 23:46:30 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-02-07 23:46:30 +0100 |
commit | 6daf40f6b1138efad98dbb579cd35520cbc349bb (patch) | |
tree | 7f45dbb347f5e1a73b18a720633b9d801c968490 /mesalib/src/mesa/main/varray.c | |
parent | 5c64f94cf4cf8457a5616fe20b9a27174895f1a8 (diff) | |
parent | 982ac918afe6a1c02d5cf735d7b6c56443a048cc (diff) | |
download | vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.tar.gz vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.tar.bz2 vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
xkbcomp xkeyboard-config libxcb libxtrans fontconfig libX11 libxcb mesa xserver git update 7 Feb 2014
Conflicts:
mesalib/src/glsl/glcpp/glcpp.c
openssl/Makefile
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 135 |
1 files changed, 67 insertions, 68 deletions
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index b73a396e2..44db2cbcd 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -112,20 +112,20 @@ static void vertex_attrib_binding(struct gl_context *ctx, GLuint attribIndex, GLuint bindingIndex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; - struct gl_vertex_attrib_array *array = &arrayObj->VertexAttrib[attribIndex]; + struct gl_vertex_array_object *vao = ctx->Array.VAO; + struct gl_vertex_attrib_array *array = &vao->VertexAttrib[attribIndex]; if (array->VertexBinding != bindingIndex) { const GLbitfield64 array_bit = VERT_BIT(attribIndex); FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexBinding[array->VertexBinding]._BoundArrays &= ~array_bit; - arrayObj->VertexBinding[bindingIndex]._BoundArrays |= array_bit; + vao->VertexBinding[array->VertexBinding]._BoundArrays &= ~array_bit; + vao->VertexBinding[bindingIndex]._BoundArrays |= array_bit; array->VertexBinding = bindingIndex; - arrayObj->NewArrays |= array_bit; + vao->NewArrays |= array_bit; } } @@ -139,8 +139,8 @@ 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_vertex_buffer_binding *binding = &arrayObj->VertexBinding[index]; + struct gl_vertex_array_object *vao = ctx->Array.VAO; + struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index]; if (binding->BufferObj != vbo || binding->Offset != offset || @@ -153,7 +153,7 @@ bind_vertex_buffer(struct gl_context *ctx, GLuint index, binding->Offset = offset; binding->Stride = stride; - arrayObj->NewArrays |= binding->_BoundArrays; + vao->NewArrays |= binding->_BoundArrays; } } @@ -166,14 +166,14 @@ static void vertex_binding_divisor(struct gl_context *ctx, GLuint bindingIndex, GLuint divisor) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; struct gl_vertex_buffer_binding *binding = - &arrayObj->VertexBinding[bindingIndex]; + &vao->VertexBinding[bindingIndex]; if (binding->InstanceDivisor != divisor) { FLUSH_VERTICES(ctx, _NEW_ARRAY); binding->InstanceDivisor = divisor; - arrayObj->NewArrays |= binding->_BoundArrays; + vao->NewArrays |= binding->_BoundArrays; } } @@ -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; @@ -664,7 +664,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, void GLAPIENTRY _mesa_EnableVertexAttribArray(GLuint index) { - struct gl_array_object *arrayObj; + struct gl_vertex_array_object *vao; GET_CURRENT_CONTEXT(ctx); if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -673,16 +673,16 @@ _mesa_EnableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); - if (!arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { + if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was disabled, now being enabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; - arrayObj->_Enabled |= VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); + vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; + vao->_Enabled |= VERT_BIT_GENERIC(index); + vao->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -690,7 +690,7 @@ _mesa_EnableVertexAttribArray(GLuint index) void GLAPIENTRY _mesa_DisableVertexAttribArray(GLuint index) { - struct gl_array_object *arrayObj; + struct gl_vertex_array_object *vao; GET_CURRENT_CONTEXT(ctx); if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -699,16 +699,16 @@ _mesa_DisableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); - if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { + if (vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was enabled, now being disabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; - arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); + vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; + vao->_Enabled &= ~VERT_BIT_GENERIC(index); + vao->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -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_vertex_array_object *vao = ctx->Array.VAO; const struct gl_vertex_attrib_array *array; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -730,9 +730,9 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, return 0; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); - array = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; + array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: @@ -746,7 +746,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: return array->Normalized; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: - return arrayObj->VertexBinding[array->VertexBinding].BufferObj->Name; + return vao->VertexBinding[array->VertexBinding].BufferObj->Name; case GL_VERTEX_ATTRIB_ARRAY_INTEGER: if ((_mesa_is_desktop_gl(ctx) && (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) @@ -757,7 +757,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB: if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_instanced_arrays) || _mesa_is_gles3(ctx)) { - return arrayObj->VertexBinding[array->VertexBinding].InstanceDivisor; + return vao->VertexBinding[array->VertexBinding].InstanceDivisor; } goto error; case GL_VERTEX_ATTRIB_BINDING: @@ -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_vertex_array_object *vao = 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; @@ -1412,8 +1412,8 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, return; } - if (buffer == arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) { - vbo = arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj; + if (buffer == vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) { + vbo = vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj; } else if (buffer != 0) { vbo = _mesa_lookup_bufferobj(ctx, buffer); @@ -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,25 +1758,25 @@ 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_vertex_array_object *vao = ctx->Array.VAO; GLuint i; - _mesa_update_array_object_max_element(ctx, arrayObj); + _mesa_update_vao_max_element(ctx, vao); - printf("Array Object %u\n", arrayObj->Name); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_POS].Enabled) - print_array("Vertex", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_POS]); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) - print_array("Normal", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL]); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) - print_array("Color", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0]); + printf("Array Object %u\n", vao->Name); + if (vao->_VertexAttrib[VERT_ATTRIB_POS].Enabled) + print_array("Vertex", -1, &vao->_VertexAttrib[VERT_ATTRIB_POS]); + if (vao->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) + print_array("Normal", -1, &vao->_VertexAttrib[VERT_ATTRIB_NORMAL]); + if (vao->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) + print_array("Color", -1, &vao->_VertexAttrib[VERT_ATTRIB_COLOR0]); for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) - if (arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) - print_array("TexCoord", i, &arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)]); + if (vao->_VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) + print_array("TexCoord", i, &vao->_VertexAttrib[VERT_ATTRIB_TEX(i)]); for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) - if (arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) - print_array("Attrib", i, &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]); - printf(" _MaxElement = %u\n", arrayObj->_MaxElement); + if (vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) + print_array("Attrib", i, &vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]); + printf(" _MaxElement = %u\n", vao->_MaxElement); } @@ -1786,9 +1786,8 @@ _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_vao(ctx, &ctx->Array.VAO, ctx->Array.DefaultVAO); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ ctx->Array.Objects = _mesa_NewHashTable(); @@ -1801,9 +1800,9 @@ _mesa_init_varray(struct gl_context *ctx) static void delete_arrayobj_cb(GLuint id, void *data, void *userData) { - struct gl_array_object *arrayObj = (struct gl_array_object *) data; + struct gl_vertex_array_object *vao = (struct gl_vertex_array_object *) data; struct gl_context *ctx = (struct gl_context *) userData; - _mesa_delete_array_object(ctx, arrayObj); + _mesa_delete_vao(ctx, vao); } |