[Mesa-dev] [PATCH 22/38] main: Add entry point for BlitNamedFramebuffer.
Fredrik Höglund
fredrik at kde.org
Sun Apr 12 09:08:02 PDT 2015
On Wednesday 04 March 2015, Laura Ekstrand wrote:
> ---
> src/mapi/glapi/gen/ARB_direct_state_access.xml | 15 ++++++++
> src/mesa/main/blit.c | 50 ++++++++++++++++++++++++++
> src/mesa/main/blit.h | 6 ++++
> src/mesa/main/tests/dispatch_sanity.cpp | 1 +
> 4 files changed, 72 insertions(+)
>
> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> index 36de3c1..4e5ba0b 100644
> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> @@ -140,6 +140,21 @@
> <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" />
> diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
> index b6d6d75..e03b5dc 100644
> --- a/src/mesa/main/blit.c
> +++ b/src/mesa/main/blit.c
> @@ -524,3 +524,53 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
> dstX0, dstY0, dstX1, dstY1,
> mask, filter, "glBlitFramebuffer");
> }
There should be two empty lines between the functions here.
> +
> +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");
It occurs to me that it would be nice if _mesa_lookup_framebuffer_err
could let the user know which parameter is invalid, since there are two
framebuffers in this case.
But either way, and with the earlier nitpick fixed:
Reviewed-by: Fredrik Höglund <fredrik at kde.org>
> + 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 b854f5f..54b946e 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 a6d8523..891ae0f 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -974,6 +974,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 },
> { "glCreateTextures", 45, -1 },
>
More information about the mesa-dev
mailing list