summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-04-06 23:28:02 -0700
committerKenneth Graunke <[email protected]>2014-04-08 00:02:06 -0700
commit73f80c20f68cd30421c13da29d7d7801ed096101 (patch)
tree6478908221483953d212402d595ce60f4bb84f74
parent169c645f12337cdc3e02b628f9cde6a9fb72acc2 (diff)
glsl: Pass ctx->Const.NativeIntegers to do_algebraic.
The next patch will introduce an optimization that only works when integers are not represented as floating point values. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/glsl/glsl_parser_extras.cpp2
-rw-r--r--src/glsl/ir_optimization.h2
-rw-r--r--src/glsl/opt_algebraic.cpp8
-rw-r--r--src/glsl/test_optpass.cpp2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 532b6a5e7c0..a42f3d23df0 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -1530,7 +1530,7 @@ do_common_optimization(exec_list *ir, bool linked,
progress = do_constant_variable_unlinked(ir) || progress;
progress = do_constant_folding(ir) || progress;
progress = do_cse(ir) || progress;
- progress = do_algebraic(ir) || progress;
+ progress = do_algebraic(ir, native_integers) || progress;
progress = do_lower_jumps(ir) || progress;
progress = do_vec_index_to_swizzle(ir) || progress;
progress = lower_vector_insert(ir, false) || progress;
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 9f31826d901..665124a7d30 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -70,7 +70,7 @@ bool do_common_optimization(exec_list *ir, bool linked,
const struct gl_shader_compiler_options *options,
bool native_integers);
-bool do_algebraic(exec_list *instructions);
+bool do_algebraic(exec_list *instructions, bool native_integers);
bool do_constant_folding(exec_list *instructions);
bool do_constant_variable(exec_list *instructions);
bool do_constant_variable_unlinked(exec_list *instructions);
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 2db877d5b8b..9d553925207 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -45,10 +45,11 @@ namespace {
class ir_algebraic_visitor : public ir_rvalue_visitor {
public:
- ir_algebraic_visitor()
+ ir_algebraic_visitor(bool native_integers)
{
this->progress = false;
this->mem_ctx = NULL;
+ this->native_integers = native_integers;
}
virtual ~ir_algebraic_visitor()
@@ -70,6 +71,7 @@ public:
void *mem_ctx;
+ bool native_integers;
bool progress;
};
@@ -645,9 +647,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue)
}
bool
-do_algebraic(exec_list *instructions)
+do_algebraic(exec_list *instructions, bool native_integers)
{
- ir_algebraic_visitor v;
+ ir_algebraic_visitor v(native_integers);
visit_list_elements(&v, instructions);
diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp
index 6cb902aa2e1..79fb17a9e4c 100644
--- a/src/glsl/test_optpass.cpp
+++ b/src/glsl/test_optpass.cpp
@@ -66,7 +66,7 @@ do_optimization(struct exec_list *ir, const char *optimization,
&int_0, &int_1) == 2) {
return do_common_optimization(ir, int_0 != 0, false, int_1, options, true);
} else if (strcmp(optimization, "do_algebraic") == 0) {
- return do_algebraic(ir);
+ return do_algebraic(ir, true);
} else if (strcmp(optimization, "do_constant_folding") == 0) {
return do_constant_folding(ir);
} else if (strcmp(optimization, "do_constant_variable") == 0) {