]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/debug.cpp
Unify handling of variables and interface blocks in the GLSL compiler
[libs/gl.git] / source / glsl / debug.cpp
index ef7e81f68af289943e7348a81edc8eb407637cf6..60b7c2477cf093664f4fc2ac8bcfdb52f56fb5b1 100644 (file)
@@ -183,19 +183,10 @@ void DumpTree::visit(VariableReference &var)
        string text;
        if(var.declaration)
                text += format("%s ", get_label(*var.declaration));
-       text += format("%s (var) -> %s", format_name(var.name), format_type(var.type));
+       text += format("%s -> %s", format_name(var.name), format_type(var.type));
        append(var, text);
 }
 
-void DumpTree::visit(InterfaceBlockReference &iface)
-{
-       string text;
-       if(iface.declaration)
-               text += format("%s ", get_label(*iface.declaration));
-       text += format("%s (iface) -> %s", format_name(iface.name), format_type(iface.type));
-       append(iface, text);
-}
-
 void DumpTree::visit(MemberAccess &memacc)
 {
        string text = "Member access:";
@@ -373,6 +364,8 @@ void DumpTree::visit(StructDeclaration &strct)
 {
        append(strct, format("%s struct %s", get_label(strct), strct.name));
        vector<Branch> branches;
+       if(!strct.block_name.empty())
+               branches.emplace_back(format("Interface block: %s", format_name(strct.block_name)));
        if(strct.extended_alignment)
                branches.emplace_back("Extended alignment");
        branches.emplace_back(&strct.members);
@@ -402,6 +395,8 @@ void DumpTree::visit(VariableDeclaration &var)
        vector<Branch> branches;
        if(var.type_declaration)
                branches.emplace_back(format("Type: %s %s", get_label(*var.type_declaration), format_type(var.type_declaration->name)));
+       if(var.block_declaration)
+               branches.emplace_back(format("Interface block: %s", format_name(var.block_declaration->block_name)));
        if(var.layout)
                branches.emplace_back(var.layout.get());
        if(var.array)
@@ -416,29 +411,6 @@ void DumpTree::visit(VariableDeclaration &var)
        append_subtree(branches);
 }
 
-void DumpTree::visit(InterfaceBlock &iface)
-{
-       string head = format("%s %s %s", get_label(iface), iface.interface, format_name(iface.block_name));
-       if(!iface.instance_name.empty())
-               head += format(" %s", format_name(iface.instance_name));
-       if(iface.array)
-               head += "[]";
-       if(iface.source==BUILTIN_SOURCE)
-               head += " (builtin)";
-       else if(iface.linked_block)
-               head += " (linked)";
-       append(iface, head);
-
-       vector<Branch> branches;
-       if(iface.type_declaration)
-               branches.emplace_back(format("Type: %s %s", get_label(*iface.type_declaration), format_type(iface.type_declaration->name)));
-       if(iface.layout)
-               branches.emplace_back(iface.layout.get());
-       if(iface.members)
-               branches.emplace_back(iface.members.get());
-       append_subtree(branches);
-}
-
 void DumpTree::visit(FunctionDeclaration &func)
 {
        string text = format("%s %s %s%s", get_label(func), format_type(func.return_type), format_name(func.name), (func.signature.empty() ? "(?)" : func.signature));