X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmodule.cpp;h=72a6abca43781a20e84f07abc8dbb1373f2eb295;hb=9f6bb77743014e4321e783aae5e84af1c925e572;hp=374ef8ae4d71537fcfa36b37cdba910e63b7faf9;hpb=70d9d2d28e5fe723c6b46894276e4c935f578e2d;p=libs%2Fgl.git diff --git a/source/core/module.cpp b/source/core/module.cpp index 374ef8ae..72a6abca 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -127,6 +127,18 @@ void SpirVModule::load_code(IO::Base &io) code.insert(code.end(), buffer, buffer+len); } + reflect(); +} + +void SpirVModule::compile(SL::Compiler &compiler) +{ + compiler.compile(SL::Compiler::SPIRV); + code = compiler.get_combined_spirv(); + reflect(); +} + +void SpirVModule::reflect() +{ if(code.empty()) throw invalid_module("Empty SPIR-V code"); @@ -216,11 +228,6 @@ void SpirVModule::load_code(IO::Base &io) spec_constants.push_back(i->second); } -void SpirVModule::compile(SL::Compiler &) -{ - throw logic_error("Not implemented yet"); -} - SpirVModule::EntryPoint::EntryPoint(): stage(VERTEX) @@ -303,7 +310,7 @@ void SpirVModule::Reflection::reflect_code(const vector &code) for(CodeIterator op=code.begin()+5; op!=code.end(); ) { unsigned word_count = *op>>16; - if(word_count>code.end()-op) + if(word_count>static_cast(code.end()-op)) throw invalid_module("Truncated SPIR-V instruction"); switch(get_opcode(*op))