<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 16, 2015 at 6:14 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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 |  15 +++<br>
 src/mesa/main/fbobject.c                       | 147 ++++++++++++++++++-------<br>
 src/mesa/main/fbobject.h                       |   9 ++<br>
 src/mesa/main/tests/dispatch_sanity.cpp        |   2 +<br>
 4 files changed, 135 insertions(+), 38 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 144c891..a5fb84b 100644<br>
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
@@ -55,6 +55,21 @@<br>
       <param name="renderbuffers" type="GLuint *" /><br>
    </function><br>
<br>
+   <function name="NamedRenderbufferStorage" offset="assign"><br>
+      <param name="renderbuffer" type="GLuint" /><br>
+      <param name="internalformat" type="GLenum" /><br>
+      <param name="width" type="GLsizei" /><br>
+      <param name="height" type="GLsizei" /><br>
+   </function><br>
+<br>
+   <function name="NamedRenderbufferStorageMultisample" offset="assign"><br>
+      <param name="renderbuffer" type="GLuint" /><br>
+      <param name="samples" type="GLsizei" /><br>
+      <param name="internalformat" type="GLenum" /><br>
+      <param name="width" type="GLsizei" /><br>
+      <param name="height" type="GLsizei" /><br>
+   </function><br>
+<br>
    <function name="GetNamedRenderbufferParameteriv" offset="assign"><br>
       <param name="renderbuffer" type="GLuint" /><br>
       <param name="pname" type="GLenum" /><br>
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
index c2ea59c..3f079df 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -1407,7 +1407,7 @@ create_render_buffers(struct gl_context *ctx, GLsizei n, GLuint *renderbuffers,<br>
       renderbuffers[i] = name;<br>
<br>
       if (dsa) {<br>
-         obj = _mesa_new_renderbuffer(ctx, name);<br>
+         obj = ctx->Driver.NewRenderbuffer(ctx, name);<br></blockquote><div>What is the reason for this change?  Also, you should use rebase to move squash this into the previous commit; it doesn't make sense to put it with this one. <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
       } else {<br>
          obj = &DummyRenderbuffer;<br>
       }<br>
@@ -1772,40 +1772,17 @@ invalidate_rb(GLuint key, void *data, void *userData)<br>
<br>
<br>
 /**<br>
- * Helper function used by _mesa_RenderbufferStorage() and<br>
- * _mesa_RenderbufferStorageMultisample().<br>
- * samples will be NO_SAMPLES if called by _mesa_RenderbufferStorage().<br>
+ * Helper function used by renderbuffer_storage_direct() and<br>
+ * renderbuffer_storage_target().<br>
+ * samples will be NO_SAMPLES if called by a non-multisample function.<br>
  */<br>
 static void<br>
-renderbuffer_storage(GLenum target, GLenum internalFormat,<br>
-                     GLsizei width, GLsizei height, GLsizei samples)<br>
+renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,<br>
+                     GLenum internalFormat, GLsizei width,<br>
+                     GLsizei height, GLsizei samples, const char *func)<br>
 {<br>
-   const char *func = samples == NO_SAMPLES ?<br>
-      "glRenderbufferStorage" : "glRenderbufferStorageMultisample";<br>
-   struct gl_renderbuffer *rb;<br>
    GLenum baseFormat;<br>
    GLenum sample_count_error;<br>
-   GET_CURRENT_CONTEXT(ctx);<br>
-<br>
-   if (MESA_VERBOSE & VERBOSE_API) {<br>
-      if (samples == NO_SAMPLES)<br>
-         _mesa_debug(ctx, "%s(%s, %s, %d, %d)\n",<br>
-                     func,<br>
-                     _mesa_lookup_enum_by_nr(target),<br>
-                     _mesa_lookup_enum_by_nr(internalFormat),<br>
-                     width, height);<br>
-      else<br>
-         _mesa_debug(ctx, "%s(%s, %s, %d, %d, %d)\n",<br>
-                     func,<br>
-                     _mesa_lookup_enum_by_nr(target),<br>
-                     _mesa_lookup_enum_by_nr(internalFormat),<br>
-                     width, height, samples);<br>
-   }<br>
-<br>
-   if (target != GL_RENDERBUFFER_EXT) {<br>
-      _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);<br>
-      return;<br>
-   }<br>
<br>
    baseFormat = _mesa_base_fbo_format(ctx, internalFormat);<br>
    if (baseFormat == 0) {<br>
@@ -1815,12 +1792,14 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,<br>
    }<br>
<br>
    if (width < 0 || width > (GLsizei) ctx->Const.MaxRenderbufferSize) {<br>
-      _mesa_error(ctx, GL_INVALID_VALUE, "%s(width)", func);<br>
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(invalid width %d)", func,<br>
+                  width);<br>
       return;<br>
    }<br>
<br>
    if (height < 0 || height > (GLsizei) ctx->Const.MaxRenderbufferSize) {<br>
-      _mesa_error(ctx, GL_INVALID_VALUE, "%s(height)", func);<br>
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(invalid height %d)", func,<br>
+                  height);<br>
       return;<br>
    }<br>
<br>
@@ -1832,7 +1811,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,<br>
       /* check the sample count;<br>
        * note: driver may choose to use more samples than what's requested<br>
        */<br>
-      sample_count_error = _mesa_check_sample_count(ctx, target,<br>
+      sample_count_error = _mesa_check_sample_count(ctx, GL_RENDERBUFFER,<br>
             internalFormat, samples);<br>
       if (sample_count_error != GL_NO_ERROR) {<br>
          _mesa_error(ctx, sample_count_error, "%s(samples)", func);<br>
@@ -1840,7 +1819,6 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,<br>
       }<br>
    }<br>
<br>
-   rb = ctx->CurrentRenderbuffer;<br>
    if (!rb) {<br>
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s", func);<br></blockquote><div>Maybe say something like "%s(invalid renderbuffer name"?  I typically prefer to throw this error earlier so that you can print out the name of the renderbuffer in the error message, too, but that's not a big deal.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
       return;<br>
@@ -1887,6 +1865,75 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,<br>
    }<br>
 }<br>
<br>
+/**<br>
+ * Helper function used by _mesa_namedRenderbufferStorage*().<br></blockquote><div>Should be a capital letter "N"--------------^ <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ * samples will be NO_SAMPLES if called by a non-multisample function.<br>
+ */<br>
+static void<br>
+renderbuffer_storage_named(GLuint renderbuffer, GLenum internalFormat,<br>
+                           GLsizei width, GLsizei height, GLsizei samples,<br>
+                           const char *func)<br>
+{<br>
+   GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+   if (MESA_VERBOSE & VERBOSE_API) {<br>
+      if (samples == NO_SAMPLES)<br>
+         _mesa_debug(ctx, "%s(%u, %s, %d, %d)\n",<br>
+                     func, renderbuffer,<br>
+                     _mesa_lookup_enum_by_nr(internalFormat),<br>
+                     width, height);<br>
+      else<br>
+         _mesa_debug(ctx, "%s(%u, %s, %d, %d, %d)\n",<br>
+                     func, renderbuffer,<br>
+                     _mesa_lookup_enum_by_nr(internalFormat),<br>
+                     width, height, samples);<br>
+   }<br>
+<br>
+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);<br>
+   if (rb == &DummyRenderbuffer) {<br>
+      /* ID was reserved, but no real renderbuffer object made yet */<br>
+      rb = NULL;<br>
+   }<br>
+<br>
+   renderbuffer_storage(ctx, rb, internalFormat, width, height, samples, func);<br>
+}<br>
+<br>
+/**<br>
+ * Helper function used by _mesa_RenderbufferStorage() and<br>
+ * _mesa_RenderbufferStorageMultisample().<br>
+ * samples will be NO_SAMPLES if called by _mesa_RenderbufferStorage().<br>
+ */<br>
+static void<br>
+renderbuffer_storage_target(GLenum target, GLenum internalFormat,<br>
+                            GLsizei width, GLsizei height, GLsizei samples,<br>
+                            const char *func)<br>
+{<br>
+   GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+   if (MESA_VERBOSE & VERBOSE_API) {<br>
+      if (samples == NO_SAMPLES)<br>
+         _mesa_debug(ctx, "%s(%s, %s, %d, %d)\n",<br>
+                     func,<br>
+                     _mesa_lookup_enum_by_nr(target),<br>
+                     _mesa_lookup_enum_by_nr(internalFormat),<br>
+                     width, height);<br>
+      else<br>
+         _mesa_debug(ctx, "%s(%s, %s, %d, %d, %d)\n",<br>
+                     func,<br>
+                     _mesa_lookup_enum_by_nr(target),<br>
+                     _mesa_lookup_enum_by_nr(internalFormat),<br>
+                     width, height, samples);<br>
+   }<br>
+<br>
+   if (target != GL_RENDERBUFFER_EXT) {<br>
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);<br>
+      return;<br>
+   }<br>
+<br>
+   renderbuffer_storage(ctx, ctx->CurrentRenderbuffer, internalFormat, width,<br>
+                        height, samples, func);<br>
+}<br>
+<br>
<br>
 void GLAPIENTRY<br>
 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)<br>
@@ -1946,7 +1993,8 @@ _mesa_RenderbufferStorage(GLenum target, GLenum internalFormat,<br>
     * glRenderbufferStorageMultisample() with samples=0.  We pass in<br>
     * a token value here just for error reporting purposes.<br>
     */<br>
-   renderbuffer_storage(target, internalFormat, width, height, NO_SAMPLES);<br>
+   renderbuffer_storage_target(target, internalFormat, width, height,<br>
+                               NO_SAMPLES, "glRenderbufferStorage");<br>
 }<br>
<br>
<br>
@@ -1955,10 +2003,10 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,<br>
                                      GLenum internalFormat,<br>
                                      GLsizei width, GLsizei height)<br>
 {<br>
-   renderbuffer_storage(target, internalFormat, width, height, samples);<br>
+   renderbuffer_storage_target(target, internalFormat, width, height,<br>
+                               samples, "glRenderbufferStorageMultisample");<br>
 }<br>
<br>
-<br>
 /**<br>
  * OpenGL ES version of glRenderBufferStorage.<br>
  */<br>
@@ -1976,7 +2024,30 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,<br>
       break;<br>
    }<br>
<br>
-   renderbuffer_storage(target, internalFormat, width, height, 0);<br>
+   renderbuffer_storage_target(target, internalFormat, width, height, 0,<br>
+                               "glRenderBufferStorageEXT");<br></blockquote><div>Should be lowercase "b"---------------^ <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+}<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat,<br>
+                               GLsizei width, GLsizei height)<br>
+{<br>
+   /* GL_ARB_fbo says calling this function is equivalent to calling<br>
+    * glRenderbufferStorageMultisample() with samples=0.  We pass in<br>
+    * a token value here just for error reporting purposes.<br>
+    */<br>
+   renderbuffer_storage_named(renderbuffer, internalformat, width, height,<br>
+                               NO_SAMPLES, "glNamedRenderbufferStorage");<br></blockquote><div>Indent from here--------------^to here-^ <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+}<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples,<br>
+                                     GLenum internalformat,<br>
+                                     GLsizei width, GLsizei height)<br></blockquote><div>Indent from here--------------------^--to here-------------------^  <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+{<br>
+   renderbuffer_storage_named(renderbuffer, internalformat, width, height,<br>
+                               samples,<br>
+                               "glNamedRenderbufferStorageMultisample");<br></blockquote><div>Indent from here--------------^--to here^   <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 }<br>
<br>
<br>
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h<br>
index b92149b..93686cc 100644<br>
--- a/src/mesa/main/fbobject.h<br>
+++ b/src/mesa/main/fbobject.h<br>
@@ -130,6 +130,15 @@ extern void GLAPIENTRY<br>
 _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,<br>
                           GLsizei width, GLsizei height);<br>
<br>
+void GLAPIENTRY<br></blockquote><div>You forgot "extern" <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+_mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat,<br>
+                               GLsizei width, GLsizei height);<br></blockquote><div>Wrong indentation-----------^ <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+extern void GLAPIENTRY<br>
+_mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples,<br>
+                                          GLenum internalformat,<br>
+                                          GLsizei width, GLsizei height);<br></blockquote><div>Wrong indentation----------------------^  <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
 extern void GLAPIENTRY<br>
 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);<br>
<br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
index 1d7a57e..316a8df 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -962,6 +962,8 @@ const struct function gl_core_functions_possible[] = {<br>
    { "glGetTransformFeedbacki_v", 45, -1 },<br>
    { "glGetTransformFeedbacki64_v", 45, -1 },<br>
    { "glCreateRenderbuffers", 45, -1 },<br>
+   { "glNamedRenderbufferStorage", 45, -1 },<br>
+   { "glNamedRenderbufferStorageMultisample", 45, -1 },<br>
    { "glGetNamedRenderbufferParameteriv", 45, -1 },<br>
    { "glCreateTextures", 45, -1 },<br>
    { "glTextureStorage1D", 45, -1 },<br>
<span class=""><font color="#888888">--<br>
2.3.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>