[Mesa-dev] [PATCH] st/mesa: set PIPE_BIND_RENDER_TARGET for sRGB formats if UNORM is supported

Brian Paul brian.e.paul at gmail.com
Thu Mar 3 22:35:33 PST 2011


On Thu, Mar 3, 2011 at 10:41 PM, Marek Olšák <maraeo at gmail.com> wrote:
> Because the format can be changed to UNORM in a sampler view.
>
> This fixes:
> state_tracker/st_atom_framebuffer.c:163:update_framebuffer_state:
> Assertion `framebuffer->cbufs[i]->texture->bind & (1 << 1)' failed.
> ---
>  src/mesa/state_tracker/st_cb_texture.c |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index c3c4246..1e793dc 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -227,8 +227,17 @@ default_bindings(struct st_context *st, enum pipe_format format)
>
>    if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
>       return bindings;
> -   else
> -      return PIPE_BIND_SAMPLER_VIEW;
> +   else {
> +      /* Try non-sRGB. */
> +      const gl_format linearFormat =
> +         _mesa_get_srgb_format_linear(st_pipe_format_to_mesa_format(format));
> +      format = st_mesa_format_to_pipe_format(linearFormat);

How about:

  format = util_format_linear(format);


> +
> +      if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
> +         return bindings;
> +      else
> +         return PIPE_BIND_SAMPLER_VIEW;
> +   }
>  }
>
>
> --
> 1.7.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

-Brian


More information about the mesa-dev mailing list