]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/compatibility.h
852a6590bd67c287cf272d1a85bc9cfdb746a5c3
[libs/gl.git] / source / glsl / compatibility.h
1 #ifndef MSP_GL_SL_COMPATIBILITY_H_
2 #define MSP_GL_SL_COMPATIBILITY_H_
3
4 #include <string>
5 #include "visitor.h"
6
7 namespace Msp {
8 namespace GL {
9 namespace SL {
10
11 class DefaultPrecisionGenerator: private TraversingVisitor
12 {
13 private:
14         Stage *stage;
15         std::set<std::string> have_default;
16         NodeList<Statement>::iterator insert_point;
17
18 public:
19         DefaultPrecisionGenerator();
20
21         void apply(Stage &);
22
23 private:
24         virtual void visit(Block &);
25         virtual void visit(Precision &);
26         virtual void visit(VariableDeclaration &);
27 };
28
29 class PrecisionRemover: private TraversingVisitor
30 {
31 private:
32         std::set<Node *> nodes_to_remove;
33
34 public:
35         void apply(Stage &);
36
37 private:
38         virtual void visit(Precision &);
39         virtual void visit(VariableDeclaration &);
40 };
41
42 class LegacyConverter: private TraversingVisitor
43 {
44 private:
45         Stage *stage;
46         Features features;
47         std::string type;
48         VariableDeclaration *frag_out;
49         NodeList<Statement>::iterator uniform_insert_point;
50         std::set<Node *> nodes_to_remove;
51
52 public:
53         LegacyConverter();
54
55         virtual void apply(Stage &, const Features &);
56
57 private:
58         virtual void visit(Block &);
59         bool check_version(const Version &) const;
60         bool check_extension(bool Features::*) const;
61         bool supports_stage(Stage::Type) const;
62         bool supports_unified_interface_syntax() const;
63         virtual void visit(VariableReference &);
64         virtual void visit(Assignment &);
65         bool supports_unified_sampling_functions() const;
66         virtual void visit(FunctionCall &);
67         bool supports_interface_layouts() const;
68         bool supports_centroid_sampling() const;
69         bool supports_sample_sampling() const;
70         virtual void visit(VariableDeclaration &);
71         bool supports_interface_blocks(const std::string &) const;
72         virtual void visit(InterfaceBlock &);
73 };
74
75 } // namespace SL
76 } // namespace GL
77 } // namespace Msp
78
79 #endif