r300g: fix sRGB->sRGB blits
authorMarek Olšák <marek.olsak@amd.com>
Mon, 9 Mar 2015 20:20:03 +0000 (21:20 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 9 Mar 2015 20:22:22 +0000 (21:22 +0100)
Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/r300/r300_blit.c

index 4e7efc560a49e0c6537fb457267598c72121129f..baf05cea965226cd46b050ee67fd0570d4dad0b7 100644 (file)
@@ -803,6 +803,15 @@ static void r300_blit(struct pipe_context *pipe,
         (struct pipe_framebuffer_state*)r300->fb_state.state;
     struct pipe_blit_info info = *blit;
 
+    /* The driver supports sRGB textures but not framebuffers. Blitting
+     * from sRGB to sRGB should be the same as blitting from linear
+     * to linear, so use that, This avoids incorrect linearization.
+     */
+    if (util_format_is_srgb(info.src.format)) {
+      info.src.format = util_format_linear(info.src.format);
+      info.dst.format = util_format_linear(info.dst.format);
+    }
+
     /* MSAA resolve. */
     if (info.src.resource->nr_samples > 1 &&
         !util_format_is_depth_or_stencil(info.src.resource->format)) {