]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/finalize.h
Combine the precision handling visitors and rewrite the logic
[libs/gl.git] / source / glsl / finalize.h
index 212007131e80a3d0e37173364005d68f3b8d1166..21b4e316d0eec52ae34e5c5c050d15e024656bb7 100644 (file)
@@ -8,17 +8,18 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-/** Generates default precision declarations if they are missing, to satisfy
-GLSL ES requirements. */
-class DefaultPrecisionGenerator: private TraversingVisitor
+/** Generates default precision declarations or removes precision declarations
+according to the requirements of the target API. */
+class PrecisionConverter: private TraversingVisitor
 {
 private:
        Stage *stage;
        std::set<std::string> have_default;
        NodeList<Statement>::iterator insert_point;
+       std::set<Node *> nodes_to_remove;
 
 public:
-       DefaultPrecisionGenerator();
+       PrecisionConverter();
 
        void apply(Stage &);
 
@@ -28,21 +29,6 @@ private:
        virtual void visit(VariableDeclaration &);
 };
 
-/** Removes precision qualifiers from variable declarations, as well as
-default precision declarations. */
-class PrecisionRemover: private TraversingVisitor
-{
-private:
-       std::set<Node *> nodes_to_remove;
-
-public:
-       void apply(Stage &);
-
-private:
-       virtual void visit(Precision &);
-       virtual void visit(VariableDeclaration &);
-};
-
 /** Converts structures of the syntax tree to match a particular set of
 features. */
 class LegacyConverter: private TraversingVisitor