[Mesa-dev] [PATCH 15/16] main: Added entry point for glGetNamedRenderbufferParameteriv

Martin Peres martin.peres at linux.intel.com
Mon Feb 16 06:14:06 PST 2015


Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
 src/mesa/main/fbobject.c                       | 53 +++++++++++++++++++-------
 src/mesa/main/fbobject.h                       |  4 ++
 src/mesa/main/tests/dispatch_sanity.cpp        |  1 +
 4 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 8c9ddbb..144c891 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -55,6 +55,12 @@
       <param name="renderbuffers" type="GLuint *" />
    </function>
 
+   <function name="GetNamedRenderbufferParameteriv" offset="assign">
+      <param name="renderbuffer" type="GLuint" />
+      <param name="pname" type="GLenum" />
+      <param name="params" type="GLint *" />
+   </function>
+
    <!-- Texture object functions -->
 
    <function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c93e188..c2ea59c 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1980,22 +1980,15 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
 }
 
 
-void GLAPIENTRY
-_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+static void
+get_render_buffer_parameteriv(struct gl_context *ctx,
+                              struct gl_renderbuffer *rb, GLenum pname,
+                              GLint *params, bool dsa)
 {
-   struct gl_renderbuffer *rb;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (target != GL_RENDERBUFFER_EXT) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-                  "glGetRenderbufferParameterivEXT(target)");
-      return;
-   }
-
-   rb = ctx->CurrentRenderbuffer;
+   const char *func = dsa ? "glGetNamedRenderbufferParameteriv" :
+                            "glGetRenderbufferParameteriv";
    if (!rb) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetRenderbufferParameterivEXT");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s", func);
       return;
    }
 
@@ -2030,9 +2023,41 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
       /* fallthrough */
    default:
       _mesa_error(ctx, GL_INVALID_ENUM,
+                  "%s(target)", func);
+      return;
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (target != GL_RENDERBUFFER_EXT) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
                   "glGetRenderbufferParameterivEXT(target)");
       return;
    }
+
+   get_render_buffer_parameteriv(ctx, ctx->CurrentRenderbuffer, pname,
+                                 params, false);
+}
+
+
+void GLAPIENTRY
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
+                                      GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
+   if (rb == &DummyRenderbuffer) {
+      /* ID was reserved, but no real renderbuffer object made yet */
+      rb = NULL;
+   }
+
+   get_render_buffer_parameteriv(ctx, rb, pname, params, true);
 }
 
 
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 9ab6b0b..b92149b 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -137,6 +137,10 @@ extern void GLAPIENTRY
 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
                                     GLint *params);
 
+void GLAPIENTRY
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
+                                      GLint *params);
+
 extern GLboolean GLAPIENTRY
 _mesa_IsFramebuffer(GLuint framebuffer);
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 34e52d2..1d7a57e 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -962,6 +962,7 @@ const struct function gl_core_functions_possible[] = {
    { "glGetTransformFeedbacki_v", 45, -1 },
    { "glGetTransformFeedbacki64_v", 45, -1 },
    { "glCreateRenderbuffers", 45, -1 },
+   { "glGetNamedRenderbufferParameteriv", 45, -1 },
    { "glCreateTextures", 45, -1 },
    { "glTextureStorage1D", 45, -1 },
    { "glTextureStorage2D", 45, -1 },
-- 
2.3.0



More information about the mesa-dev mailing list