summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-02-02 16:27:46 -0800
committerFredrik Höglund <[email protected]>2015-05-14 15:48:14 +0200
commit47b910d27587f738dd81cdb9a879726785c0bc54 (patch)
tree17f7eb70d79478d0143c074c33e886d06a443b46 /src/mesa
parentb590c617256720e82fff0428a5e0e4a64115fac2 (diff)
main: Add entry point for BlitNamedFramebuffer.
Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/blit.c51
-rw-r--r--src/mesa/main/blit.h6
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp1
3 files changed, 58 insertions, 0 deletions
diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
index 6c78686a59a..baf3165ff9d 100644
--- a/src/mesa/main/blit.c
+++ b/src/mesa/main/blit.c
@@ -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");
+}
diff --git a/src/mesa/main/blit.h b/src/mesa/main/blit.h
index b854f5f84c6..54b946e3192 100644
--- a/src/mesa/main/blit.h
+++ b/src/mesa/main/blit.h
@@ -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 */
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index f3aff5f9fa8..ec3c9927162 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -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 },