Browse Source

vulkan: don't hold onto ImageData references after loading an image.

Reduces CPU memory usage.
Sasha Szpakowski 1 year ago
parent
commit
86eb6df05c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/graphics/vulkan/Texture.cpp

+ 4 - 0
src/modules/graphics/vulkan/Texture.cpp

@@ -41,6 +41,10 @@ Texture::Texture(love::graphics::Graphics *gfx, const Settings &settings, const
 		slices = *data;
 		slices = *data;
 
 
 	loadVolatile();
 	loadVolatile();
+
+	// ImageData is referenced by the first loadVolatile call, but we don't
+	// hang on to it after that so we can save memory.
+	slices.clear();
 }
 }
 
 
 bool Texture::loadVolatile()
 bool Texture::loadVolatile()