CPU to GPU during playtime?
Hey I'm Dan!
I'm currently wrapping up a 9 months game project for the iPhone 3GS/ 4, iPad & iPad 2 and I have managed to get great performance on my game so far. But recently I recieved a report from the german distributors saying that they have measured the amount of "Real Memory" and that it is way too high (>100).
I then started measuring myself to try and see the pattern why this happens with the tools "Instruments" on my iMac.
I'm using GPU rendering.
I started to see a pattern. My game is built up using a lot of scenes and coding directly in the timeline and it works great for me. Most of my backgrounds in the game are bitmaps and I started to see, when I measured, that when I got to this bitmap in the timeline I saw a rather big boost in "Real Memory" usage since the bitmap was uploaded to the GPU. Note that have all my graphical objects set out on the stage. The problem here is that once I navigated through that scene and went to the next one with the exact identical bitmap as the one that was recently uploaded, it uploaded again, and I saw a rather huge boost in "Real memory" usage again! So all these bitmaps in my game gets uploaded, but not re-used. Does anyone have an idea how I can reuse them?
I tried switching to CPU usage and it was great! Performance was good enough and the "Real memory" usage was low (70-80) compared to the GPU version. But, and there is a big but here- as soon as I was to play a mission in the game I fell into heavy stuttering. The player uses his/her finger to move an aim and is supposed to shoot the target. So basicly we've got an MC that is the aim (a sniper scope), three looping targets standing and talking (fbf animation) and a background cachedAsBitmapMatrix. The stuttering only occur when I move the aim around. As soon as I release the aim the stuttering is completely gone. I tried removing all elements except the aim and when I tried to move it with my finger it was still stuttering. Is there a way to optimize this aim for the CPU? Or is it somehow possible to switch from CPU rendering to GPU only when the player is about to play the missions? That means switching rendering modes while the app is running on the device. I might be completely out and fumbling here but should someone know anything about these rendering questions I'd be extremely grateful.
I'd love to be able to use the GPU without the incredibly high "Real Memory" usage due to so many bitmaps in the game or I would love to be able to use the CPU with optimizations for the CPU to get rid of the stuttering.
But beeing able to switch rendering mode while the app is running would be the ultimate choice;)
Anyone out there with some kind of solution or compromise?
Thank you for your time! I really appriciate it:)
Dan
