[Mesa-dev] [PATCH 1/4] mesa: if AllocStorage doesn't choose a format, report FRAMEBUFFER_UNSUPPORTED

Brian Paul brian.e.paul at gmail.com
Fri Jun 15 13:24:41 PDT 2012


On Fri, Jun 15, 2012 at 11:07 AM, Marek Olšák <maraeo at gmail.com> wrote:
> This allows drivers not to do any allocation in AllocStorage if the storage
> cannot be allocated because of an unsupported internalformat + samples combo.
>
> The little ugliness is that AllocStorage is expected to return TRUE in this
> case.
> ---
>  src/mesa/main/fbobject.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 777783e..cfaea62 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -805,6 +805,15 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>             return;
>          }
>       }
> +
> +      /* Check that the format is valid. (MESA_FORMAT_NONE means unsupported)
> +       */
> +      if (att->Type == GL_RENDERBUFFER &&
> +          att->Renderbuffer->Format == MESA_FORMAT_NONE) {
> +         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
> +         fbo_incomplete("unsupported renderbuffer format", i);
> +         return;
> +      }
>    }
>
>  #if FEATURE_GL
> @@ -1394,7 +1403,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
>    ASSERT(rb->AllocStorage);
>    if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
>       /* No error - check/set fields now */
> -      assert(rb->Format != MESA_FORMAT_NONE);
> +      /* If rb->Format == MESA_FORMAT_NONE, the format is unsupported. */
>       assert(rb->Width == (GLuint) width);
>       assert(rb->Height == (GLuint) height);
>       rb->InternalFormat = internalFormat;
> --

The series looks good to me.

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list