X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmodule.cpp;h=89d418947f92b1685c9ddd0689d9811612114abd;hb=fb04f4ef9162f58f494cf4323cf3dc66b2f3d4ac;hp=b542f77e9c6ebcee0638b69fd76c94aff9ad3998;hpb=959efbf61663efd7879070ce0447e02c8a447ce0;p=libs%2Fgl.git diff --git a/source/core/module.cpp b/source/core/module.cpp index b542f77e..89d41894 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -1,5 +1,6 @@ #include #include +#include "deviceinfo.h" #include "module.h" #include "resources.h" @@ -49,14 +50,14 @@ namespace GL { void Module::set_source(const string &src) { - SL::Compiler compiler; + SL::Compiler compiler(create_features()); compiler.set_source(src); compile(compiler); } void Module::load_source(IO::Base &io, Resources *res, const string &name) { - SL::Compiler compiler; + SL::Compiler compiler(create_features()); compiler.load_source(io, res, name); compile(compiler); } @@ -66,6 +67,19 @@ void Module::load_source(IO::Base &io, const string &name) load_source(io, 0, name); } +SL::Features Module::create_features() const +{ + const SL::Features &device_features = DeviceInfo::get_global().glsl_features; + SL::Features latest_features = SL::Features::latest(get_backend_api()); + SL::Features features; + features.target_api = latest_features.target_api; + features.glsl_version = latest_features.glsl_version; + features.constant_id_range = device_features.constant_id_range; + features.uniform_binding_range = device_features.uniform_binding_range; + features.texture_binding_range = device_features.texture_binding_range; + return features; +} + void GlslModule::compile(SL::Compiler &compiler) { @@ -191,7 +205,10 @@ void SpirVModule::reflect() last_member = lm; } - s.size = last_offset+get_type_size(last_member->type); + unsigned last_size = get_type_size(last_member->type); + if(last_member->array_size) + last_size += last_member->array_stride*(last_member->array_size-1); + s.size = last_offset+last_size; s.size = (s.size+15)&~15; }