[Mesa-dev] [PATCH] mesa: fix glGetFramebufferAttachmentParameteriv w/ on-demand FRONT_BACK alloc

Nicolai Hähnle nhaehnle at gmail.com
Mon Sep 12 12:03:06 UTC 2016


Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 09.09.2016 16:06, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This fixes 66 CTS tests on st/mesa.
>
> Cc: 12.0 <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/main/fbobject.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 2c01526..09da6b7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -296,23 +296,35 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
>           return &fb->Attachment[BUFFER_FRONT_LEFT];
>        case GL_DEPTH:
>        return &fb->Attachment[BUFFER_DEPTH];
>        case GL_STENCIL:
>           return &fb->Attachment[BUFFER_STENCIL];
>        }
>     }
>
>     switch (attachment) {
>     case GL_FRONT_LEFT:
> -      return &fb->Attachment[BUFFER_FRONT_LEFT];
> +      /* Front buffers can be allocated on the first use, but
> +       * glGetFramebufferAttachmentParameteriv must work even if that
> +       * allocation hasn't happened yet. In such case, use the back buffer,
> +       * which should be the same.
> +       */
> +      if (fb->Attachment[BUFFER_FRONT_LEFT].Type == GL_NONE)
> +         return &fb->Attachment[BUFFER_BACK_LEFT];
> +      else
> +         return &fb->Attachment[BUFFER_FRONT_LEFT];
>     case GL_FRONT_RIGHT:
> -      return &fb->Attachment[BUFFER_FRONT_RIGHT];
> +      /* Same as above. */
> +      if (fb->Attachment[BUFFER_FRONT_RIGHT].Type == GL_NONE)
> +         return &fb->Attachment[BUFFER_BACK_RIGHT];
> +      else
> +         return &fb->Attachment[BUFFER_FRONT_RIGHT];
>     case GL_BACK_LEFT:
>        return &fb->Attachment[BUFFER_BACK_LEFT];
>     case GL_BACK_RIGHT:
>        return &fb->Attachment[BUFFER_BACK_RIGHT];
>     case GL_AUX0:
>        if (fb->Visual.numAuxBuffers == 1) {
>           return &fb->Attachment[BUFFER_AUX0];
>        }
>        return NULL;
>
>


More information about the mesa-dev mailing list