[Mesa-dev] [PATCH 1/2] mesa: Don't validate IR trees on non-debug builds.
Kenneth Graunke
kenneth at whitecape.org
Sat Mar 16 00:37:57 PDT 2013
On 03/15/2013 12:04 PM, Eric Anholt wrote:
> 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;
Why not just move the #ifdef DEBUG...#endif inside validate_ir_tree()
itself? The overhead of the function call is negligable compared to the
rest of compilation, and it would guarantee that we hit all current and
future cases...
But either approach gets a:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list