X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foptimize.h;h=4c57eaea94844192b29d3a12c9862d754af6dc2c;hb=a3637962f082182d72998a35ea86e48d51e520c3;hp=f6604743810ff1e275198ee554badcd53a75ffa2;hpb=3e262649c1b98462bcaa2c66bc4fb4ee916dc9de;p=libs%2Fgl.git diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index f6604743..4c57eaea 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -9,9 +9,25 @@ namespace Msp { namespace GL { namespace SL { +/** Assigns values to specialization constants, turning them into normal +constants. */ +class ConstantSpecializer: private TraversingVisitor +{ +private: + const std::map *values; + +public: + ConstantSpecializer(); + + void apply(Stage &, const std::map &); + +private: + virtual void visit(VariableDeclaration &); +}; + /** Finds functions which are candidates for inlining. Currently this means -functions which have no parameters, contain no more than one return statement, -and are only called once. */ +functions which have no flow control statements, no more than one return +statement, and are only called once. */ class InlineableFunctionLocator: private TraversingVisitor { private: @@ -49,7 +65,6 @@ private: FunctionDeclaration *source_func; Block staging_block; - std::string remap_prefix; Pass pass; RefPtr r_inlined_statement; std::set dependencies; @@ -59,7 +74,7 @@ private: public: InlineContentInjector(); - const std::string &apply(Stage &, FunctionDeclaration &, Block &, const NodeList::iterator &, FunctionDeclaration &); + const std::string &apply(Stage &, FunctionDeclaration &, Block &, const NodeList::iterator &, FunctionCall &); private: virtual void visit(VariableReference &);