summaryrefslogtreecommitdiff
path: root/alligator_resources/src
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-11-19 12:49:52 -0500
committerMicha White <botahamec@outlook.com>2022-11-19 12:49:52 -0500
commitc12fc6806391eb583ea75fcc89e23caf5e4218a6 (patch)
treefeaa255da0dae1258d72db4c4f053554ad1e9e06 /alligator_resources/src
parentb8a8aa64e7eee45a9f17a3079c836a251cc1b873 (diff)
Don't unload memory textures
Diffstat (limited to 'alligator_resources/src')
-rw-r--r--alligator_resources/src/texture.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/alligator_resources/src/texture.rs b/alligator_resources/src/texture.rs
index 22cad17..1bb7cb8 100644
--- a/alligator_resources/src/texture.rs
+++ b/alligator_resources/src/texture.rs
@@ -147,7 +147,7 @@ struct Texture {
impl Texture {
fn from_buffer(texture: Rgba16Texture) -> Self {
Self {
- priority: Priority::Urgent,
+ priority: Priority::Urgent, // indicates that it can't be unloaded
buffer: TextureBuffer::Memory(Arc::new(texture)),
}
}
@@ -164,7 +164,10 @@ impl Texture {
}
fn set_priority(&mut self, priority: Priority) {
- self.priority = priority;
+ // memory textures should always be urgent
+ if let TextureBuffer::Disk(_) = self.buffer {
+ self.priority = priority;
+ }
}
fn load_texture(&mut self) -> Result<&Rgba16Texture, LoadError> {