[Mesa-dev] [PATCH 36/38] main: Add entry point for NamedFramebufferReadBuffer.

Fredrik Höglund fredrik at kde.org
Thu Apr 16 10:18:38 PDT 2015


On Wednesday 04 March 2015, Laura Ekstrand wrote:
> ---
>  src/mapi/glapi/gen/ARB_direct_state_access.xml |  5 +++++
>  src/mesa/main/buffers.c                        | 18 ++++++++++++++++++
>  src/mesa/main/buffers.h                        |  3 +++
>  src/mesa/main/tests/dispatch_sanity.cpp        |  1 +
>  4 files changed, 27 insertions(+)
> 
> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> index c472163..1bdb29c 100644
> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> @@ -151,6 +151,11 @@
>        <param name="mode" type="GLenum" />
>     </function>
>  
> +   <function name="NamedFramebufferReadBuffer" offset="assign">
> +      <param name="framebuffer" type="GLuint" />
> +      <param name="mode" type="GLenum" />

The parameter name should be "src", not "mode".

With that fixed, this patch is:

Reviewed-by: Fredrik Höglund <fredrik at kde.org>

> +   </function>
> +
>     <function name="InvalidateNamedFramebufferData" offset="assign">
>        <param name="framebuffer" type="GLuint" />
>        <param name="numAttachments" type="GLsizei" />
> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
> index e244d1e..d0627b5 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -700,3 +700,21 @@ _mesa_ReadBuffer(GLenum buffer)
>     GET_CURRENT_CONTEXT(ctx);
>     _mesa_read_buffer(ctx, ctx->ReadBuffer, buffer, "glReadBuffer");
>  }
> +
> +void GLAPIENTRY
> +_mesa_NamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   struct gl_framebuffer *fb;
> +
> +   if (framebuffer) {
> +      fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
> +                                        "glNamedFramebufferReadBuffer");
> +      if (!fb)
> +         return;
> +   }
> +   else
> +      fb = ctx->WinSysReadBuffer;
> +
> +   _mesa_read_buffer(ctx, fb, src, "glNamedFramebufferReadBuffer");
> +}
> diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
> index ca7ad19..52a2318 100644
> --- a/src/mesa/main/buffers.h
> +++ b/src/mesa/main/buffers.h
> @@ -71,5 +71,8 @@ _mesa_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
>  extern void GLAPIENTRY
>  _mesa_ReadBuffer( GLenum mode );
>  
> +extern void GLAPIENTRY
> +_mesa_NamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);
> +
>  
>  #endif
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index 16caf24..0afb650 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -976,6 +976,7 @@ const struct function gl_core_functions_possible[] = {
>     { "glNamedFramebufferTexture", 45, -1 },
>     { "glNamedFramebufferTextureLayer", 45, -1 },
>     { "glNamedFramebufferDrawBuffer", 45, -1 },
> +   { "glNamedFramebufferReadBuffer", 45, -1 },
>     { "glInvalidateNamedFramebufferSubData", 45, -1 },
>     { "glInvalidateNamedFramebufferData", 45, -1 },
>     { "glClearNamedFramebufferiv", 45, -1 },
> 



More information about the mesa-dev mailing list