nir: Add a NIR_VALIDATE environment variable
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 23 Jun 2016 21:22:03 +0000 (14:22 -0700)
committerRob Clark <robclark@freedesktop.org>
Sat, 25 Jun 2016 11:34:20 +0000 (07:34 -0400)
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.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/compiler/nir/nir_validate.c

index e5f5b8acc60ab7e9f669d4dc50285b294bfaf105..63e85cf6037b3706df49b4f27331e7f5b89c8d56 100644 (file)
@@ -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);