[Mesa-dev] [PATCH 34/38] main: Add entry point for NamedFramebufferDrawBuffer.

Fredrik Höglund fredrik at kde.org
Thu Apr 16 10:01:57 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 025a1a8..c472163 100644
> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> @@ -146,6 +146,11 @@
>        <param name="layer" type="GLint" />
>     </function>
>  
> +   <function name="NamedFramebufferDrawBuffer" offset="assign">
> +      <param name="framebuffer" type="GLuint" />
> +      <param name="mode" type="GLenum" />

The parameter name should be "buf", 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 023d7dd..8d95c68 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -297,6 +297,24 @@ _mesa_DrawBuffer(GLenum buffer)
>     _mesa_draw_buffer(ctx, ctx->DrawBuffer, buffer, "glDrawBuffer");
>  }
>  
> +void GLAPIENTRY
> +_mesa_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   struct gl_framebuffer *fb;
> +
> +   if (framebuffer) {
> +      fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
> +                                        "glNamedFramebufferDrawBuffer");
> +      if (!fb)
> +         return;
> +   }
> +   else
> +      fb = ctx->WinSysDrawBuffer;
> +
> +   _mesa_draw_buffer(ctx, fb, buf, "glNamedFramebufferDrawBuffer");
> +}
> +
>  
>  /**
>   * Called by glDrawBuffersARB; specifies the destination color renderbuffers
> diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
> index 4192afd..12d5743 100644
> --- a/src/mesa/main/buffers.h
> +++ b/src/mesa/main/buffers.h
> @@ -46,6 +46,9 @@ extern void GLAPIENTRY
>  _mesa_DrawBuffer( GLenum mode );
>  
>  extern void GLAPIENTRY
> +_mesa_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);
> +
> +extern void GLAPIENTRY
>  _mesa_DrawBuffers(GLsizei n, const GLenum *buffers);
>  
>  extern void
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index 01a3d14..16caf24 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -975,6 +975,7 @@ const struct function gl_core_functions_possible[] = {
>     { "glNamedFramebufferParameteri", 45, -1 },
>     { "glNamedFramebufferTexture", 45, -1 },
>     { "glNamedFramebufferTextureLayer", 45, -1 },
> +   { "glNamedFramebufferDrawBuffer", 45, -1 },
>     { "glInvalidateNamedFramebufferSubData", 45, -1 },
>     { "glInvalidateNamedFramebufferData", 45, -1 },
>     { "glClearNamedFramebufferiv", 45, -1 },
> 



More information about the mesa-dev mailing list