Revert "nir: Use get_once() helper for one-time init's"

This reverts commit c9062df1d5.

Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7760>
This commit is contained in:
Erik Faye-Lund
2020-11-24 23:34:59 +01:00
committed by Marge Bot
parent 5461e21245
commit 86662655ec
2 changed files with 31 additions and 7 deletions

View File

@@ -4198,9 +4198,15 @@ void nir_metadata_check_validation_flag(nir_shader *shader);
static inline bool static inline bool
should_skip_nir(const char *name) should_skip_nir(const char *name)
{ {
const char *list = get_once(getenv("NIR_SKIP")); static const char *list = NULL;
if (!list) {
/* Comma separated list of names to skip. */
list = getenv("NIR_SKIP");
if (!list)
list = "";
}
if (!list || !list[0]) if (!list[0])
return false; return false;
return comma_separated_list_contains(list, name); return comma_separated_list_contains(list, name);
@@ -4209,19 +4215,29 @@ should_skip_nir(const char *name)
static inline bool static inline bool
should_clone_nir(void) should_clone_nir(void)
{ {
return get_once(env_var_as_boolean("NIR_TEST_CLONE", false)); static int should_clone = -1;
if (should_clone < 0)
should_clone = env_var_as_boolean("NIR_TEST_CLONE", false);
return should_clone;
} }
static inline bool static inline bool
should_serialize_deserialize_nir(void) should_serialize_deserialize_nir(void)
{ {
return get_once(env_var_as_boolean("NIR_TEST_SERIALIZE", false)); static int test_serialize = -1;
if (test_serialize < 0)
test_serialize = env_var_as_boolean("NIR_TEST_SERIALIZE", false);
return test_serialize;
} }
static inline bool static inline bool
should_print_nir(nir_shader *shader) should_print_nir(nir_shader *shader)
{ {
int should_print = get_once(env_var_as_unsigned("NIR_PRINT", 0)); static int should_print = -1;
if (should_print < 0)
should_print = env_var_as_unsigned("NIR_PRINT", 0);
if (should_print == 1) if (should_print == 1)
return !shader->info.internal; return !shader->info.internal;

View File

@@ -1532,7 +1532,12 @@ validate_function_impl(nir_function_impl *impl, validate_state *state)
validate_assert(state, state->ssa_srcs->entries == 0); validate_assert(state, state->ssa_srcs->entries == 0);
_mesa_set_clear(state->ssa_srcs, NULL); _mesa_set_clear(state->ssa_srcs, NULL);
if (get_once(env_var_as_boolean("NIR_VALIDATE_SSA_DOMINANCE", false))) static int validate_dominance = -1;
if (validate_dominance < 0) {
validate_dominance =
env_var_as_boolean("NIR_VALIDATE_SSA_DOMINANCE", false);
}
if (validate_dominance)
validate_ssa_dominance(impl, state); validate_ssa_dominance(impl, state);
} }
@@ -1606,7 +1611,10 @@ dump_errors(validate_state *state, const char *when)
void void
nir_validate_shader(nir_shader *shader, const char *when) nir_validate_shader(nir_shader *shader, const char *when)
{ {
if (!get_once(env_var_as_boolean("NIR_VALIDATE", true))) static int should_validate = -1;
if (should_validate < 0)
should_validate = env_var_as_boolean("NIR_VALIDATE", true);
if (!should_validate)
return; return;
validate_state state; validate_state state;