Been awhile since I've needed help and had a chance to upgrade the framework, but with new projects, new opportunities come. And so we finaly made a move to the latest starling 🙂
Must say, you've done a great job yet again! Thank you!
Drifting through many changes that were made lately, we started to rewrite our library from scratch and doing so I've encountered some issues I can't explain and would love to understand.
Couple questions follow:
We are using atf files packed with TexturePacker, and using 4096x4096 textures, TexturePacker reports GPU memory in use should be 64MB.
After loading atf and creating new Texture via Texture.fromAtfData using scale parameter default to 1 and settings useMipMaps to false, I then create new TextureAtlas with that Texture and xml data.
The GPU memory at this point shows to be using 96MB. Hmm...
After fooling around I've figured out something different:
Instead of creating TextureAtlas, I create new Image using the texture got from fromAtfData, then create new RenderTexture with size of the Texture, and draw that image to the renderTexture. I then dispose image and the original texture, and create new TextureAtlas using resulted RenderTexture and xml data.
Voila. Everything works exactly the same as far as it looks, with exception of GPU memory showing usage of only 64MB!
I've digged into the starling files and tried to find a difference but haven't found anything useful about this.
Question 1: Is there a good explanation as to why Texture uses more GPU memory than RenderTexture for the same texture size, provided that mipMaps were ordered NOT to be used?
Question 2: Also, is there a nice solution for a workaround of this, and perhaps create RenderTexture directly from the data, without the need of having the two in memory at the same time? Being limited to only 512MB (we're stuck on 32bit machines), we are kinda longing for every MB 🙂
Side note: I kinda wanna keep RenderTexture for atlas, as I need to draw on it later on, using extended TextureAtlas we created, in order to keep all things on same texture and reduce draw calls... 🙂
I've wanted to recreate the static function Texture.fromAtfData to return RenderTexture but it seems like a bunch of work, and as so, I wanted to ask first:
Question 3: Is that even possible, and would that actually help? (I believe that relies on answering the first, or both questions though..)