--- src/mapi/glapi/gen/ARB_direct_state_access.xml | 9 +++ src/mesa/main/tests/dispatch_sanity.cpp | 1 + src/mesa/main/varray.c | 90 ++++++++++++++++++-------- src/mesa/main/varray.h | 5 ++ 4 files changed, 78 insertions(+), 27 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index a4de6e5..c08fe55 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -409,5 +409,14 @@ <param name="stride" type="GLsizei" /> </function> + <function name="VertexArrayVertexBuffers" offset="assign"> + <param name="vaobj" type="GLuint" /> + <param name="first" type="GLuint" /> + <param name="count" type="GLsizei" /> + <param name="buffers" type="const GLuint *" /> + <param name="offsets" type="const GLintptr *" /> + <param name="strides" type="const GLsizei *" /> + </function> + </category> </OpenGLAPI> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 551e6bd..1d84e64 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -975,6 +975,7 @@ const struct function gl_core_functions_possible[] = { { "glEnableVertexArrayAttrib", 45, -1 }, { "glVertexArrayElementBuffer", 45, -1 }, { "glVertexArrayVertexBuffer", 45, -1 }, + { "glVertexArrayVertexBuffers", 45, -1 }, /* GL_EXT_polygon_offset_clamp */ { "glPolygonOffsetClampEXT", 11, -1 }, diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 5dff84f..5f58016 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1574,28 +1574,17 @@ _mesa_VertexArrayVertexBuffer(GLuint vaobj, GLuint bindingIndex, GLuint buffer, } -void GLAPIENTRY -_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, - const GLintptr *offsets, const GLsizei *strides) +static void +vertex_array_vertex_buffers(struct gl_context *ctx, + struct gl_vertex_array_object *vao, + GLuint first, GLsizei count, const GLuint *buffers, + const GLintptr *offsets, const GLsizei *strides, + const char *func) { - GET_CURRENT_CONTEXT(ctx); - struct gl_vertex_array_object * const vao = ctx->Array.VAO; GLuint i; ASSERT_OUTSIDE_BEGIN_END(ctx); - /* The ARB_vertex_attrib_binding spec says: - * - * "An INVALID_OPERATION error is generated if no - * vertex array object is bound." - */ - if (ctx->API == API_OPENGL_CORE && - ctx->Array.VAO == ctx->Array.DefaultVAO) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindVertexBuffers(No array object bound)"); - return; - } - /* The ARB_multi_bind spec says: * * "An INVALID_OPERATION error is generated if <first> + <count> @@ -1603,9 +1592,9 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, */ if (first + count > ctx->Const.MaxVertexAttribBindings) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindVertexBuffers(first=%u + count=%d > the value of " + "%s(first=%u + count=%d > the value of " "GL_MAX_VERTEX_ATTRIB_BINDINGS=%u)", - first, count, ctx->Const.MaxVertexAttribBindings); + func, first, count, ctx->Const.MaxVertexAttribBindings); return; } @@ -1659,23 +1648,23 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, */ if (offsets[i] < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glBindVertexBuffers(offsets[%u]=%" PRId64 " < 0)", - i, (int64_t) offsets[i]); + "%s(offsets[%u]=%" PRId64 " < 0)", + func, i, (int64_t) offsets[i]); continue; } if (strides[i] < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glBindVertexBuffers(strides[%u]=%d < 0)", - i, strides[i]); + "%s(strides[%u]=%d < 0)", + func, i, strides[i]); continue; } if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 && strides[i] > ctx->Const.MaxVertexAttribStride) { _mesa_error(ctx, GL_INVALID_VALUE, - "glBindVertexBuffers(strides[%u]=%d > " - "GL_MAX_VERTEX_ATTRIB_STRIDE)", i, strides[i]); + "%s(strides[%u]=%d > " + "GL_MAX_VERTEX_ATTRIB_STRIDE)", func, i, strides[i]); continue; } @@ -1686,8 +1675,7 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, if (buffers[i] == binding->BufferObj->Name) vbo = binding->BufferObj; else - vbo = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, i, - "glBindVertexBuffers"); + vbo = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, i, func); if (!vbo) continue; @@ -1704,6 +1692,54 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, void GLAPIENTRY +_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, + const GLintptr *offsets, const GLsizei *strides) +{ + GET_CURRENT_CONTEXT(ctx); + + /* The ARB_vertex_attrib_binding spec says: + * + * "An INVALID_OPERATION error is generated if no + * vertex array object is bound." + */ + if (ctx->API == API_OPENGL_CORE && + ctx->Array.VAO == ctx->Array.DefaultVAO) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindVertexBuffers(No array object bound)"); + return; + } + + vertex_array_vertex_buffers(ctx, ctx->Array.VAO, first, count, + buffers, offsets, strides, + "glBindVertexBuffers"); +} + + +void GLAPIENTRY +_mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, + const GLuint *buffers, + const GLintptr *offsets, const GLsizei *strides) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_vertex_array_object *vao; + + /* The ARB_direct_state_access specification says: + * + * "An INVALID_OPERATION error is generated by VertexArrayVertexBuffer + * if <vaobj> is not [compatibility profile: zero or] the name of an + * existing vertex array object." + */ + vao = _mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayVertexBuffers"); + if (!vao) + return; + + vertex_array_vertex_buffers(ctx, vao, first, count, + buffers, offsets, strides, + "glVertexArrayVertexBuffers"); +} + + +void GLAPIENTRY _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeOffset) { diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 1e94782..7a7b7c1 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -294,6 +294,11 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); extern void GLAPIENTRY +_mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, + const GLuint *buffers, + const GLintptr *offsets, const GLsizei *strides); + +extern void GLAPIENTRY _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeOffset); -- 1.8.5.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev