- SL::Compiler compiler;
- compiler.load_source(*io, this, name);
- compiler.compile();
- RefPtr<Program> program = new Program;
- compiler.add_shaders(*program);
- program->link();
- return program.release();
+ if(ext==".glsl")
+ {
+ RefPtr<GlslModule> module = new GlslModule;
+ module->load_source(*io, this, name);
+ return module.release();
+ }
+ else if(ext==".spv")
+ {
+ RefPtr<SpirVModule> module = new SpirVModule;
+ module->load_code(*io);
+ return module.release();
+ }
+ }
+
+ return 0;
+}
+
+Program *Resources::create_program(const string &name)
+{
+ string ext = FS::extpart(name);
+ string base = FS::basepart(name);
+ string ext2 = FS::extpart(base);
+ if(ext==".shader" && (ext2==".glsl" || ext2==".spv"))
+ {
+ Module &module = get<Module>(base);
+ RefPtr<Program> shprog = new Program;
+ shprog->add_stages(module);
+ shprog->link();
+ return shprog.release();