summaryrefslogtreecommitdiff
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <jasuarez@igalia.com>2021-12-04 07:39:51 +0100
committerMarge Bot <emma+marge@anholt.net>2021-12-14 08:01:17 +0000
commit18c039b2e17868b2f98841da48f811de810d176d (patch)
tree0d55a18c5c3ddf84479ae9f820fa6284b294fe28 /src/compiler/nir
parent42a865730ef72574e179b56a314f30fdccc6cba8 (diff)
tgsi-to-nir: initialize NIR_DEBUG envvar
This envvar is initialized when creating a NIR shader, but it needs to be used before. So initialize it here. v2 (Juan): - Use static variable for first initialization. Fixes: f77ccdfb4a2 ("nir: add NIR_DEBUG envvar") Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14057>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir.c8
-rw-r--r--src/compiler/nir/nir.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index f8287196032..4663de619bb 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -39,7 +39,7 @@
#include "main/menums.h" /* BITFIELD64_MASK */
#ifndef NDEBUG
-uint32_t nir_debug = ~0;
+uint32_t nir_debug = 0;
bool nir_debug_print_shader[MESA_SHADER_KERNEL + 1] = { 0 };
static const struct debug_named_value nir_debug_control[] = {
@@ -90,10 +90,12 @@ static const struct debug_named_value nir_debug_control[] = {
DEBUG_GET_ONCE_FLAGS_OPTION(nir_debug, "NIR_DEBUG", nir_debug_control, 0)
-static void
+void
nir_process_debug_variable(void)
{
- if (unlikely(nir_debug == ~0)) {
+ static bool first = true;
+ if (unlikely(first)) {
+ first = false;
nir_debug = debug_get_option_nir_debug();
nir_debug_print_shader[MESA_SHADER_VERTEX] = NIR_DEBUG(PRINT_VS);
nir_debug_print_shader[MESA_SHADER_TESS_CTRL] = NIR_DEBUG(PRINT_TCS);
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 2a664c94285..f0bd76ab247 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -124,6 +124,9 @@ nir_num_components_valid(unsigned num_components)
num_components == 16;
}
+void
+nir_process_debug_variable(void);
+
bool nir_component_mask_can_reinterpret(nir_component_mask_t mask,
unsigned old_bit_size,
unsigned new_bit_size);