1 #ifndef MSP_GL_PROGRAMBUILDER_H_
2 #define MSP_GL_PROGRAMBUILDER_H_
7 #include <msp/datafile/objectloader.h>
17 struct StandardFeatures
19 class Loader: public DataFile::ObjectLoader<StandardFeatures>
22 Loader(StandardFeatures &);
37 std::string create_flags() const;
50 struct StandardVariable
55 const char *expression;
62 const StandardVariable *variable;
63 std::string resolved_name;
65 std::string resolved_space;
66 std::list<ShaderVariable *> referenced_vars;
67 std::list<ShaderVariable *> referenced_by;
71 ShaderVariable(const std::string &);
73 void resolve(const StandardVariable &);
74 void resolve(ShaderVariable &);
75 void resolve_space(const std::string &);
76 void add_reference(ShaderVariable &);
77 void update_reference(ShaderVariable &, ShaderVariable &);
79 bool is_referenced_from(VariableScope) const;
80 std::string get_expression() const;
90 StandardFeatures features;
91 std::string feature_flags;
94 static const StandardVariable standard_variables[];
97 ProgramBuilder(const StandardFeatures &);
99 void set_optimize(bool);
100 Program *create_program() const;
101 void add_shaders(Program &) const;
103 std::string create_source(const std::list<ShaderVariable *> &, VariableScope) const;
104 bool evaluate_flags(const char *) const;
105 static MatchLevel name_match(const char *, const char *, const char ** = 0);
106 static bool parse_identifier(const char *, unsigned &, unsigned &);
107 static std::vector<std::string> extract_identifiers(const char *);
108 static std::string replace_identifiers(const char *, const std::map<std::string, std::string> &);