mesa: add LodBias quantization from st/mesa
authorMarek Olšák <marek.olsak@amd.com>
Sun, 6 Jun 2021 18:08:33 +0000 (14:08 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 27 Jun 2021 14:28:39 +0000 (10:28 -0400)
commit9ea8f67a1ee379a14d3f401599da275df81dcfa6
tree1ee3e25d1fb6b01d92947b5de303bfe9b5846e2a
parent0c70a63f5fb6713b5c1e35c96bdc7411c41386d6
mesa: add LodBias quantization from st/mesa

Apparently the quantization math isn't cheap.

This further reduces overhead by 2% for drawoverhead/8 textures.
The improvement is measured by looking at the sysprof percentage delta and
multiplying by 2 (because we have the frontend and gallium threads with
equal overhead, so the benefit is doubled compared to 1 thread).

Both per-sampler and per-unit lod bias values are quantized.

The difference in behavior is that both values are quantized separately
and then added up, instead of first added up and then quantized.
The worst case error is +- 1/256 in the reduced precision, i.e. off by one
in a fixed-point representation, which should be fine.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>
src/mesa/main/attrib.c
src/mesa/main/mtypes.h
src/mesa/main/samplerobj.c
src/mesa/main/texenv.c
src/mesa/main/texparam.c
src/mesa/main/texstate.c
src/mesa/state_tracker/st_atom_sampler.c
src/util/u_math.h