X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Freflect.h;h=9520feb6a924c797ee50b7e8a062dbd7b1f74795;hp=162ed9c0b8bcf4ddb01daf17724e4308138decd0;hb=c701c8787cb19fbb6dc5b0bfae1a94e2b07dd549;hpb=6377f8efc81ffe84b7ffe44380f1caa2059f437f diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index 162ed9c0..9520feb6 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -7,6 +7,32 @@ namespace Msp { namespace GL { namespace SL { +/** Compares two types for equality. Struct types are compared recursively. */ +class TypeComparer: private NodeVisitor +{ +private: + Node *first; + Node *second; + unsigned first_tag; + bool r_result; + + static unsigned next_tag; + +public: + TypeComparer(); + + bool apply(TypeDeclaration &t1, TypeDeclaration &t2) { compare(t1, t2); return r_result; } + +private: + void compare(Node &, Node &); + template + T *multi_visit(T &); + virtual void visit(BasicTypeDeclaration &); + virtual void visit(ImageTypeDeclaration &); + virtual void visit(StructDeclaration &); + virtual void visit(VariableDeclaration &); +}; + /** Determines the number of interface locations required by a variable. */ class LocationCounter: private NodeVisitor {