diff options
author | Roland Scheidegger <[email protected]> | 2013-08-29 03:58:18 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-08-30 02:16:45 +0200 |
commit | 81cfcdbd87940914fc3c59acd0e43c4f6efb3bb7 (patch) | |
tree | d2dfec96dd8e5cd436a09fd5751fd4af8bbe6d82 /src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | |
parent | 10e40ad11d5ed7f2d286837f92f8b63547f3db0b (diff) |
gallivm: don't calculate square root of rho if we use accurate rho method
While a sqrt here and there shouldn't hurt much (depending on the cpu) it is
possible to completely omit it since rho is only used for calculating lod and
there log2(x) == 0.5*log2(x^2). Depending on the exact path taken for
calculating lod this means we get a simple mul instead of sqrt (in case of
nearest mip filter in fact we don't need to replace the sqrt with something
else at all), only in some not very useful path this doesn't work (combined
brilinear calculation of int level and fractional lod, accurate rho calc but
brilinear filtering seems odd).
Apart from being faster as an added bonus this should increase our crappy
fractional accuracy of lod, since fast_log2 is only good for ~3bits and this
should increase accuracy by one bit (though not used if dimension is just one
as we'd need an extra mul there as we never had the squared rho in the first
place).
v2: use separate ilog2_sqrt function if we have squared rho.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c')
0 files changed, 0 insertions, 0 deletions