i965/blorp: Add support for blits between SRGB and linear formats.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 11 Sep 2012 23:20:43 +0000 (16:20 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 20 Sep 2012 21:48:02 +0000 (14:48 -0700)
Fixes colorspace issues in L4D2 when multisampling is enabled (the
scene was far too dark, but the flashlight area was way too bright).

The nVidia and AMD binary drivers both allow this kind of blit.

NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_blorp.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp

index fa7fee71cfd739b2178e7229c5005206346c2de8..54b3cebcdb6384d1fe1b9f490e0f0f71e7151565 100644 (file)
@@ -101,8 +101,9 @@ brw_blorp_surface_info::set(struct brw_context *brw,
        * target, even if this is the source image.  So we can convert to a
        * surface format using brw->render_target_format.
        */
-      assert(brw->format_supported_as_render_target[mt->format]);
-      this->brw_surfaceformat = brw->render_target_format[mt->format];
+      gl_format linear_format = _mesa_get_srgb_format_linear(mt->format);
+      assert(brw->format_supported_as_render_target[linear_format]);
+      this->brw_surfaceformat = brw->render_target_format[linear_format];
       break;
    }
 }
index 656a497a678b30ec4313f323db75605cf0adbc3d..6e156d0f00af487bfbe046631e3513b8e64bd77c 100644 (file)
@@ -180,8 +180,11 @@ formats_match(GLbitfield buffer_bit, struct intel_renderbuffer *src_irb,
     * example MESA_FORMAT_X8_Z24 and MESA_FORMAT_S8_Z24), and we can blit
     * between those formats.
     */
-   return find_miptree(buffer_bit, src_irb)->format ==
-      find_miptree(buffer_bit, dst_irb)->format;
+   gl_format src_format = find_miptree(buffer_bit, src_irb)->format;
+   gl_format dst_format = find_miptree(buffer_bit, dst_irb)->format;
+
+   return _mesa_get_srgb_format_linear(src_format) ==
+          _mesa_get_srgb_format_linear(dst_format);
 }