i965/blorp: Fix sRGB MSAA resolves.
authorPaul Berry <stereotype441@gmail.com>
Mon, 24 Sep 2012 12:38:32 +0000 (05:38 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 25 Sep 2012 00:03:36 +0000 (17:03 -0700)
commit124b214f094fa63ff1ddb7e9f0a1c2e0ba8214fb
treed2d84460e8d39991d7adecc1041f07dcf49a889a
parent5fdf1f784bf449d7ce9839506fa23c5357696c4c
i965/blorp: Fix sRGB MSAA resolves.

Commit e2249e8c4d06a85d6389ba1689e15d7e29aa4dff (i965/blorp: Add
support for blits between SRGB and linear formats) changed blorp to
always configure surface states for in linear format (even if the
underlying surface is sRGB).  This allowed sRGB-to-linear and
linear-to-sRGB blits to occur without causing the image to be
inappropriately brightened or darkened.

However, it broke sRGB MSAA resolves, since they rely on the
destination buffer format being sRGB in order to ensure that samples
are averaged together in sRGB-correct fashion.

This patch fixes the problem by instead configuring the source buffer
to use the *same* format as the destination buffer.  This ensures that
the image won't be brightened or darkened, but preserves proper sRGB
averaging.

Fixes piglit tests "EXT_framebuffer_multisample/accuracy srgb".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55265

NOTE: This is a candidate for stable release branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_blorp.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp