]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compatibility.h
Refactor the way of applying visitors to stages
[libs/gl.git] / source / glsl / compatibility.h
index f33768767b0b0909614e9c8181cf26a32cf66487..732f3477db5f9b401550ff999bde3d6f50af0718 100644 (file)
@@ -11,13 +11,16 @@ namespace SL {
 class DefaultPrecisionGenerator: public BlockModifier
 {
 private:
+       Stage::Type stage_type;
        bool toplevel;
        std::set<std::string> have_default;
 
 public:
        DefaultPrecisionGenerator();
 
-       using StageVisitor::visit;
+       void apply(Stage &);
+
+       using BlockModifier::visit;
        virtual void visit(Block &);
        virtual void visit(Precision &);
        virtual void visit(VariableDeclaration &);
@@ -26,7 +29,9 @@ public:
 class PrecisionRemover: public BlockModifier
 {
 public:
-       using StageVisitor::visit;
+       void apply(Stage &s) { visit(s.content); }
+
+       using BlockModifier::visit;
        virtual void visit(Precision &);
        virtual void visit(VariableDeclaration &);
 };
@@ -34,6 +39,7 @@ public:
 class LegacyConverter: public BlockModifier
 {
 private:
+       Stage *stage;
        GLApi target_api;
        Version target_version;
        std::string type;
@@ -46,7 +52,10 @@ public:
 private:
        bool check_version(const Version &) const;
        bool check_extension(const Extension &) const;
-       using StageVisitor::visit;
+public:
+       using BlockModifier::visit;
+       virtual void apply(Stage &);
+private:
        bool supports_unified_interface_syntax() const;
        virtual void visit(VariableReference &);
        virtual void visit(Assignment &);