I remember Paul writing once, that as soon as you call
LoadImage, the image will be loaded and stored in
GPU memory.
While I couldn't locate that specific post anymore, I did find a few other relevant posts that Paul has made. So I'll quote him for reference, with my notes below the quotes:
http://forum.thegamecreators.com/?m=forum_view&t=191961&b=41
Paul wrote:
"Cloning a sprite is the same as creating a new one, it just saves you having to copy the parameters.
Sprites themselves don't use that much memory, the images assigned to them use far more so as long as they share images (and don't each load their own copy of the image) it should be fine."
NOTES:
The sprite data (including physics shapes) is
not stored in GPU RAM. But of course general application performance will be effected when a large number of shapes is defined. (The shape data is likely recalculated when sprites containing shapes are rotated, scaled or moved, but this has no impact whatsoever on GPU memory usage.)
http://forum.thegamecreators.com/?m=forum_view&t=195060&b=41
Paul wrote:
"Currently all images are stored as 32bit RGBA images in GPU memory.
Any images that aren't a power 2 in size are scaled up to the nearest power of 2 internally on mobile devices."
NOTES:
Wise usage of atlas images allows you to save GPU RAM.
Just as an example, assuming you had an image with dimensions 160x100, when loaded to GPU RAM, that image would take as much space as one that was 256x256 (the next largest dimensions for a power of 2 size image, able to contain the 160x100 image).
If you loaded TWO of those images, they would take up 2x256x256x4 (RGBA) bytes of GPU RAM. However, both images would fit on a single 256x256px atlas image (you can fit them within 256x256 in vertical alignment).
So, to repeat - in general, wise usage of Atlas images can save a lot of GPU RAM. Use them!
http://forum.thegamecreators.com/?m=forum_view&t=194664&b=41
Kamac wrote:
"Just a small counting:
One 32x32 RGBA (.png) image is 4096 bytes.
One MB is 1048576 bytes.
Then, if we have 60MB GPU memory free, we could store 15360 32x32 RGBA images."
Paul wrote:
"The math checks out. However, whilst the RAM may be hundreds on MB the graphics memory is usually smaller, for old iOS devices (e.g. 2nd gen iPod Touch) we recommend not using more than 24MB of graphics memory. Newer devices may get away with more."
NOTES:
The important thing to realize, here, is that the images will consume GPU memory, whether they contain transparency or not. The alpha channel is stored to GPU RAM along with the image data, even if it is just full of zeros! So, you do not save any GPU RAM by using transparency.
http://forum.thegamecreators.com/?m=forum_view&t=200996&b=41
Paul wrote:
"If you load too many images and overflow GPU memory then subsequent images may overwrite old ones or fail to load their pixels."
NOTES:
The important thing to note, here, is that there are currently NO commands to check the amount of GPU RAM used. Hopefully this will be fixed at some point... It should at least be simple to add an internal counter which shows how much image data has been copied to GPU RAM using LoadImage/GetImage (and other similar) commands.
But that would not reflect the total amount of GPU RAM used on a device... so, the usefulness of this solution would be limited,
but not non-existent.
http://forum.thegamecreators.com/?m=forum_view&t=195762&b=41
tessoft wrote:
"is there an internal image cache system - for example loading an image for one sprite is reused if I try to load the same image for again?"
Paul wrote:
"The image will be loaded 3 times. When we release image manipulation commands you would be able to modify the contents of an image ID so an image cache would be difficult to implement. "
NOTES:
Not much to add to that. Loading an image multiple times will consume as many times GPU memory, this should be obvious to everyone.
SUMMARY:
Dummy sprites do NOT consume GPU RAM at all - but there is an associated performance impact anyway, depending on what, and how, they are used.
Cheers,
AgentSam - the grumpy old software engineer