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>
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);