main: Add entry point for BlitNamedFramebuffer.
authorLaura Ekstrand <laura@jlekstrand.net>
Tue, 3 Feb 2015 00:27:46 +0000 (16:27 -0800)
committerFredrik Höglund <fredrik@kde.org>
Thu, 14 May 2015 13:48:14 +0000 (15:48 +0200)
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/blit.c
src/mesa/main/blit.h
src/mesa/main/tests/dispatch_sanity.cpp

index beb6249a6f7bd1e1301e0e78d624abf65360c55e..7ee2000d86ea1904221a499a9c3df54d463458da 100644 (file)
       <param name="layer" type="GLint" />
    </function>
 
+   <function name="BlitNamedFramebuffer" offset="assign">
+      <param name="readFramebuffer" type="GLuint" />
+      <param name="drawFramebuffer" type="GLuint" />
+      <param name="srcX0" type="GLint" />
+      <param name="srcY0" type="GLint" />
+      <param name="srcX1" type="GLint" />
+      <param name="srcY1" type="GLint" />
+      <param name="dstX0" type="GLint" />
+      <param name="dstY0" type="GLint" />
+      <param name="dstX1" type="GLint" />
+      <param name="dstY1" type="GLint" />
+      <param name="mask" type="GLbitfield" />
+      <param name="filter" type="GLenum" />
+   </function>
+
    <function name="CheckNamedFramebufferStatus" offset="assign">
       <return type="GLenum" />
       <param name="framebuffer" type="GLuint" />
index 6c78686a59aba7bdb1a07e79f45251584bc63fd5..baf3165ff9d5c1e10d955411458dfc5d5be2cea3 100644 (file)
@@ -526,3 +526,54 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
                           dstX0, dstY0, dstX1, dstY1,
                           mask, filter, "glBlitFramebuffer");
 }
+
+
+void GLAPIENTRY
+_mesa_BlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer,
+                           GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+                           GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+                           GLbitfield mask, GLenum filter)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_framebuffer *readFb, *drawFb;
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx,
+                  "glBlitNamedFramebuffer(%u %u %d, %d, %d, %d, "
+                  " %d, %d, %d, %d, 0x%x, %s)\n",
+                  readFramebuffer, drawFramebuffer,
+                  srcX0, srcY0, srcX1, srcY1,
+                  dstX0, dstY0, dstX1, dstY1,
+                  mask, _mesa_lookup_enum_by_nr(filter));
+
+   /*
+    * According to PDF page 533 of the OpenGL 4.5 core spec (30.10.2014,
+    * Section 18.3 Copying Pixels):
+    *   "... if readFramebuffer or drawFramebuffer is zero (for
+    *   BlitNamedFramebuffer), then the default read or draw framebuffer is
+    *   used as the corresponding source or destination framebuffer,
+    *   respectively."
+    */
+   if (readFramebuffer) {
+      readFb = _mesa_lookup_framebuffer_err(ctx, readFramebuffer,
+                                            "glBlitNamedFramebuffer");
+      if (!readFb)
+         return;
+   }
+   else
+      readFb = ctx->WinSysReadBuffer;
+
+   if (drawFramebuffer) {
+      drawFb = _mesa_lookup_framebuffer_err(ctx, drawFramebuffer,
+                                            "glBlitNamedFramebuffer");
+      if (!drawFb)
+         return;
+   }
+   else
+      drawFb = ctx->WinSysDrawBuffer;
+
+   _mesa_blit_framebuffer(ctx, readFb, drawFb,
+                          srcX0, srcY0, srcX1, srcY1,
+                          dstX0, dstY0, dstX1, dstY1,
+                          mask, filter, "glBlitNamedFramebuffer");
+}
index b854f5f84c657b3c26a87c6cdc49e91b5794c6d4..54b946e3192941a418b02aedd506eeeb189e89f9 100644 (file)
@@ -41,5 +41,11 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
                          GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
                          GLbitfield mask, GLenum filter);
 
+extern void GLAPIENTRY
+_mesa_BlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer,
+                           GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+                           GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+                           GLbitfield mask, GLenum filter);
+
 
 #endif /* BLIT_H */
index f3aff5f9fa861d9b7badd6b2943b58ca30cd3a73..ec3c99271625f56fd6801f49f8847187f37d5e06 100644 (file)
@@ -984,6 +984,7 @@ const struct function gl_core_functions_possible[] = {
    { "glNamedFramebufferRenderbuffer", 45, -1 },
    { "glNamedFramebufferTexture", 45, -1 },
    { "glNamedFramebufferTextureLayer", 45, -1 },
+   { "glBlitNamedFramebuffer", 45, -1 },
    { "glCheckNamedFramebufferStatus", 45, -1 },
    { "glGetNamedFramebufferAttachmentParameteriv", 45, -1 },
    { "glCreateRenderbuffers", 45, -1 },