]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.cpp
Add a standalone GLSL compiler frontend
[libs/gl.git] / source / glsl / compiler.cpp
index 4a7a19e29759770966db8ae105c0967bdd5c4f9b..ca6c58057022b8b3a9f69373433c0f6c54a2e35d 100644 (file)
@@ -3,6 +3,7 @@
 #include <msp/strings/format.h>
 #include "compatibility.h"
 #include "compiler.h"
+#include "debug.h"
 #include "error.h"
 #include "generate.h"
 #include "optimize.h"
@@ -132,6 +133,14 @@ const SourceMap &Compiler::get_source_map() const
        return module->source_map;
 }
 
+string Compiler::get_stage_debug(Stage::Type stage_type) const
+{
+       for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
+               if(i->type==stage_type)
+                       return DumpTree().apply(*i);
+       throw key_error(Stage::get_stage_name(stage_type));
+}
+
 void Compiler::append_module(Module &mod, DataFile::Collection *res)
 {
        module->source_map.merge_from(mod.source_map);