diff options
author | Ian Romanick <[email protected]> | 2016-09-14 13:52:42 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-11-10 14:30:49 -0800 |
commit | f45a2a93aea0a57cf0aa8ee9ca062fcc42407a44 (patch) | |
tree | 85b7c3c1afaaba0042e50621955d1c004250193b /src/compiler/glsl/standalone.cpp | |
parent | 9788b3b6f363580fd8d9d7e221cab28879e4d169 (diff) |
glsl/standalone: Optimize add-of-neg to subtract
This just makes the output of the standalone compiler a little more
compact.
v2: Fix indexing typo noticed by Iago. Move the add_neg_to_sub_visitor
to it's own header file. Add a unit test that exercises the visitor.
Both the neg_a_plus_b and neg_a_plus_neg_b tests reproduced the bug that
Iago discovered.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/standalone.cpp')
-rw-r--r-- | src/compiler/glsl/standalone.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index f0964900938..efc6da9d004 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -37,6 +37,7 @@ #include "standalone_scaffolding.h" #include "standalone.h" #include "util/string_to_uint_map.h" +#include "opt_add_neg_to_sub.h" static const struct standalone_options *options; @@ -441,6 +442,9 @@ standalone_compile_shader(const struct standalone_options *_options, if (!shader) continue; + add_neg_to_sub_visitor v; + visit_list_elements(&v, shader->ir); + shader->Program = rzalloc(shader, gl_program); init_gl_program(shader->Program, shader->Stage); } |