[Mesa-dev] [PATCH] nir: Add a NIR_VALIDATE environment variable

Jason Ekstrand jason at jlekstrand.net
Thu Jun 23 21:22:03 UTC 2016


It defaults to true so default behavior doesn't change but it allows you to
do NIR_VALIDATE=false if you don't want validation.  Disabling validation
can substantially speed up shader compiles so you frequently want to turn
it off if compiler invariants aren't in question.
---
 src/compiler/nir/nir_validate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index e5f5b8a..63e85cf 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -1124,6 +1124,12 @@ dump_errors(validate_state *state)
 void
 nir_validate_shader(nir_shader *shader)
 {
+   static int should_validate = -1;
+   if (should_validate < 0)
+      should_validate = env_var_as_boolean("NIR_VALIDATE", true);
+   if (!should_validate)
+      return;
+
    validate_state state;
    init_validate_state(&state);
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list