X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.h;h=d828daa5172716cb6c173e129cd5c8d6126fb452;hb=8c379c40;hp=ef8ca10e35b198b5da4a38abc09708b08455f267;hpb=bbe2fb7bc1384d7683f1795b5cfa9168df18c580;p=libs%2Fgl.git diff --git a/source/glsl/generate.h b/source/glsl/generate.h index ef8ca10e..d828daa5 100644 --- a/source/glsl/generate.h +++ b/source/glsl/generate.h @@ -11,18 +11,16 @@ namespace Msp { namespace GL { namespace SL { -/** Manipulates specialization constants. If values are specified, turns -specialization constants into normal constants. Without values assigns -automatic constant_ids to specialization constants. */ -class ConstantSpecializer: private TraversingVisitor +/** Assigns IDs to specialization constants with an automatic ID. */ +class ConstantIdAssigner: private TraversingVisitor { private: - const std::map *values; + std::set used_ids; + std::map existing_constants; + std::vector auto_constants; public: - ConstantSpecializer(); - - void apply(Stage &, const std::map *); + void apply(Module &, const Features &); private: virtual void visit(VariableDeclaration &); @@ -39,20 +37,18 @@ Unresolved variables are looked up in the previous stage's out variables. */ class InterfaceGenerator: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; std::string in_prefix; std::string out_prefix; - bool function_scope; - bool copy_block; + bool function_scope = false; + bool copy_block = false; std::vector declared_inputs; - Block *iface_target_block; + Block *iface_target_block = 0; NodeList::iterator iface_insert_point; NodeList::iterator assignment_insert_point; std::set nodes_to_remove; public: - InterfaceGenerator(); - void apply(Stage &); private: