[Mesa-dev] [PATCH 14/16] main: Added entry point for glCreateRenderbuffers
Martin Peres
martin.peres at linux.intel.com
Mon Feb 16 06:14:05 PST 2015
Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 7 +++++
src/mesa/main/fbobject.c | 37 +++++++++++++++++++++-----
src/mesa/main/fbobject.h | 3 +++
src/mesa/main/tests/dispatch_sanity.cpp | 1 +
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index db85ea3..8c9ddbb 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -48,6 +48,13 @@
<param name="param" type="GLint64 *" />
</function>
+ <!-- Renderbuffer object functions -->
+
+ <function name="CreateRenderbuffers" offset="assign">
+ <param name="n" type="GLsizei" />
+ <param name="renderbuffers" type="GLuint *" />
+ </function>
+
<!-- Texture object functions -->
<function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 09c931d..c93e188 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1383,16 +1383,17 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
}
}
-
-void GLAPIENTRY
-_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+static void
+create_render_buffers(struct gl_context *ctx, GLsizei n, GLuint *renderbuffers,
+ bool dsa)
{
- GET_CURRENT_CONTEXT(ctx);
+ struct gl_renderbuffer *obj;
GLuint first;
GLint i;
if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)",
+ dsa ? "glCreateRenderbuffers" : "glGenRenderbuffers");
return;
}
@@ -1404,14 +1405,36 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
for (i = 0; i < n; i++) {
GLuint name = first + i;
renderbuffers[i] = name;
- /* insert dummy placeholder into hash table */
+
+ if (dsa) {
+ obj = _mesa_new_renderbuffer(ctx, name);
+ } else {
+ obj = &DummyRenderbuffer;
+ }
+ /* insert the object into the hash table */
mtx_lock(&ctx->Shared->Mutex);
- _mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer);
+ _mesa_HashInsert(ctx->Shared->RenderBuffers, name, obj);
mtx_unlock(&ctx->Shared->Mutex);
}
}
+void GLAPIENTRY
+_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ create_render_buffers(ctx, n, renderbuffers, false);
+}
+
+
+void GLAPIENTRY
+_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ create_render_buffers(ctx, n, renderbuffers, true);
+}
+
+
/**
* Given an internal format token for a render buffer, return the
* corresponding base format (one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX,
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 77fdef4..9ab6b0b 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -115,6 +115,9 @@ extern void GLAPIENTRY
_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
extern void GLAPIENTRY
+_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
+
+extern void GLAPIENTRY
_mesa_RenderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index cfbd1a2..34e52d2 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -961,6 +961,7 @@ const struct function gl_core_functions_possible[] = {
{ "glGetTransformFeedbackiv", 45, -1 },
{ "glGetTransformFeedbacki_v", 45, -1 },
{ "glGetTransformFeedbacki64_v", 45, -1 },
+ { "glCreateRenderbuffers", 45, -1 },
{ "glCreateTextures", 45, -1 },
{ "glTextureStorage1D", 45, -1 },
{ "glTextureStorage2D", 45, -1 },
--
2.3.0
More information about the mesa-dev
mailing list