<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 23, 2015 at 12:04 PM, Martin Peres <span dir="ltr"><<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">v2:<br>
- improve an error message<br>
<br>
Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
<br>
v3:<br>
- move a test to less generic functions<br>
- fix an alignment<br>
<br>
Signed-off-by: Martin Peres <<a href="mailto:martin.peres@linux.intel.com">martin.peres@linux.intel.com</a>><br>
---<br>
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++<br>
 src/mesa/main/fbobject.c                       | 63 +++++++++++++++++++-------<br>
<span class=""> src/mesa/main/fbobject.h                       |  4 ++<br>
 src/mesa/main/tests/dispatch_sanity.cpp        |  1 +<br>
</span> 4 files changed, 57 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
index 976dcc8..d4e1f7c 100644<br>
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
@@ -159,6 +159,12 @@<br>
<span class="">       <param name="renderbuffers" type="GLuint *" /><br>
    </function><br>
<br>
+   <function name="GetNamedRenderbufferParameteriv" offset="assign"><br>
+      <param name="renderbuffer" type="GLuint" /><br>
+      <param name="pname" type="GLenum" /><br>
+      <param name="params" type="GLint *" /><br>
+   </function><br>
+<br>
    <!-- Texture object functions --><br>
<br>
    <function name="CreateTextures" offset="assign"><br>
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
</span>index 8083bc1..ee4ad1f 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -1993,24 +1993,13 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,<br>
<span class=""> }<br>
<br>
<br>
-void GLAPIENTRY<br>
-_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)<br>
+static void<br>
+get_render_buffer_parameteriv(struct gl_context *ctx,<br>
+                              struct gl_renderbuffer *rb, GLenum pname,<br>
+                              GLint *params, bool dsa)<br>
 {<br>
-   struct gl_renderbuffer *rb;<br>
-   GET_CURRENT_CONTEXT(ctx);<br>
-<br>
-   if (target != GL_RENDERBUFFER_EXT) {<br>
-      _mesa_error(ctx, GL_INVALID_ENUM,<br>
-                  "glGetRenderbufferParameterivEXT(target)");<br>
-      return;<br>
-   }<br>
-<br>
-   rb = ctx->CurrentRenderbuffer;<br>
</span>-   if (!rb) {<br>
<span class="">-      _mesa_error(ctx, GL_INVALID_OPERATION,<br>
-                  "glGetRenderbufferParameterivEXT");<br>
</span>-      return;<br>
-   }<br></blockquote><div>I think passing in a const char *caller would be better than a bool dsa, since the only thing you are using dsa for is determining the name of the calling function. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="">+   const char *func = dsa ? "glGetNamedRenderbufferParameteriv" :<br>
+                            "glGetRenderbufferParameteriv";<br>
<br>
</span>    /* No need to flush here since we're just quering state which is<br>
     * not effected by rendering.<br>
@@ -2042,10 +2031,50 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)<br>
       }<br>
       /* fallthrough */<br>
    default:<br>
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid pname=%s)", func,<br>
+                  _mesa_lookup_enum_by_nr(pname));<br>
<span class="">+      return;<br>
+   }<br>
+}<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)<br>
+{<br>
+   GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+   if (target != GL_RENDERBUFFER_EXT) {<br>
</span><span class="">       _mesa_error(ctx, GL_INVALID_ENUM,<br>
                   "glGetRenderbufferParameterivEXT(target)");<br>
       return;<br>
    }<br>
+<br>
</span>+   if (!ctx->CurrentRenderbuffer) {<br>
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetRenderbufferParameterivEXT"<br>
+                  "(no renderbuffer bound)");<br>
+      return;<br>
+   }<br>
+<br>
+   get_render_buffer_parameteriv(ctx, ctx->CurrentRenderbuffer, pname,<br>
<span class="">+                                 params, false);<br>
+}<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,<br>
+                                      GLint *params)<br>
+{<br>
+   GET_CURRENT_CONTEXT(ctx);<br>
+<br>
</span><span class="">+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);<br></span></blockquote><div>You need to check if !rb here, too, in case you get rb = NULL.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
+   if (rb == &DummyRenderbuffer) {<br>
+      /* ID was reserved, but no real renderbuffer object made yet */<br>
</span>+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetNamedRenderbufferParameteriv"<br>
+                  "(invalid renderbuffer %i)", renderbuffer);<br>
+      return;<br>
+   }<br>
+<br>
+   get_render_buffer_parameteriv(ctx, rb, pname, params, true);<br>
<span class=""> }<br>
<br>
<br>
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h<br>
index 9ab6b0b..b92149b 100644<br>
--- a/src/mesa/main/fbobject.h<br>
+++ b/src/mesa/main/fbobject.h<br>
@@ -137,6 +137,10 @@ extern void GLAPIENTRY<br>
 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,<br>
                                     GLint *params);<br>
<br>
+void GLAPIENTRY<br>
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,<br>
+                                      GLint *params);<br>
+<br>
 extern GLboolean GLAPIENTRY<br>
 _mesa_IsFramebuffer(GLuint framebuffer);<br>
<br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
</span>index 5383865..bb573d4 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -944,6 +944,7 @@ const struct function gl_core_functions_possible[] = {<br>
    { "glGetNamedBufferPointerv", 45, -1 },<br>
    { "glGetNamedBufferSubData", 45, -1 },<br>
<span class="">    { "glCreateRenderbuffers", 45, -1 },<br>
+   { "glGetNamedRenderbufferParameteriv", 45, -1 },<br>
    { "glCreateTextures", 45, -1 },<br>
    { "glTextureStorage1D", 45, -1 },<br>
    { "glTextureStorage2D", 45, -1 },<br>
--<br>
</span>2.3.3<br>
<span class=""><br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
</span><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>