summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2015-03-02 18:37:27 +0100
committerFredrik Höglund <[email protected]>2015-05-08 15:31:03 +0200
commit308926853d132a4d096e70447a262bef1e576789 (patch)
treed7eea59820b848a7ff7325ef562c0356528ae4ab
parentcc9b68e9c91165ef125338542aebf27a9c8c1406 (diff)
mesa: Implement VertexArrayVertexBuffers
Reviewed-by: Laura Ekstrand <[email protected]>
-rw-r--r--src/mapi/glapi/gen/ARB_direct_state_access.xml9
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp1
-rw-r--r--src/mesa/main/varray.c90
-rw-r--r--src/mesa/main/varray.h5
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 46f5ea28c0e..645c9cc80d7 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -478,6 +478,15 @@
<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>
+
<!-- Sampler object functions -->
<function name="CreateSamplers" offset="assign">
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 906ffaf6d04..55edadf4686 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1022,6 +1022,7 @@ const struct function gl_core_functions_possible[] = {
{ "glEnableVertexArrayAttrib", 45, -1 },
{ "glVertexArrayElementBuffer", 45, -1 },
{ "glVertexArrayVertexBuffer", 45, -1 },
+ { "glVertexArrayVertexBuffers", 45, -1 },
{ "glCreateSamplers", 45, -1 },
{ "glCreateProgramPipelines", 45, -1 },
{ "glCreateQueries", 45, -1 },
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index bbefc389cd2..77a1af09a29 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)
{
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 6dd3ffc7ba6..df1cbeb946a 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -299,6 +299,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);