From d8bdf61007978e2c3670a22a58e2f105e8347537 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 17 Mar 2021 12:26:42 +0200 Subject: [PATCH] Rename InterfaceBlock::name to block_name for clarity --- source/glsl/debug.cpp | 4 ++-- source/glsl/generate.cpp | 12 ++++++------ source/glsl/optimize.cpp | 4 ++-- source/glsl/output.cpp | 2 +- source/glsl/parser.cpp | 2 +- source/glsl/syntax.cpp | 2 +- source/glsl/syntax.h | 2 +- source/glsl/validate.cpp | 12 ++++++------ source/glsl/visitor.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/glsl/debug.cpp b/source/glsl/debug.cpp index 308fbad7..99d6edaa 100644 --- a/source/glsl/debug.cpp +++ b/source/glsl/debug.cpp @@ -21,7 +21,7 @@ const std::string &DumpTree::apply(Stage &stage) for(std::map::const_iterator i=stage.interface_blocks.begin(); i!=stage.interface_blocks.end(); ++i) if(seen_interfaces.insert(i->second).second) { - string text = format("Interface block: %%%d %s %s", get_label(*i->second), i->second->interface, i->second->name); + string text = format("Interface block: %%%d %s %s", get_label(*i->second), i->second->interface, i->second->block_name); if(!i->second->instance_name.empty()) text += format(" %s", i->second->instance_name); append(text); @@ -377,7 +377,7 @@ void DumpTree::visit(InterfaceBlock &iface) string head; if(!iface.instance_name.empty()) head += format("%%%d ", get_label(iface)); - head += format("%s %s", iface.interface, iface.name); + head += format("%s %s", iface.interface, iface.block_name); if(!iface.instance_name.empty()) head += format(" %s", iface.instance_name); if(iface.array) diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 56360991..d4623a7f 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -182,7 +182,7 @@ void TypeResolver::visit(InterfaceBlock &iface) StructDeclaration *strct = new StructDeclaration; strct->source = INTERNAL_SOURCE; - strct->name = format("_%s_%s", iface.interface, iface.name); + strct->name = format("_%s_%s", iface.interface, iface.block_name); strct->members.body.splice(strct->members.body.begin(), iface.members->body); stage->content.body.insert(type_insert_point, strct); stage->types.insert(make_pair(strct->name, strct)); @@ -488,7 +488,7 @@ void VariableResolver::visit(InterfaceBlock &iface) { /* Block names can be reused in different interfaces. Prefix the name with the first character of the interface to avoid conflicts. */ - stage->interface_blocks.insert(make_pair(iface.interface+iface.name, &iface)); + stage->interface_blocks.insert(make_pair(iface.interface+iface.block_name, &iface)); if(!iface.instance_name.empty()) stage->interface_blocks.insert(make_pair("_"+iface.instance_name, &iface)); @@ -1345,12 +1345,12 @@ VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block) { - if(stage->interface_blocks.count("in"+out_block.name)) + if(stage->interface_blocks.count("in"+out_block.block_name)) return 0; InterfaceBlock *in_block = new InterfaceBlock; in_block->interface = "in"; - in_block->name = out_block.name; + in_block->block_name = out_block.block_name; in_block->members = new Block; in_block->instance_name = out_block.instance_name; if(stage->type==Stage::GEOMETRY) @@ -1371,7 +1371,7 @@ InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block } iface_target_block->body.insert(iface_insert_point, in_block); - stage->interface_blocks.insert(make_pair("in"+in_block->name, in_block)); + stage->interface_blocks.insert(make_pair("in"+in_block->block_name, in_block)); if(!in_block->instance_name.empty()) stage->interface_blocks.insert(make_pair("_"+in_block->instance_name, in_block)); @@ -1502,7 +1502,7 @@ void InterfaceGenerator::visit(InterfaceBlock &iface) if(!iface.linked_block && stage->previous) { const map &prev_blocks = stage->previous->interface_blocks; - map::const_iterator i = prev_blocks.find("out"+iface.name); + map::const_iterator i = prev_blocks.find("out"+iface.block_name); if(i!=prev_blocks.end()) { iface.linked_block = i->second; diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index b7a722f4..6ac84b5b 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -1116,7 +1116,7 @@ void UnusedVariableRemover::visit(VariableDeclaration &var) /* Mark variables as output if they're used by the next stage or the graphics API. */ if(interface_block) - var_info.output = (interface_block->interface=="out" && (interface_block->linked_block || !interface_block->name.compare(0, 3, "gl_"))); + var_info.output = (interface_block->interface=="out" && (interface_block->linked_block || !interface_block->block_name.compare(0, 3, "gl_"))); else var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || !var.name.compare(0, 3, "gl_"))); @@ -1138,7 +1138,7 @@ void UnusedVariableRemover::visit(InterfaceBlock &iface) else { VariableInfo &var_info = variables[&iface]; - var_info.output = (iface.interface=="out" && (iface.linked_block || !iface.name.compare(0, 3, "gl_"))); + var_info.output = (iface.interface=="out" && (iface.linked_block || !iface.block_name.compare(0, 3, "gl_"))); } } diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index b85c45e3..52026c4d 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -306,7 +306,7 @@ void Formatter::visit(VariableDeclaration &var) void Formatter::visit(InterfaceBlock &iface) { - append(format("%s %s\n", iface.interface, iface.name)); + append(format("%s %s\n", iface.interface, iface.block_name)); if(iface.struct_declaration) iface.struct_declaration->members.visit(*this); if(!iface.instance_name.empty()) diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index 8f2160a6..9e1f1913 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -792,7 +792,7 @@ RefPtr Parser::parse_interface_block() if(!is_interface_qualifier(iface->interface)) throw parse_error(tokenizer.get_location(), iface->interface, "an interface qualifier"); - iface->name = expect_identifier(); + iface->block_name = expect_identifier(); iface->members = new Block; parse_block(*iface->members, true, &Parser::parse_variable_declaration_with_layout); if(!check(";")) diff --git a/source/glsl/syntax.cpp b/source/glsl/syntax.cpp index e7a3990e..32a7b12c 100644 --- a/source/glsl/syntax.cpp +++ b/source/glsl/syntax.cpp @@ -369,7 +369,7 @@ InterfaceBlock::InterfaceBlock(): InterfaceBlock::InterfaceBlock(const InterfaceBlock &other): Statement(other), interface(other.interface), - name(other.name), + block_name(other.block_name), members(other.members), instance_name(other.instance_name), array(other.array), diff --git a/source/glsl/syntax.h b/source/glsl/syntax.h index 9bc3c5a8..f7c8ed29 100644 --- a/source/glsl/syntax.h +++ b/source/glsl/syntax.h @@ -430,7 +430,7 @@ struct VariableDeclaration: Statement struct InterfaceBlock: Statement { std::string interface; - std::string name; + std::string block_name; NodePtr members; std::string instance_name; bool array; diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index b8710509..99e2dfe8 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -145,20 +145,20 @@ void DeclarationValidator::visit(VariableDeclaration &var) void DeclarationValidator::visit(InterfaceBlock &iface) { - string key = iface.interface+iface.name; + string key = iface.interface+iface.block_name; map::const_iterator i = interface_blocks.find(key); if(i!=interface_blocks.end()) - multiple_definition(format("interface block '%s %s'", iface.interface, iface.name), iface, *i->second); + multiple_definition(format("interface block '%s %s'", iface.interface, iface.block_name), iface, *i->second); else interface_blocks.insert(make_pair(key, &iface)); - if(Statement *previous = find_definition(iface.name)) + if(Statement *previous = find_definition(iface.block_name)) { if(!dynamic_cast(previous)) - multiple_definition(format("'%s'", iface.name), iface, *previous); + multiple_definition(format("'%s'", iface.block_name), iface, *previous); } else - record_definition(iface.name, iface); + record_definition(iface.block_name, iface); if(!iface.instance_name.empty()) check_definition(iface.instance_name, iface); @@ -279,7 +279,7 @@ void ReferenceValidator::visit(VariableDeclaration &var) void ReferenceValidator::visit(InterfaceBlock &iface) { if(!iface.struct_declaration) - error(iface, format("Interface block '%s %s' lacks a struct declaration", iface.interface, iface.name)); + error(iface, format("Interface block '%s %s' lacks a struct declaration", iface.interface, iface.block_name)); TraversingVisitor::visit(iface); } diff --git a/source/glsl/visitor.cpp b/source/glsl/visitor.cpp index fd9e9792..cc030eab 100644 --- a/source/glsl/visitor.cpp +++ b/source/glsl/visitor.cpp @@ -191,7 +191,7 @@ void NodeRemover::visit(InterfaceBlock &iface) { if(to_remove->count(&iface)) { - remove_from_map(stage->interface_blocks, iface.interface+iface.name, iface); + remove_from_map(stage->interface_blocks, iface.interface+iface.block_name, iface); if(!iface.instance_name.empty()) remove_from_map(stage->interface_blocks, "_"+iface.instance_name, iface); } -- 2.45.2