glsl/lower_precision: Lower builtins depending on arguments
authorNeil Roberts <nroberts@igalia.com>
Mon, 18 Nov 2019 16:05:54 +0000 (17:05 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 24 Mar 2020 23:21:21 +0000 (23:21 +0000)
commitfc8432e6d6c1f76621e202c773a590fa99ded730
tree5d6744b09218bbb3d044df213ac4d671f3bbe192
parente7434c0a0608383c13514210e805d15678af5722
glsl/lower_precision: Lower builtins depending on arguments

When an ir_call is encountered that invokes a builtin, it will now try
to generate a lowered version of the builtin. This only happens if all
of the arguments to the function are lowerable. Previously the builtin
would be inlined before the lowering pass is invoked and then the
implementation would be lowered as a consequence of the pass. However
this causes problems if the builtin has multiple arguments and the
implementation has operations on only a few of the arguments before
combining it with the others. In that case the entire builtin should
only be lowered if all of the arguments are lower precision. The
previous approach would end up lowering only parts of the
implementation.

The lowered implementations are cached in a hash table in case they can
be reused.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3885>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3885>
src/compiler/glsl/lower_precision.cpp