[Mesa-dev] [PATCH] st/mesa: fix accum buffer allocation in st_renderbuffer_alloc_storage()

Jose Fonseca jfonseca at vmware.com
Tue Nov 22 03:48:19 PST 2011



----- Original Message -----
> If the gallium driver doesn't support PIPE_FORMAT_R16G16B16A16_SNORM
> the call to st_choose_renderbuffer_format() would fail and we'd
> generate
> an GL_OUT_OF_MEMORY error.  We'd never get to the subsequent code
> that
> handles software/malloc-based renderbuffers.
>
> Add a special-case check for PIPE_FORMAT_R16G16B16A16_SNORM which is
> used
> for software-based accum buffers.  This could be fixed in other ways
> but
> it would be a much larger patch.  st_renderbuffer_alloc_storage()
> could
> be reorganized in the future.
>
> This fixes accum buffer allocation for the svga driver.
> ---
>  src/mesa/state_tracker/st_cb_fbo.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c
> b/src/mesa/state_tracker/st_cb_fbo.c
> index a351d11..45f417e 100644
> --- a/src/mesa/state_tracker/st_cb_fbo.c
> +++ b/src/mesa/state_tracker/st_cb_fbo.c
> @@ -75,8 +75,14 @@ st_renderbuffer_alloc_storage(struct gl_context *
> ctx,
>     enum pipe_format format;
>     struct pipe_surface surf_tmpl;
>  
> -   format = st_choose_renderbuffer_format(screen, internalFormat,
> -                                          rb->NumSamples);
> +   if (internalFormat == GL_RGBA16_SNORM && strb->software) {
> +      /* special case for software accum buffers */

Looks good Brian.

But before commiting, I think it would be worth to add some of the commit comment text above here, so that it's clear why a special case is necessary, without having to use git blame.

Jose

> +      format = PIPE_FORMAT_R16G16B16A16_SNORM;
> +   }
> +   else {
> +      format = st_choose_renderbuffer_format(screen, internalFormat,
> +                                             rb->NumSamples);
> +   }
>  
>     if (format == PIPE_FORMAT_NONE) {
>        return FALSE;
> --
> 1.7.3.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list