From 68af3c2b81cfe9a780bc2637d56e906b066ccaf4 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 4 Mar 2021 13:16:04 +0200 Subject: [PATCH] Have generate_interface return the generated statement --- source/glsl/generate.cpp | 12 ++++++------ source/glsl/generate.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 02021a4c..7c619830 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -417,10 +417,10 @@ string InterfaceGenerator::change_prefix(const string &name, const string &prefi return prefix+name.substr(offset); } -bool InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name) +VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name) { if(stage->content.variables.count(name)) - return false; + return 0; VariableDeclaration* iface_var = new VariableDeclaration; iface_var->sampling = var.sampling; @@ -445,13 +445,13 @@ bool InterfaceGenerator::generate_interface(VariableDeclaration &var, const stri iface_target_block->body.insert(iface_insert_point, iface_var); iface_target_block->variables[name] = iface_var; - return true; + return iface_var; } -bool InterfaceGenerator::generate_interface(InterfaceBlock &out_block) +InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block) { if(stage->interface_blocks.count(out_block.name)) - return false; + return 0; InterfaceBlock *in_block = new InterfaceBlock; in_block->interface = "in"; @@ -480,7 +480,7 @@ bool InterfaceGenerator::generate_interface(InterfaceBlock &out_block) SetForScope set_block(current_block, &stage->content); in_block->visit(*this); - return true; + return in_block; } ExpressionStatement &InterfaceGenerator::insert_assignment(const string &left, Expression *right) diff --git a/source/glsl/generate.h b/source/glsl/generate.h index 2cf5c54a..951a672d 100644 --- a/source/glsl/generate.h +++ b/source/glsl/generate.h @@ -133,8 +133,8 @@ private: static std::string get_out_prefix(Stage::Type); std::string change_prefix(const std::string &, const std::string &) const; virtual void visit(Block &); - bool generate_interface(VariableDeclaration &, const std::string &, const std::string &); - bool generate_interface(InterfaceBlock &); + VariableDeclaration *generate_interface(VariableDeclaration &, const std::string &, const std::string &); + InterfaceBlock *generate_interface(InterfaceBlock &); ExpressionStatement &insert_assignment(const std::string &, Expression *); virtual void visit(VariableReference &); virtual void visit(VariableDeclaration &); -- 2.45.2