st/mesa: set PIPE_BIND_RENDER_TARGET for sRGB formats if UNORM is supported
authorMarek Olšák <maraeo@gmail.com>
Fri, 4 Mar 2011 05:38:13 +0000 (06:38 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 4 Mar 2011 13:52:45 +0000 (14:52 +0100)
Because the format can be changed to UNORM in a surface.

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

index c3c4246d139908591734920a0b0feb7fa4ce0027..3f98ffd3d6f503315144e78d7154e62800da4573 100644 (file)
@@ -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;
+   }
 }