]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/compatibility.h
f33768767b0b0909614e9c8181cf26a32cf66487
[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: public BlockModifier
12 {
13 private:
14         bool toplevel;
15         std::set<std::string> have_default;
16
17 public:
18         DefaultPrecisionGenerator();
19
20         using StageVisitor::visit;
21         virtual void visit(Block &);
22         virtual void visit(Precision &);
23         virtual void visit(VariableDeclaration &);
24 };
25
26 class PrecisionRemover: public BlockModifier
27 {
28 public:
29         using StageVisitor::visit;
30         virtual void visit(Precision &);
31         virtual void visit(VariableDeclaration &);
32 };
33
34 class LegacyConverter: public BlockModifier
35 {
36 private:
37         GLApi target_api;
38         Version target_version;
39         std::string type;
40         VariableDeclaration *frag_out;
41
42 public:
43         LegacyConverter();
44         LegacyConverter(const Version &);
45
46 private:
47         bool check_version(const Version &) const;
48         bool check_extension(const Extension &) const;
49         using StageVisitor::visit;
50         bool supports_unified_interface_syntax() const;
51         virtual void visit(VariableReference &);
52         virtual void visit(Assignment &);
53         bool supports_unified_sampling_functions() const;
54         virtual void visit(FunctionCall &);
55         bool supports_interface_layouts() const;
56         bool supports_centroid_sampling() const;
57         bool supports_sample_sampling() const;
58         virtual void visit(VariableDeclaration &);
59         bool supports_interface_blocks(const std::string &) const;
60         virtual void visit(InterfaceBlock &);
61 };
62
63 } // namespace SL
64 } // namespace GL
65 } // namespace Msp
66
67 #endif