summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
authorFredrik Höglund <fredrik@kde.org>2015-03-02 18:37:27 +0100
committerFredrik Höglund <fredrik@kde.org>2015-05-08 15:31:03 +0200
commit308926853d132a4d096e70447a262bef1e576789 (patch)
treed7eea59820b848a7ff7325ef562c0356528ae4ab /src/mesa/main/varray.c
parentcc9b68e9c91165ef125338542aebf27a9c8c1406 (diff)
downloadexternal_mesa3d-308926853d132a4d096e70447a262bef1e576789.zip
external_mesa3d-308926853d132a4d096e70447a262bef1e576789.tar.gz
external_mesa3d-308926853d132a4d096e70447a262bef1e576789.tar.bz2
mesa: Implement VertexArrayVertexBuffers
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c90
1 files changed, 63 insertions, 27 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index bbefc38..77a1af0 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1612,28 +1612,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>
@@ -1641,9 +1630,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;
}
@@ -1697,23 +1686,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;
}
@@ -1724,8 +1713,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;
@@ -1742,6 +1730,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)
{