]> git.tdb.fi Git - libs/gl.git/commitdiff
Rename InterfaceBlock::name to block_name for clarity
authorMikko Rasa <tdb@tdb.fi>
Wed, 17 Mar 2021 10:26:42 +0000 (12:26 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 17 Mar 2021 10:26:42 +0000 (12:26 +0200)
source/glsl/debug.cpp
source/glsl/generate.cpp
source/glsl/optimize.cpp
source/glsl/output.cpp
source/glsl/parser.cpp
source/glsl/syntax.cpp
source/glsl/syntax.h
source/glsl/validate.cpp
source/glsl/visitor.cpp

index 308fbad73225999efa4a742e2d5ad679b9f80a50..99d6edaaa0ab7b7f242e23c0ecc9fc2c04be47df 100644 (file)
@@ -21,7 +21,7 @@ const std::string &DumpTree::apply(Stage &stage)
        for(std::map<string, InterfaceBlock *>::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)
index 563609918ae216f28178dca421be4c627175f1b5..d4623a7fd85064acf8eb0860c9e9dae149e2798c 100644 (file)
@@ -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<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
-                       map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.name);
+                       map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.block_name);
                        if(i!=prev_blocks.end())
                        {
                                iface.linked_block = i->second;
index b7a722f42c96c6cc718de3b964697ac9416822bb..6ac84b5b0247be7c48ffe3339ba288c1d047ab3c 100644 (file)
@@ -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_")));
        }
 }
 
index b85c45e30149cf38cfc7c8bc415124d6d3cc6eff..52026c4d81fc18e7a7c3ded35eb1c57bedbc449e 100644 (file)
@@ -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())
index 8f2160a626674675b1f63b76ce5dc992d92451ff..9e1f1913491cf98800352d25619557a3e120bfdc 100644 (file)
@@ -792,7 +792,7 @@ RefPtr<InterfaceBlock> 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(";"))
index e7a3990e5c1478b3fcdf8e5727226b05ba688582..32a7b12c6639aebd69344aa7a2f6408c67de308f 100644 (file)
@@ -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),
index 9bc3c5a872e865ea9f6506bfcc4d1ba04524144e..f7c8ed29cedc09229be11f5ce774d78f67107ee3 100644 (file)
@@ -430,7 +430,7 @@ struct VariableDeclaration: Statement
 struct InterfaceBlock: Statement
 {
        std::string interface;
-       std::string name;
+       std::string block_name;
        NodePtr<Block> members;
        std::string instance_name;
        bool array;
index b8710509e8d32fe424062f6c6558976ceab6da35..99e2dfe86c954d31a5a8e734a78b92a9ea3bc283 100644 (file)
@@ -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<string, InterfaceBlock *>::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<InterfaceBlock *>(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);
 }
 
index fd9e9792b303cac8060d5b7b14b6f2fd74576b36..cc030eab7e31f33e71a8cb575f3013c7fdeab0df 100644 (file)
@@ -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);
        }