[Mesa-dev] [PATCH 2/2] glsl: Only call do_common_optimization once

Thomas Helland thomashelland90 at gmail.com
Sun Nov 13 01:29:10 UTC 2016


It turns out that only 8% of shaders benefit from more than one run
of the do_common_optimization function, now that it has the loop.
Doing only one run makes no difference to instruction count with NIR.

8324 shaders were run
8128 benefit from 1 calls to do_common_optimization
 679 benefit from 2 calls to do_common_optimization
  69 benefit from 3 calls to do_common_optimization
---
 src/compiler/glsl/glsl_parser_extras.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index a5a0837..a1a1f90 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1944,9 +1944,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
       /* Do some optimization at compile time to reduce shader IR size
        * and reduce later work if the same shader is linked multiple times
        */
-      while (do_common_optimization(shader->ir, false, false, options,
-                                    ctx->Const.NativeIntegers))
-         ;
+      do_common_optimization(shader->ir, false, false, options,
+                                    ctx->Const.NativeIntegers);
 
       validate_ir_tree(shader->ir);
 
-- 
2.9.3



More information about the mesa-dev mailing list