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 <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
169c645f12
commit
73f80c20f6
|
@ -1530,7 +1530,7 @@ do_common_optimization(exec_list *ir, bool linked,
|
||||||
progress = do_constant_variable_unlinked(ir) || progress;
|
progress = do_constant_variable_unlinked(ir) || progress;
|
||||||
progress = do_constant_folding(ir) || progress;
|
progress = do_constant_folding(ir) || progress;
|
||||||
progress = do_cse(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_lower_jumps(ir) || progress;
|
||||||
progress = do_vec_index_to_swizzle(ir) || progress;
|
progress = do_vec_index_to_swizzle(ir) || progress;
|
||||||
progress = lower_vector_insert(ir, false) || progress;
|
progress = lower_vector_insert(ir, false) || progress;
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool do_common_optimization(exec_list *ir, bool linked,
|
||||||
const struct gl_shader_compiler_options *options,
|
const struct gl_shader_compiler_options *options,
|
||||||
bool native_integers);
|
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_folding(exec_list *instructions);
|
||||||
bool do_constant_variable(exec_list *instructions);
|
bool do_constant_variable(exec_list *instructions);
|
||||||
bool do_constant_variable_unlinked(exec_list *instructions);
|
bool do_constant_variable_unlinked(exec_list *instructions);
|
||||||
|
|
|
@ -45,10 +45,11 @@ namespace {
|
||||||
|
|
||||||
class ir_algebraic_visitor : public ir_rvalue_visitor {
|
class ir_algebraic_visitor : public ir_rvalue_visitor {
|
||||||
public:
|
public:
|
||||||
ir_algebraic_visitor()
|
ir_algebraic_visitor(bool native_integers)
|
||||||
{
|
{
|
||||||
this->progress = false;
|
this->progress = false;
|
||||||
this->mem_ctx = NULL;
|
this->mem_ctx = NULL;
|
||||||
|
this->native_integers = native_integers;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ir_algebraic_visitor()
|
virtual ~ir_algebraic_visitor()
|
||||||
|
@ -70,6 +71,7 @@ public:
|
||||||
|
|
||||||
void *mem_ctx;
|
void *mem_ctx;
|
||||||
|
|
||||||
|
bool native_integers;
|
||||||
bool progress;
|
bool progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -645,9 +647,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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);
|
visit_list_elements(&v, instructions);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ do_optimization(struct exec_list *ir, const char *optimization,
|
||||||
&int_0, &int_1) == 2) {
|
&int_0, &int_1) == 2) {
|
||||||
return do_common_optimization(ir, int_0 != 0, false, int_1, options, true);
|
return do_common_optimization(ir, int_0 != 0, false, int_1, options, true);
|
||||||
} else if (strcmp(optimization, "do_algebraic") == 0) {
|
} else if (strcmp(optimization, "do_algebraic") == 0) {
|
||||||
return do_algebraic(ir);
|
return do_algebraic(ir, true);
|
||||||
} else if (strcmp(optimization, "do_constant_folding") == 0) {
|
} else if (strcmp(optimization, "do_constant_folding") == 0) {
|
||||||
return do_constant_folding(ir);
|
return do_constant_folding(ir);
|
||||||
} else if (strcmp(optimization, "do_constant_variable") == 0) {
|
} else if (strcmp(optimization, "do_constant_variable") == 0) {
|
||||||
|
|
Loading…
Reference in New Issue