From d99c2663e8c6a213507878d28d073c732e1e5f7f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 3 Sep 2022 22:25:27 +0300 Subject: [PATCH] Compare constructor calls in TypeComparer These may arise if e.g. an uint constant is initialized with an integer literal. --- source/glsl/reflect.cpp | 19 +++++++++++++++++++ source/glsl/reflect.h | 1 + 2 files changed, 20 insertions(+) diff --git a/source/glsl/reflect.cpp b/source/glsl/reflect.cpp index e64b9a3c..becc833e 100644 --- a/source/glsl/reflect.cpp +++ b/source/glsl/reflect.cpp @@ -159,6 +159,25 @@ void TypeComparer::visit(TernaryExpression &ternary) } } +void TypeComparer::visit(FunctionCall &call) +{ + if(FunctionCall *call1 = multi_visit(call)) + { + if(!call1->constructor || !call.constructor) + r_result = false; + else if(call1->name!=call.name) + r_result = false; + else if(call1->arguments.size()!=call.arguments.size()) + r_result = false; + else + { + r_result = true; + for(unsigned i=0; (r_result && iarguments[i], *call.arguments[i]); + } + } +} + void TypeComparer::visit(BasicTypeDeclaration &basic) { if(BasicTypeDeclaration *basic1 = multi_visit(basic)) diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index 6e6f9d83..308d7c80 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -35,6 +35,7 @@ private: virtual void visit(UnaryExpression &); virtual void visit(BinaryExpression &); virtual void visit(TernaryExpression &); + virtual void visit(FunctionCall &); virtual void visit(BasicTypeDeclaration &); virtual void visit(ImageTypeDeclaration &); virtual void visit(StructDeclaration &); -- 2.45.2