[Mesa-dev] [PATCH 2/2] i965/blorp: Add support for blits between SRGB and linear formats.

Kenneth Graunke kenneth at whitecape.org
Tue Sep 11 16:24:05 PDT 2012


Fixes colorspace issues in L4D2 when multisampling is enabled (the
scene was far too dark, but the flashlight area was way too bright).

NOTE: This is a candidate for the 9.0 branch.

Cc: Paul Berry <stereotype441 at gmail.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp      | 5 +++--
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 7 +++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 9017e4d..e4451f3 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -97,8 +97,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;
    }
 }
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 1e49ac5..c6c24b1 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -175,8 +175,11 @@ formats_match(GLbitfield buffer_bit, struct gl_renderbuffer *src_rb,
     * example MESA_FORMAT_X8_Z24 and MESA_FORMAT_S8_Z24), and we can blit
     * between those formats.
     */
-   return find_miptree(buffer_bit, src_rb)->format ==
-      find_miptree(buffer_bit, dst_rb)->format;
+   gl_format src_format = find_miptree(buffer_bit, src_rb)->format;
+   gl_format dst_format = find_miptree(buffer_bit, dst_rb)->format;
+
+   return _mesa_get_srgb_format_linear(src_format) ==
+          _mesa_get_srgb_format_linear(dst_format);
 }
 
 
-- 
1.7.11.4



More information about the mesa-dev mailing list