[Mesa-dev] [PATCH 01/22] mesa: Implement CreateVertexArrays
Fredrik Höglund
fredrik at kde.org
Wed Mar 18 16:18:27 PDT 2015
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 7 +++++++
src/mesa/main/arrayobj.c | 20 +++++++++++++++-----
src/mesa/main/arrayobj.h | 2 ++
src/mesa/main/tests/dispatch_sanity.cpp | 1 +
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 641e68f..f5097e7 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -379,5 +379,12 @@
<param name="params" type="GLint *" />
</function>
+ <!-- Vertex Array object functions -->
+
+ <function name="CreateVertexArrays" offset="assign">
+ <param name="n" type="GLsizei" />
+ <param name="arrays" type="GLuint *" />
+ </function>
+
</category>
</OpenGLAPI>
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 3c8ffb5..0c15630 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -486,13 +486,14 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
* \param vboOnly Will arrays have to reside in VBOs?
*/
static void
-gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
+gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
+ bool dsa, const char *func)
{
GLuint first;
GLint i;
if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArrays");
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
return;
}
@@ -509,9 +510,10 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
obj = (*ctx->Driver.NewArrayObject)( ctx, name );
if (!obj) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArrays");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, func);
return;
}
+ obj->EverBound = dsa;
save_array_object(ctx, obj);
arrays[i] = first + i;
}
@@ -526,7 +528,7 @@ void GLAPIENTRY
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays);
+ gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArrays");
}
@@ -538,7 +540,15 @@ void GLAPIENTRY
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays);
+ gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArraysAPPLE");
+}
+
+
+void GLAPIENTRY
+_mesa_CreateVertexArrays(GLsizei n, GLuint *arrays)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
}
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 3c1f918..ae671e3 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -93,6 +93,8 @@ void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
+void GLAPIENTRY _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays);
+
GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
#endif /* ARRAYOBJ_H */
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 59ebb21..cc6b505 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -970,6 +970,7 @@ const struct function gl_core_functions_possible[] = {
{ "glTextureStorage3DMultisample", 45, -1 },
{ "glTextureBuffer", 45, -1 },
{ "glTextureBufferRange", 45, -1 },
+ { "glCreateVertexArrays", 45, -1 },
/* GL_EXT_polygon_offset_clamp */
{ "glPolygonOffsetClampEXT", 11, -1 },
--
1.8.5.3
More information about the mesa-dev
mailing list