X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Freflect.h;h=56ead82ceface5a35fc72af0a2f2b60ae874efc0;hb=3ffa465364a36477b81b1b644ae8d19ee3bac8c2;hp=162ed9c0b8bcf4ddb01daf17724e4308138decd0;hpb=8967d38bc578f1653c1dde01dce49a8f7b0c912e;p=libs%2Fgl.git diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index 162ed9c0..56ead82c 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -7,6 +7,34 @@ 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(Literal &); + virtual void visit(VariableReference &); + 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 {