]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/finalize.h
Use default member initializers for simple types
[libs/gl.git] / source / glsl / finalize.h
index 3db581be732cd3c5ea7e0b40fce67498db9e1e45..1fe5fa45a494b02988c90f37068ee4c34e760ca1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef MSP_GL_SL_COMPATIBILITY_H_
-#define MSP_GL_SL_COMPATIBILITY_H_
+#ifndef MSP_GL_SL_FINALIZE_H_
+#define MSP_GL_SL_FINALIZE_H_
 
 #include <string>
 #include "visitor.h"
@@ -8,6 +8,22 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
+/** Assigns offset layout qualifiers to struct members. */
+class StructOrganizer: private TraversingVisitor
+{
+private:
+       int offset = -1;
+
+public:
+       void apply(Stage &s) { s.content.visit(*this); }
+
+private:
+       virtual void visit(StructDeclaration &);
+       virtual void visit(VariableDeclaration &);
+};
+
+/** Assigns location and binding layout qualifiers to interface variables and
+blocks. */
 class LocationAllocator: private TraversingVisitor
 {
 private:
@@ -46,14 +62,12 @@ according to the requirements of the target API. */
 class PrecisionConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::set<std::string> have_default;
        NodeList<Statement>::iterator insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       PrecisionConverter();
-
        void apply(Stage &);
 
 private:
@@ -67,15 +81,13 @@ features. */
 class LegacyConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        Features features;
-       VariableDeclaration *frag_out;
+       VariableDeclaration *frag_out = 0;
        NodeList<Statement>::iterator uniform_insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       LegacyConverter();
-
        virtual void apply(Stage &, const Features &);
 
 private: