i965/blorp: Allow format conversions for CopyTexSubImage.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 30 Sep 2013 05:22:52 +0000 (22:22 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Oct 2013 23:36:50 +0000 (16:36 -0700)
commitb330125790498f44e5325ef30b7a1e0fd7245680
tree4f732acbd9d5173d204fc7300e687b1326ffd4dc
parent72aade48fe7d4c4099ef713887c06b3aaacf1acd
i965/blorp: Allow format conversions for CopyTexSubImage.

BLORP performs blits by drawing a rectangle with a shader that samples
from the source texture, and writes color data to the destination.

The sampler always returns 32-bit RGBA float data, regardless of the
source format's component ordering or data type.  Likewise, the render
target write message takes 32-bit RGBA float data, and converts it
appropriately.  So the bulk of the work is already taken care of for us.

This greatly accelerates a lot of CopyTexSubImage calls, and makes
Legends of Aethereus playable on Ivybridge.  At the default settings,
LOA continually blits between SRGBA8888 (the window format) and
RGBA16_FLOAT.  Since neither BLORP nor our BLT paths supported this,
it fell back to meta, spending 33% of the CPU in floorf() converting
between floats and half-floats.

v2: Use != instead of ^ (suggested by Ian).  Note that only
    CopyTexSubImage is affected by this patch (caught by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp