glsl2: Perform initial bits of loop analysis during compilation
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 26 Aug 2010 23:45:22 +0000 (16:45 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 3 Sep 2010 18:55:21 +0000 (11:55 -0700)
src/glsl/glsl_parser_extras.cpp
src/glsl/main.cpp

index bc56e4fcaf54d2674926f061d777ed9369a8ade6..2d045ac9c7ab6b85ae58df4aadce73988c203124 100644 (file)
@@ -34,6 +34,7 @@ extern "C" {
 #include "glsl_parser_extras.h"
 #include "glsl_parser.h"
 #include "ir_optimization.h"
+#include "loop_analysis.h"
 
 _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx,
                                               GLenum target, void *mem_ctx)
@@ -739,6 +740,10 @@ do_common_optimization(exec_list *ir, bool linked)
    progress = do_swizzle_swizzle(ir) || progress;
    progress = do_noop_swizzle(ir) || progress;
 
+   loop_state *ls = analyze_loop_variables(ir);
+   progress = set_loop_controls(ir, ls) || progress;
+   delete ls;
+
    return progress;
 }
 
index cb9f8a5277376eab1a3ae9bc9562acda3e05a381..411bc08983d3899046b5c3fc9a6818f867f72540 100644 (file)
@@ -35,6 +35,7 @@
 #include "ir_optimization.h"
 #include "ir_print_visitor.h"
 #include "program.h"
+#include "loop_analysis.h"
 
 extern "C" struct gl_shader *
 _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
@@ -174,6 +175,10 @@ compile_shader(struct gl_shader *shader)
         progress = do_vec_index_to_swizzle(shader->ir) || progress;
         progress = do_vec_index_to_cond_assign(shader->ir) || progress;
         progress = do_swizzle_swizzle(shader->ir) || progress;
+
+        loop_state *ls = analyze_loop_variables(shader->ir);
+        set_loop_controls(shader->ir, ls);
+        delete ls;
       } while (progress);
 
       validate_ir_tree(shader->ir);