[Mesa-dev] [PATCH 1/2] mesa: Don't validate IR trees on non-debug builds.

Eric Anholt eric at anholt.net
Fri Mar 15 12:04:05 PDT 2013


This was taking 5% of CPU on TF2's load time.
---
 src/mesa/program/ir_to_mesa.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 2cb5f02..ae9c0cd 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3114,7 +3114,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
       _mesa_ast_to_hir(shader->ir, state);
 
    if (!state->error && !shader->ir->is_empty()) {
+#ifdef DEBUG
       validate_ir_tree(shader->ir);
+#endif
 
       /* Do some optimization at compile time to reduce shader IR size
        * and reduce later work if the same shader is linked multiple times
@@ -3122,7 +3124,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
       while (do_common_optimization(shader->ir, false, false, 32))
 	 ;
 
+#ifdef DEBUG
       validate_ir_tree(shader->ir);
+#endif
    }
 
    shader->symbols = state->symbols;
-- 
1.7.10.4



More information about the mesa-dev mailing list