From c12fc6806391eb583ea75fcc89e23caf5e4218a6 Mon Sep 17 00:00:00 2001 From: Micha White Date: Sat, 19 Nov 2022 12:49:52 -0500 Subject: Don't unload memory textures --- alligator_resources/src/texture.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'alligator_resources/src') 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> { -- cgit v1.2.3