<div dir="ltr"><div>This looks good.<br><br></div>Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 7:42 AM, 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"><span class="">v2:<br>
- improve an error message<br>
<br>
Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
<br>
</span><span class="">v3:<br>
- move a test to less generic functions<br>
- fix an alignment<br>
<br>
</span>v4:<br>
- take the caller as a parameter instead of bool dsa<br>
- check that the lookup returns a valid renderbuffer<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, 56 insertions(+), 18 deletions(-)<br>
<span class=""><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>
       <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..377f915 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -1993,25 +1993,11 @@ _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>
</span>+                              GLint *params, const char *func)<br>
<span class=""> {<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>
-   if (!rb) {<br>
-      _mesa_error(ctx, GL_INVALID_OPERATION,<br>
-                  "glGetRenderbufferParameterivEXT");<br>
-      return;<br>
-   }<br>
</span><span class="">-<br>
    /* No need to flush here since we're just quering state which is<br>
     * not effected by rendering.<br>
</span>     */<br>
@@ -2042,10 +2028,51 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)<br>
<div><div class="h5">       }<br>
       /* fallthrough */<br>
    default:<br>
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid pname=%s)", func,<br>
+                  _mesa_lookup_enum_by_nr(pname));<br>
+      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>
       _mesa_error(ctx, GL_INVALID_ENUM,<br>
                   "glGetRenderbufferParameterivEXT(target)");<br>
       return;<br>
    }<br>
+<br>
+   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>
</div></div>+                                 params, "glGetRenderbufferParameteriv");<br>
<span class="">+}<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,<br>
+                                      GLint *params)<br>
+{<br>
+   GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);<br>
</span>+   if (!rb || rb == &DummyRenderbuffer) {<br>
<span class="">+      /* ID was reserved, but no real renderbuffer object made yet */<br>
+      _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,<br>
</span>+                                 "glGetNamedRenderbufferParameteriv");<br>
<div><div class="h5"> }<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>
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>
    { "glCreateRenderbuffers", 45, -1 },<br>
+   { "glGetNamedRenderbufferParameteriv", 45, -1 },<br>
    { "glCreateTextures", 45, -1 },<br>
    { "glTextureStorage1D", 45, -1 },<br>
    { "glTextureStorage2D", 45, -1 },<br>
--<br>
2.3.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
</div></div><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>