X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmodule.cpp;h=74e886b06bcc06895cedcd9b0b77b00e5f0bc783;hb=c93e0613e96ec6817e26b533e90dc49d45787941;hp=406b4739d1c765f981ddd992081411f5203b4123;hpb=dccad64b2ec82249d850b9745614042171499972;p=libs%2Fgl.git diff --git a/source/core/module.cpp b/source/core/module.cpp index 406b4739..74e886b0 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -1,31 +1,24 @@ +#include #include "module.h" #include "resources.h" -#include "glsl/compiler.h" using namespace std; namespace Msp { namespace GL { -Module::Module() -{ } - void Module::set_source(const string &src) { SL::Compiler compiler; compiler.set_source(src); - compiler.compile(SL::Compiler::MODULE); - prepared_source = compiler.get_combined_glsl(); - source_map = compiler.get_source_map(); + compile(compiler); } void Module::load_source(IO::Base &io, Resources *res, const string &name) { SL::Compiler compiler; compiler.load_source(io, res, name); - compiler.compile(SL::Compiler::MODULE); - prepared_source = compiler.get_combined_glsl(); - source_map = compiler.get_source_map(); + compile(compiler); } void Module::load_source(IO::Base &io, const string &name) @@ -33,5 +26,18 @@ void Module::load_source(IO::Base &io, const string &name) load_source(io, 0, name); } + +void GlslModule::compile(SL::Compiler &compiler) +{ + compiler.compile(SL::Compiler::MODULE); + prepared_source = compiler.get_combined_glsl(); + source_map = compiler.get_source_map(); +#ifdef DEBUG + string diagnostics = compiler.get_diagnostics(); + if(!diagnostics.empty()) + IO::print("Module diagnostics:\n%s\n", diagnostics); +#endif +} + } // namespace GL } // namespace Msp