namespace Msp {
namespace GL {
+resource_load_error::resource_load_error(const string &name, const string &err):
+ runtime_error(format("%s: %s", name, err))
+{ }
+
resource_load_error::resource_load_error(const string &name, const exception &exc):
runtime_error(format("%s: %s: %s", name, Debug::demangle(typeid(exc).name()), exc.what()))
{ }
}
}
-bool ResourceManager::is_resource_loaded(const Resource &r)
+bool ResourceManager::is_resource_loaded(const Resource &r) const
{
ManagedResource *managed = reinterpret_cast<ManagedResource *>(r.get_manager_data());
return managed ? managed->state==ManagedResource::LOADED : false;
void ResourceManager::resource_used(const Resource &r)
{
ManagedResource *managed = reinterpret_cast<ManagedResource *>(r.get_manager_data());
+ if(!managed)
+ return;
if(managed->state==ManagedResource::NOT_LOADED && policy!=LOAD_MANUALLY)
load_resource(*managed->resource);
void ResourceManager::ManagedResource::start_loading()
{
io = location.collection->open_raw(location.name);
+ if(!io)
+ throw resource_load_error(location.name, "open failed");
+
loader = resource->load(*io);
if(!loader)
{