summaryrefslogtreecommitdiff
path: root/alligator_resources
diff options
context:
space:
mode:
Diffstat (limited to 'alligator_resources')
-rw-r--r--alligator_resources/src/texture.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/alligator_resources/src/texture.rs b/alligator_resources/src/texture.rs
index 81c2105..2255b3f 100644
--- a/alligator_resources/src/texture.rs
+++ b/alligator_resources/src/texture.rs
@@ -192,6 +192,13 @@ impl Texture {
TextureBuffer::Disk(file) => file.allocated_size(),
}
}
+
+ const fn is_loaded(&self) -> bool {
+ match &self.buffer {
+ TextureBuffer::Memory(_) => true,
+ TextureBuffer::Disk(file) => file.is_loaded(),
+ }
+ }
}
pub struct TextureRef<'a> {
@@ -375,7 +382,7 @@ impl TextureManager {
let size = texture.allocated_size();
let priority = texture.priority();
- if priority == Priority::Urgent || self.can_load(size, priority) {
+ if !texture.is_loaded() && (priority == Priority::Urgent || self.can_load(size, priority)) {
let texture = self.textures.get_mut(&id).expect("invalid texture id");
texture.load_texture()?;
}