]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/reflect.h
Remove unnecessary std:: qualifiers
[libs/gl.git] / source / glsl / reflect.h
index 56ead82ceface5a35fc72af0a2f2b60ae874efc0..63dfe7bec53ed2e843d2f8857d8cb18b056a6fb2 100644 (file)
@@ -7,6 +7,11 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
+bool is_scalar(const BasicTypeDeclaration &);
+bool is_vector_or_matrix(const BasicTypeDeclaration &);
+BasicTypeDeclaration *get_element_type(BasicTypeDeclaration &);
+bool can_convert(const BasicTypeDeclaration &, const BasicTypeDeclaration &);
+
 /** Compares two types for equality.  Struct types are compared recursively. */
 class TypeComparer: private NodeVisitor
 {
@@ -53,7 +58,7 @@ private:
        virtual void visit(VariableDeclaration &);
 };
 
-/** Determines the size and alignment of a variable, in bytes. */
+/** Determines the size and alignment of a variable or a type, in bytes. */
 class MemoryRequirementsCalculator: private NodeVisitor
 {
 public:
@@ -61,8 +66,9 @@ public:
        {
                unsigned size;
                unsigned alignment;
+               unsigned stride;
 
-               Result(unsigned s, unsigned a): size(s), alignment(a) { }
+               Result(unsigned s, unsigned a): size(s), alignment(a), stride(s+a-1-(s+a-1)%a) { }
        };
 private:
        unsigned r_size;
@@ -71,6 +77,7 @@ private:
 
 public:
        Result apply(VariableDeclaration &v) { v.visit(*this); return Result(r_size, r_alignment); }
+       Result apply(TypeDeclaration &t) { t.visit(*this); return Result(r_size, r_alignment); }
 
 private:
        virtual void visit(BasicTypeDeclaration &);
@@ -85,6 +92,7 @@ class DependencyCollector: private TraversingVisitor
 private:
        std::set<Node *> dependencies;
        std::set<Node *> locals;
+       std::set<FunctionDeclaration *> visited_functions;
 
 public:
        std::set<Node *> apply(FunctionDeclaration &);
@@ -94,6 +102,7 @@ private:
        virtual void visit(InterfaceBlockReference &);
        virtual void visit(FunctionCall &);
        virtual void visit(VariableDeclaration &);
+       virtual void visit(FunctionDeclaration &);
 };
 
 } // namespace SL