summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arrayobj.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-18 15:18:35 +0200
committerSamuel Pitoiset <[email protected]>2017-07-31 13:53:39 +0200
commitab0f246672edfb5d41203abf7be9a01c9f16b4b4 (patch)
treec4af2012629816aafd32c366302a49b56666a943 /src/mesa/main/arrayobj.c
parent3e637918ec24f795ecf41c07a434a40c6f4ae8b0 (diff)
mesa: add gen_vertex_arrays_err() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r--src/mesa/main/arrayobj.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 6e231156fa1..5b73652bd95 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -508,14 +508,8 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
GLuint first;
GLint i;
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
- return;
- }
-
- if (!arrays) {
+ if (!arrays)
return;
- }
first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n);
@@ -539,6 +533,19 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
}
+static void
+gen_vertex_arrays_err(struct gl_context *ctx, GLsizei n, GLuint *arrays,
+ bool create, const char *func)
+{
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
+ return;
+ }
+
+ gen_vertex_arrays(ctx, n, arrays, create, func);
+}
+
+
/**
* ARB version of glGenVertexArrays()
* All arrays will be required to live in VBOs.
@@ -547,7 +554,7 @@ void GLAPIENTRY
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArrays");
+ gen_vertex_arrays_err(ctx, n, arrays, false, "glGenVertexArrays");
}
@@ -559,7 +566,7 @@ void GLAPIENTRY
_mesa_CreateVertexArrays(GLsizei n, GLuint *arrays)
{
GET_CURRENT_CONTEXT(ctx);
- gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
+ gen_vertex_arrays_err(ctx, n, arrays, true, "glCreateVertexArrays");
}