llvmpipe, gallivm: implement lod queries (LODQ opcode)
authorRoland Scheidegger <sroland@vmware.com>
Mon, 18 Sep 2017 02:52:26 +0000 (04:52 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 20 Sep 2017 19:18:54 +0000 (21:18 +0200)
commit886626960bca51bdfc0880e3830c0a95ea143c4c
tree8952af710d282250a2b1565d24bec1c35784bf16
parent4b41361894214de7f34c555dbd6f60983967db39
llvmpipe, gallivm: implement lod queries (LODQ opcode)

This uses all the existing code to calculate lod values for mip linear
filtering. Though we'll have to disable the simplifications (if we know some
parts of the lod calculation won't actually matter for filtering purposes due
to mip clamps etc.). For better or worse, we'll also disable lod calculation
hacks (mostly should make a difference for cube maps) always - the issue with
per-pixel lod being difficult is mostly because we then have different mipmaps
needed for the actual texel fetch, which isn't a problem with lodq.
We still use approximation for the log2 - for that reason I believe the float
part of the lod is only accurate to about 4-5 bits (and one bit less with 1d
textures actually) which is hopefully good enough (though d3d10 technically
requires 6 bits - could use quadratic interpolation instead of linear to get
8 bits or so).
Since lodq requires unclamped lod, we also have to move some sampler key
calculations to texture sampling code - even if we know we're going to access
mipmap 0 we still have to calculate lod and apply lod_bias for lodq.

Passes piglit ARB_texture_query_lod tests (after having fixed the test).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
docs/features.txt
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/drivers/llvmpipe/lp_screen.c