forked from Green-Sky/tomato
more error checking around images, should prevent vram leaks
This commit is contained in:
@@ -103,10 +103,17 @@ TextureLoaderResult MessageImageLoader::load(TextureUploaderI& tu, Message3Handl
|
||||
new_entry.current_texture = 0;
|
||||
for (const auto& [ms, data] : res.frames) {
|
||||
const auto n_t = tu.upload(data.data(), res.width, res.height);
|
||||
if (n_t == 0) {
|
||||
continue;
|
||||
}
|
||||
new_entry.textures.push_back(n_t);
|
||||
new_entry.frame_duration.push_back(ms);
|
||||
}
|
||||
|
||||
if (new_entry.textures.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
new_entry.width = res.width;
|
||||
new_entry.height = res.height;
|
||||
|
||||
|
@@ -116,6 +116,9 @@ struct TextureCache {
|
||||
_tu.destroy(tex_id);
|
||||
}
|
||||
}
|
||||
for (const auto& tex_id : _default_texture.textures) {
|
||||
_tu.destroy(tex_id);
|
||||
}
|
||||
}
|
||||
|
||||
struct GetInfo {
|
||||
|
Reference in New Issue
Block a user