[Mesa-dev] [PATCH 10/23] framebuffer: add _mesa_get_read_renderbuffer

Ian Romanick idr at freedesktop.org
Mon Jan 7 10:40:21 PST 2013


On 01/04/2013 06:41 PM, Jordan Justen wrote:
> This returns the current read renderbuffer for the specified
> format type.
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>   src/mesa/main/framebuffer.c |   20 ++++++++++++++++++++
>   src/mesa/main/framebuffer.h |    4 ++++
>   2 files changed, 24 insertions(+)
>
> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
> index 13887f8..3b6dc97 100644
> --- a/src/mesa/main/framebuffer.c
> +++ b/src/mesa/main/framebuffer.c
> @@ -42,6 +42,7 @@
>   #include "framebuffer.h"
>   #include "renderbuffer.h"
>   #include "texobj.h"
> +#include "glformats.h"
>
>
>
> @@ -899,6 +900,25 @@ _mesa_get_color_read_type(struct gl_context *ctx)
>
>
>   /**
> + * Returns the read renderbuffer for the specified format.
> + */
> +struct gl_renderbuffer *
> +_mesa_get_read_renderbuffer(struct gl_context *ctx, GLenum format)

I would call this _mesa_get_read_renderbuffer_for_format.  It's more 
wordy, but it makes it more clear what it's doing.

> +{
> +   struct gl_framebuffer *rfb = ctx->ReadBuffer;
> +
> +   if (_mesa_is_color_format(format)) {
> +      return rfb->Attachment[rfb->_ColorReadBufferIndex].Renderbuffer;
> +   } else if (_mesa_is_depth_format(format) ||
> +              _mesa_is_depthstencil_format(format)) {
> +      return rfb->Attachment[BUFFER_DEPTH].Renderbuffer;
> +   } else {
> +      return rfb->Attachment[BUFFER_STENCIL].Renderbuffer;
> +   }
> +}
> +
> +
> +/**
>    * Print framebuffer info to stderr, for debugging.
>    */
>   void
> diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
> index ad53d8c..1f2c8b5 100644
> --- a/src/mesa/main/framebuffer.h
> +++ b/src/mesa/main/framebuffer.h
> @@ -30,6 +30,7 @@
>
>   struct gl_config;
>   struct gl_context;
> +struct gl_renderbuffer;
>
>   extern struct gl_framebuffer *
>   _mesa_create_framebuffer(const struct gl_config *visual);
> @@ -96,6 +97,9 @@ _mesa_get_color_read_type(struct gl_context *ctx);
>   extern GLenum
>   _mesa_get_color_read_format(struct gl_context *ctx);
>
> +extern struct gl_renderbuffer *
> +_mesa_get_read_renderbuffer(struct gl_context *ctx, GLenum format);
> +
>   extern void
>   _mesa_print_framebuffer(const struct gl_framebuffer *fb);
>
>



More information about the mesa-dev mailing list