gallivm: handle 16bit float fetches in lp_build_fetch_rgba_soa
authorRoland Scheidegger <sroland@vmware.com>
Sat, 3 Dec 2016 16:10:46 +0000 (17:10 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 6 Dec 2016 19:06:06 +0000 (20:06 +0100)
commitfd5f420fbb237a9662532a4111e409f5ec2eba8a
tree93f30b1a83d76e007344d37fe97aebc59550ecc6
parent775a2446450fc71cb43e48ece9b59f0412c067fd
gallivm: handle 16bit float fetches in lp_build_fetch_rgba_soa

Note that we really want to _never_ reach the bottom of the function, which
resorts to AoS fetch.
Half floats can be handled just like other formats which fit into 32bit
vectors (so, only 1x16 and 2x16 formats, albeit with more channels things
are not THAT bad), with minimal plumbing. I've seen code size go down nearly
by a factor of 3 for a complete texture sampling function (including bilinear
filtering) using R16F.
(What we should do for everything not special cased is to do AoS gather,
shuffle/shift things into SoA vectors, and then do the conversion there.
Otherwise it's particularly bad with 1 or 2 channel formats - that r16f
format with either 4 or 8-wide vectors was still doing one element at a
time, essentially doing exactly the same work as for rgba16f. Also replacing
the channels with SWIZZLE0/1 (particularly the latter) adds even more
work, as it has to be done per aos vector, and not just straightforward
at the end with the SoA vector.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c