summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-08-26 16:45:22 -0700
committerIan Romanick <[email protected]>2010-09-03 11:55:21 -0700
commit8df2dbf91ddfd0c1590e33015e85470b67e69319 (patch)
tree419429042fe3486eadf2830a2e12d5042dbef8ea /src
parentbfe3fbb38e0a3ae7c1efb74282628c2cc5abc3e0 (diff)
glsl2: Perform initial bits of loop analysis during compilation
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glsl_parser_extras.cpp5
-rw-r--r--src/glsl/main.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index bc56e4fcaf5..2d045ac9c7a 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -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;
}
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index cb9f8a52773..411bc08983d 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -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);