gallium,mesa/st: Add PIPE_CONTEXT_NO_LOD_BIAS flag
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 4 Sep 2023 13:34:59 +0000 (09:34 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 5 Sep 2023 18:50:34 +0000 (18:50 +0000)
commit2adb0f31fc9a16cbfbc26752a14a4d94e5556f82
tree4fce268466a5042f3729bb392d6bd33651f54fc6
parent6269b60a1ce5d02bd54b4ca4e1351f96fb64b211
gallium,mesa/st: Add PIPE_CONTEXT_NO_LOD_BIAS flag

While desktop GL supports sampler LOD bias, GLES does not. To support the GL use
case, all Gallium drivers are expected to handle sampler LOD bias. However, this
may require shader code to implement (lowering tex to txb, txl to fadd+txl) and
cost resources to push the LOD bias constants into the shader. The issue is
compounded with something like Dolphin's GLES renderer, which does this LOD bias
emulation itself -- meaning that LOD bias is lowered twice when using Dolphin
with GLES! As such, this commit adds a context flag for frontends to communicate
that they will never use sampler LOD bias, allowing the driver to omit the
lowering as a GLES fast path (or, for Dolphin, for performance parity between
GLES and GL).

This will be used on Asahi. It could also be used to optimize a path on
Mali-T720 supported in Panfrost, though I don't intend to write that patch.

Originally https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25034

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_manager.c