[Mesa-dev] [PATCH 2/6] mesa: consolidate _mesa_source/dest_buffer_exists()
Eric Anholt
eric at anholt.net
Tue Oct 11 11:55:28 PDT 2011
On Mon, 10 Oct 2011 21:05:32 -0600, Brian Paul <brian.e.paul at gmail.com> wrote:
> From: Brian Paul <brianp at vmware.com>
>
> ---
> src/mesa/main/framebuffer.c | 117 +++++++++++-------------------------------
> 1 files changed, 31 insertions(+), 86 deletions(-)
>
> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
> index 8beda31..90ac2ef 100644
> --- a/src/mesa/main/framebuffer.c
> +++ b/src/mesa/main/framebuffer.c
> @@ -839,23 +839,24 @@ _mesa_update_framebuffer(struct gl_context *ctx)
>
>
> /**
> - * Check if the renderbuffer for a read operation (glReadPixels, glCopyPixels,
> - * glCopyTex[Sub]Image, etc) exists.
> + * Check if the renderbuffer for a read/draw operation exists.
> * \param format a basic image format such as GL_RGB, GL_RGBA, GL_ALPHA,
> * GL_DEPTH_COMPONENT, etc. or GL_COLOR, GL_DEPTH, GL_STENCIL.
> * \return GL_TRUE if buffer exists, GL_FALSE otherwise
> */
> -GLboolean
> -_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format)
> +static GLboolean
> +renderbuffer_exists(struct gl_context *ctx,
> + struct gl_framebuffer *fb,
> + GLenum format)
> {
> @@ -884,14 +885,14 @@ _mesa_source_buffer_exists(struct gl_context *ctx, GLenum format)
> case GL_BGRA_INTEGER_EXT:
> case GL_LUMINANCE_INTEGER_EXT:
> case GL_LUMINANCE_ALPHA_INTEGER_EXT:
> - if (ctx->ReadBuffer->_ColorReadBuffer == NULL) {
> + if (fb->_ColorReadBuffer == NULL) {
> return GL_FALSE;
> }
So this renderbuffer_exists fails out if !_ColorReadBuffer
...
> +/**
> * As above, but for drawing operations.
> * XXX could do some code merging w/ above function.
> */
> GLboolean
> _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format)
> {
...
> - switch (format) {
> - case GL_COLOR:
> - case GL_RED:
> - case GL_GREEN:
> - case GL_BLUE:
> - case GL_ALPHA:
> - case GL_LUMINANCE:
> - case GL_LUMINANCE_ALPHA:
> - case GL_INTENSITY:
> - case GL_RGB:
> - case GL_BGR:
> - case GL_RGBA:
> - case GL_BGRA:
> - case GL_ABGR_EXT:
> - case GL_RED_INTEGER_EXT:
> - case GL_GREEN_INTEGER_EXT:
> - case GL_BLUE_INTEGER_EXT:
> - case GL_ALPHA_INTEGER_EXT:
> - case GL_RGB_INTEGER_EXT:
> - case GL_RGBA_INTEGER_EXT:
> - case GL_BGR_INTEGER_EXT:
> - case GL_BGRA_INTEGER_EXT:
> - case GL_LUMINANCE_INTEGER_EXT:
> - case GL_LUMINANCE_ALPHA_INTEGER_EXT:
> - /* Nothing special since GL_DRAW_BUFFER could be GL_NONE. */
> - /* Could assert that colorbuffer has RedBits > 0 */
> - break;
...
> + return renderbuffer_exists(ctx, ctx->DrawBuffer, format);
> }
And now _mesa_dest_buffer_exists() will fail if !_ColorReadBuffer. That
doesn't seem intentional.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111011/d7a16e7f/attachment.pgp>
More information about the mesa-dev
mailing list