]> git.tdb.fi Git - libs/gl.git/commitdiff
Don't omit builtins when formatting a single node
authorMikko Rasa <tdb@tdb.fi>
Wed, 10 Mar 2021 10:18:23 +0000 (12:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 10 Mar 2021 13:33:38 +0000 (15:33 +0200)
This produces more useful output for debugging.

source/glsl/output.cpp
source/glsl/output.h

index 43f337cabc3e6296e9afdc1f91130e3d8bd7b56f..718b1a8bcde406ec124f7959f314b606361c1d2a 100644 (file)
@@ -13,12 +13,14 @@ Formatter::Formatter():
        source_index(0),
        source_line(1),
        indent(0),
-       parameter_list(false)
+       parameter_list(false),
+       omit_builtin(false)
 { }
 
 const string &Formatter::apply(Stage &s)
 {
        stage = &s;
+       omit_builtin = true;
 
        const Version &ver = s.required_features.glsl_version;
 
@@ -92,7 +94,7 @@ void Formatter::visit(Block &block)
        bool first = true;
        for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); ++i)
        {
-               if((*i)->source<=BUILTIN_SOURCE)
+               if(omit_builtin && (*i)->source<=BUILTIN_SOURCE)
                        continue;
                if(!first)
                        append('\n');
index 58983fcab68176faff98ed7666ff4c9aa6891d3b..0a506a5d9e15b2080a392eb5ef628730683d9de7 100644 (file)
@@ -19,6 +19,7 @@ private:
        unsigned source_line;
        unsigned indent;
        bool parameter_list;
+       bool omit_builtin;
 
 public:
        Formatter();