mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
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: f77ccdfb4a ("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>
This commit is contained in:
parent
42a865730e
commit
18c039b2e1
3 changed files with 12 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -2580,6 +2580,10 @@ tgsi_to_nir(const void *tgsi_tokens,
|
|||
if (s)
|
||||
return s;
|
||||
|
||||
#ifndef NDEBUG
|
||||
nir_process_debug_variable();
|
||||
#endif
|
||||
|
||||
if (NIR_DEBUG(TGSI)) {
|
||||
fprintf(stderr, "TGSI before translation to NIR:\n");
|
||||
tgsi_dump(tgsi_tokens, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue