summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-09-11 16:20:43 -0700
committerKenneth Graunke <kenneth@whitecape.org>2012-09-20 14:48:02 -0700
commite2249e8c4d06a85d6389ba1689e15d7e29aa4dff (patch)
tree86ee3de96395b7d73e8b52926d5874f669a820d5
parentc96828ecb46b5aee3121a018be365b738c35cbdc (diff)
i965/blorp: Add support for blits between SRGB and linear formats.
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>
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp7
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 fa7fee71cfd..54b3cebcdb6 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -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;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 656a497a678..6e156d0f00a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -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);
}