spirv_to_nir: Add environment variable to change default log level
authorCharlie Turner <cturner@igalia.com>
Thu, 17 Jun 2021 09:17:26 +0000 (10:17 +0100)
committerMartin Peres <martin.peres@mupuf.org>
Tue, 22 Jun 2021 10:59:43 +0000 (13:59 +0300)
commit786fa3435cd3ca884c65a432cf71a8c6fe818469
treef9b9ba071f8cc6d894069aa2a728835e8b676695
parente9991d5ff1e8d471a75f2bab22b2776aef90cabd
spirv_to_nir: Add environment variable to change default log level

During dEQP runs for radv, I see a lot of warnings like,

ERROR - dEQP error: SPIR-V WARNING:
ERROR - dEQP error:     In file ../src/compiler/spirv/spirv_to_nir.c:1073
ERROR - dEQP error:     Decoration not allowed on struct members: SpvDecorationRestrict
ERROR - dEQP error:     408 bytes into the SPIR-V binary

This fails jobs on Gitlab, due to,

Job's log exceeded limit of 4194304 bytes.
Job execution will continue but no more output will be collected.

Since it doesn't seem feasible right now to fix the many shaders in
the VK-CTS triggering this warning, add an environment toggle that
allows test runners to only see the level of commentary they want.

v2 from Martin:
 - Add my SoB

v3 from Martin:
 - fix the indentation (suggested by Eric)
 - put the declarations at the top of the function

v4 from Martin:
 - make vtn_default_log_level() static (Marcin)
 - cache the default level in vtn_log (Marcin)
 - move vtn_log_level_strings inside vtn_default_log_level()
 - Fix the build issue on MSC

Signed-off-by: Martin Peres <martin.peres@mupuf.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Andres Gomez <agomez@igalia.com>
Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11491>
src/compiler/spirv/nir_spirv.h
src/compiler/spirv/spirv_to_nir.c