aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-26 12:39:42 +0200
committerSamuel Pitoiset <[email protected]>2017-06-28 10:25:12 +0200
commit064bb7499cd3cb7a87c7f39c233ed2595889a503 (patch)
tree46927f902be4e1fba539942a07deb91b3ee8b133 /src/mesa/main/bufferobj.c
parent50f9f510c9d3d6c87ec3fecc73ea1e40f2989e79 (diff)
mesa: prepare create_buffers() helper for KHR_no_error support
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r--src/mesa/main/bufferobj.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 6e2979f6db9..410aa7e4b5a 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1416,25 +1416,13 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
* driver internals.
*/
static void
-create_buffers(GLsizei n, GLuint *buffers, bool dsa)
+create_buffers(struct gl_context *ctx, GLsizei n, GLuint *buffers, bool dsa)
{
- GET_CURRENT_CONTEXT(ctx);
GLuint first;
struct gl_buffer_object *buf;
- const char *func = dsa ? "glCreateBuffers" : "glGenBuffers";
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "%s(%d)\n", func, n);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(n %d < 0)", func, n);
+ if (!buffers)
return;
- }
-
- if (!buffers) {
- return;
- }
/*
* This must be atomic (generation and allocation of buffer object IDs)
@@ -1453,7 +1441,7 @@ create_buffers(GLsizei n, GLuint *buffers, bool dsa)
assert(ctx->Driver.NewBufferObject);
buf = ctx->Driver.NewBufferObject(ctx, buffers[i]);
if (!buf) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCreateBuffers");
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
return;
}
@@ -1467,6 +1455,23 @@ create_buffers(GLsizei n, GLuint *buffers, bool dsa)
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
}
+
+static void
+create_buffers_err(struct gl_context *ctx, GLsizei n, GLuint *buffers, bool dsa)
+{
+ const char *func = dsa ? "glCreateBuffers" : "glGenBuffers";
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "%s(%d)\n", func, n);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n %d < 0)", func, n);
+ return;
+ }
+
+ create_buffers(ctx, n, buffers, dsa);
+}
+
/**
* Generate a set of unique buffer object IDs and store them in \c buffers.
*
@@ -1476,7 +1481,8 @@ create_buffers(GLsizei n, GLuint *buffers, bool dsa)
void GLAPIENTRY
_mesa_GenBuffers(GLsizei n, GLuint *buffers)
{
- create_buffers(n, buffers, false);
+ GET_CURRENT_CONTEXT(ctx);
+ create_buffers_err(ctx, n, buffers, false);
}
/**
@@ -1488,7 +1494,8 @@ _mesa_GenBuffers(GLsizei n, GLuint *buffers)
void GLAPIENTRY
_mesa_CreateBuffers(GLsizei n, GLuint *buffers)
{
- create_buffers(n, buffers, true);
+ GET_CURRENT_CONTEXT(ctx);
+ create_buffers_err(ctx, n, buffers, true);
}