- module = &mod;
-
- SL::Compiler compiler;
- compiler.set_source(module->get_prepared_source(), "<module>");
- compiler.specialize(spec_values);
- compiler.compile(SL::Compiler::PROGRAM);
-#ifdef DEBUG
- string diagnostics = compiler.get_diagnostics();
- if(!diagnostics.empty())
- IO::print("Program diagnostics:\n%s\n", diagnostics);
-#endif
-
- vector<SL::Stage::Type> stages = compiler.get_stages();
- for(vector<SL::Stage::Type>::const_iterator i=stages.begin(); i!=stages.end(); ++i)
- {
- GLenum type;
- switch(*i)
- {
- case SL::Stage::VERTEX:
- { static Require _req(ARB_vertex_shader); }
- type = GL_VERTEX_SHADER;
- break;
- case SL::Stage::GEOMETRY:
- { static Require _req(ARB_geometry_shader4); }
- type = GL_GEOMETRY_SHADER;
- break;
- case SL::Stage::FRAGMENT:
- { static Require _req(ARB_fragment_shader); }
- type = GL_FRAGMENT_SHADER;
- break;
- default:
- throw invalid_operation("Program::add_stages");
- }