st/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support
authorMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jul 2013 20:29:04 +0000 (22:29 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jul 2013 20:36:20 +0000 (22:36 +0200)
https://bugs.freedesktop.org/show_bug.cgi?id=59322

Cc: mesa-stable@lists.freedesktop.org
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_format.c

index 826722be862d5b82567782bb6d6634a8eb3f515f..77aaccd0489be1d3f170de1dc7fb8d862059282c 100644 (file)
@@ -37,6 +37,7 @@
 #include "main/context.h"
 #include "main/fbobject.h"
 #include "main/framebuffer.h"
+#include "main/glformats.h"
 #include "main/macros.h"
 #include "main/renderbuffer.h"
 
@@ -132,6 +133,13 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
    pipe_surface_reference( &strb->surface, NULL );
    pipe_resource_reference( &strb->texture, NULL );
 
+   /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+    * formats.
+    */
+   if (!ctx->Extensions.EXT_framebuffer_sRGB) {
+      internalFormat = _mesa_get_linear_internalformat(internalFormat);
+   }
+
    /* Handle multisample renderbuffers first.
     *
     * From ARB_framebuffer_object:
index 16d977fc9ae3aba10e673043edd1b521a178b1a1..64bfd1faaff9da293cf1d54225fba42aaa2461f9 100644 (file)
@@ -1782,6 +1782,13 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target,
    else
       bind = PIPE_BIND_RENDER_TARGET;
 
+   /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+    * formats.
+    */
+   if (!ctx->Extensions.EXT_framebuffer_sRGB) {
+      internalFormat = _mesa_get_linear_internalformat(internalFormat);
+   }
+
    /* Set sample counts in descending order. */
    for (i = 16; i > 1; i--) {
       format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE,