From 3e24a1bfd5a259b185ff0f37046dd0489e1908a3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 10 Mar 2021 12:18:23 +0200 Subject: [PATCH] Don't omit builtins when formatting a single node This produces more useful output for debugging. --- source/glsl/output.cpp | 6 ++++-- source/glsl/output.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index 43f337ca..718b1a8b 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -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::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'); diff --git a/source/glsl/output.h b/source/glsl/output.h index 58983fca..0a506a5d 100644 --- a/source/glsl/output.h +++ b/source/glsl/output.h @@ -19,6 +19,7 @@ private: unsigned source_line; unsigned indent; bool parameter_list; + bool omit_builtin; public: Formatter(); -- 2.43.0