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

Marek Olšák maraeo at gmail.com
Thu Mar 3 23:04:16 PST 2011


On Fri, Mar 4, 2011 at 7:35 AM, Brian Paul <brian.e.paul at gmail.com> wrote:

> How about:
>
>  format = util_format_linear(format);
>

Yeah, that's nicer, thanks. :) I am going to push this later today if there
are no objections.

Marek

diff --git a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index c3c4246..3f98ffd 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -227,8 +227,15 @@ 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. */
+      format = util_format_linear(format);
+
+      if (screen->is_format_supported(screen, format, target, 0, bindings,
geom))
+         return bindings;
+      else
+         return PIPE_BIND_SAMPLER_VIEW;
+   }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110304/25fb74a5/attachment.html>


More information about the mesa-dev mailing list