From 90c3973fcadf28e25797656154e42dd3d2915144 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 22 Feb 2021 02:34:12 +0200 Subject: [PATCH] Output the passthrough statement in both GLSL and debug modes --- source/glsl/debug.cpp | 12 ++++++++++++ source/glsl/debug.h | 1 + source/glsl/output.cpp | 12 ++++++++++++ source/glsl/output.h | 1 + 4 files changed, 26 insertions(+) diff --git a/source/glsl/debug.cpp b/source/glsl/debug.cpp index 2bc3a893..4de8ac90 100644 --- a/source/glsl/debug.cpp +++ b/source/glsl/debug.cpp @@ -300,6 +300,18 @@ void DumpTree::visit(Iteration &iter) end_sub(); } +void DumpTree::visit(Passthrough &pass) +{ + append("passthrough"); + if(pass.subscript) + { + begin_sub(); + last_branch(); + pass.subscript->visit(*this); + end_sub(); + } +} + void DumpTree::visit(Return &ret) { if(ret.expression) diff --git a/source/glsl/debug.h b/source/glsl/debug.h index 9806d545..5bc7a8bf 100644 --- a/source/glsl/debug.h +++ b/source/glsl/debug.h @@ -58,6 +58,7 @@ private: virtual void visit(FunctionDeclaration &); virtual void visit(Conditional &); virtual void visit(Iteration &); + virtual void visit(Passthrough &); virtual void visit(Return &); virtual void visit(Jump &); using TraversingVisitor::visit; diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index c1da9fec..46314588 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -341,6 +341,18 @@ void Formatter::visit(Iteration &iter) } } +void Formatter::visit(Passthrough &pass) +{ + append("passthrough"); + if(pass.subscript) + { + append('['); + pass.subscript->visit(*this); + append(']'); + } + append(';'); +} + void Formatter::visit(Return &ret) { append("return"); diff --git a/source/glsl/output.h b/source/glsl/output.h index aec63721..e09f7c2e 100644 --- a/source/glsl/output.h +++ b/source/glsl/output.h @@ -52,6 +52,7 @@ private: virtual void visit(FunctionDeclaration &); virtual void visit(Conditional &); virtual void visit(Iteration &); + virtual void visit(Passthrough &); virtual void visit(Return &); virtual void visit(Jump &); using TraversingVisitor::visit; -- 2.43.0