diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp.cpp | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 13 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp index 54b3cebcdb..77b9f8fb3c 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp @@ -95,15 +95,13 @@ brw_blorp_surface_info::set(struct brw_context *brw, this->brw_surfaceformat = BRW_SURFACEFORMAT_R8G8_UNORM; break; default: - /* Blorp blits don't support any sort of format conversion, so we can - * safely assume that the same format is being used for the source and - * destination. Therefore the format must be supported as a render - * target, even if this is the source image. So we can convert to a - * surface format using brw->render_target_format. + /* Blorp blits don't support any sort of format conversion (except + * between sRGB and linear), so we can safely assume that the format is + * supported as a render target, even if this is the source image. So + * we can convert to a surface format using brw->render_target_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]; + assert(brw->format_supported_as_render_target[mt->format]); + this->brw_surfaceformat = brw->render_target_format[mt->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 034c701957..e8604e7019 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1641,6 +1641,19 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw, src.set(brw, src_mt, src_level, src_layer); dst.set(brw, dst_mt, dst_level, dst_layer); + /* If we are blitting from sRGB to linear or vice versa, we still want the + * blit to be a direct copy, so we need source and destination to use the + * same format. However, we want the destination sRGB/linear state to be + * correct (so that sRGB blending is used when doing an MSAA resolve to an + * sRGB surface, and linear blending is used when doing an MSAA resolve to + * a linear surface). Since blorp blits don't support any format + * conversion (except between sRGB and linear), we can accomplish this by + * simply setting up the source to use the same format as the destination. + */ + assert(_mesa_get_srgb_format_linear(src_mt->format) == + _mesa_get_srgb_format_linear(dst_mt->format)); + src.brw_surfaceformat = dst.brw_surfaceformat; + use_wm_prog = true; memset(&wm_prog_key, 0, sizeof(wm_prog_key)); |