#include <msp/core/algorithm.h>
#include <msp/io/print.h>
-#include "deviceinfo.h"
+#include "device.h"
#include "module.h"
#include "resources.h"
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());
+ const DeviceInfo &dev_info = Device::get_current().get_info();
+ const SL::Features &device_features = dev_info.glsl_features;
+ SL::Features latest_features = SL::Features::latest(dev_info.api);
SL::Features features;
features.target_api = latest_features.target_api;
features.glsl_version = latest_features.glsl_version;
}
-SpirVModule::SpirVModule(const SpirVModule &other):
- code(other.code),
- entry_points(other.entry_points),
- structs(other.structs),
- variables(other.variables)
-{
- remap_pointers_from(other);
-}
-
-SpirVModule &SpirVModule::operator=(const SpirVModule &other)
-{
- code = other.code;
- entry_points = other.entry_points;
- structs = other.structs;
- variables = other.variables;
- remap_pointers_from(other);
- return *this;
-}
-
-void SpirVModule::remap_pointers_from(const SpirVModule &other)
-{
- for(EntryPoint &e: entry_points)
- for(const Variable *&v: e.globals)
- v = &variables[v-&other.variables.front()];
-
- for(Variable &v: variables)
- if(v.struct_type)
- v.struct_type = &structs[v.struct_type-&other.structs.front()];
-
- for(Structure &s: structs)
- for(StructMember &m: s.members)
- if(m.struct_type)
- m.struct_type = &structs[m.struct_type-&other.structs.front()];
-}
-
void SpirVModule::load_code(IO::Base &io)
{
uint32_t buffer[1024];
unsigned dimensions = *(op+3);
bool depth = *(op+4)==1;
bool array = *(op+5);
- type.type = static_cast<DataType>((depth*0x200000) | (array*0x80000) | (dimensions+1) | sample);
+ type.type = static_cast<DataType>((depth*0x200000) | (array*0x80000) | ((dimensions+1)<<16) | sample);
}
void SpirVModule::Reflection::reflect_sampled_image_type(CodeIterator op)