1 #ifndef MSP_GL_SL_FINALIZE_H_
2 #define MSP_GL_SL_FINALIZE_H_
11 /** Assigns location and binding layout qualifiers to interface variables and
13 class LocationAllocator: private TraversingVisitor
22 Uniform(): location(-1), desc_set(-1), bind_point(-1) { }
25 std::map<std::string, std::set<unsigned> > used_locations;
26 std::map<std::string, Uniform> uniforms;
27 std::map<unsigned, std::set<unsigned> > used_bindings;
28 std::vector<VariableDeclaration *> unplaced_variables;
29 std::vector<VariableDeclaration *> unbound_textures;
30 std::vector<InterfaceBlock *> unbound_blocks;
33 void apply(Module &, const Features &);
37 void allocate_locations(const std::string &);
38 void bind_uniform(RefPtr<Layout> &, const std::string &, unsigned);
39 void add_layout_value(RefPtr<Layout> &, const std::string &, unsigned);
41 virtual void visit(VariableDeclaration &);
42 virtual void visit(InterfaceBlock &);
43 virtual void visit(FunctionDeclaration &) { }
46 /** Generates default precision declarations or removes precision declarations
47 according to the requirements of the target API. */
48 class PrecisionConverter: private TraversingVisitor
52 std::set<std::string> have_default;
53 NodeList<Statement>::iterator insert_point;
54 std::set<Node *> nodes_to_remove;
62 virtual void visit(Block &);
63 virtual void visit(Precision &);
64 virtual void visit(VariableDeclaration &);
67 /** Converts structures of the syntax tree to match a particular set of
69 class LegacyConverter: private TraversingVisitor
74 VariableDeclaration *frag_out;
75 NodeList<Statement>::iterator uniform_insert_point;
76 std::set<Node *> nodes_to_remove;
81 virtual void apply(Stage &, const Features &);
84 void unsupported(const std::string &);
86 virtual void visit(Block &);
87 bool check_version(const Version &) const;
88 bool check_extension(bool Features::*) const;
89 bool supports_stage(Stage::Type) const;
90 bool supports_unified_interface_syntax() const;
91 virtual void visit(VariableReference &);
92 virtual void visit(Assignment &);
93 bool supports_unified_sampling_functions() const;
94 virtual void visit(FunctionCall &);
95 bool supports_interface_layouts() const;
96 bool supports_stage_interface_layouts() const;
97 bool supports_centroid_sampling() const;
98 bool supports_sample_sampling() const;
99 bool supports_uniform_location() const;
100 bool supports_binding() const;
101 virtual void visit(VariableDeclaration &);
102 bool supports_interface_blocks(const std::string &) const;
103 bool supports_interface_block_location() const;
104 virtual void visit(InterfaceBlock &);