iDevGames Forums
How much can I stuff in to video ram? (on iPhone/iPod touch) - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: How much can I stuff in to video ram? (on iPhone/iPod touch) (/thread-7951.html)



How much can I stuff in to video ram? (on iPhone/iPod touch) - Jamie W - Aug 5, 2010 06:30 AM

Hello,

Current iPhone project I'm working on, is using quite a bit of texture area; that's all in video ram.

Anyone know how many MB of video ram is available to an iPhone app?

Also, what's the maximum texture size?

Thanks,


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - mariocaprino - Aug 5, 2010 07:34 AM

(Aug 5, 2010 06:30 AM)Jamie W Wrote:  Also, what's the maximum texture size?
MBX (iPhone 3G and earlier): 1024x1024
SGX (iPhone 3GS/4): 2048x2048

You'll find more information about the video chipset limitations on Apples OpenGL ES Programming Guide for iOS: Platform Notes and Best Practices for Working with Texture Data.

Remember, texture compression (PVRTC) is your best friend when it comes to memory savings and draw performance on the iPhone.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - Jamie W - Aug 5, 2010 07:49 AM

Ah yeh, many thanks for the info mario. Smile I tried PVRTC before, and for textures with any alpha pixels, they didn't look so good! Looks like I'll be sticking to 1024*1024 for my texture atlases then. Using either 2bpp or 4bpp (ARGB8888) as needed.

Any thoughts on how many I can fit in to video memory at the same time?


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - mariocaprino - Aug 5, 2010 09:55 AM

(Aug 5, 2010 07:49 AM)Jamie W Wrote:  I tried PVRTC before, and for textures with any alpha pixels, they didn't look so good!

I've just used PVRTC with alpha cutouts (glAlphaFunc) and had no problems. Make sure your using the correct blend mode though - in my case it was glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA) although I have seen other forum posts note it as non-premultiplied. Might be due to my source material though.

(Aug 5, 2010 07:49 AM)Jamie W Wrote:  Any thoughts on how many I can fit in to video memory at the same time?

From the Platform Notes you'll find the following notes:
Quote:OpenGL ES applications targeting the PowerVR MBX must limit themselves to no more than 24 MB of memory for textures and renderbuffers. Overall, the PowerVR MBX is more sensitive to memory usage, and your application should minimize the size of textures and renderbuffers.

I haven't seen any similar recommendation for the SGX chipset.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - Skorche - Aug 5, 2010 11:18 AM

You can reduce the smudged alpha when using PVRTC considerable by bleeding the edge colors out into the transparent pixels. Not easy to do in photoshop though.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - Jamie W - Aug 5, 2010 12:17 PM

Is it possible with PVR textures, to have a seperate source for the Alpha? So like a solid Alpha, PVR; and also, a separate 8 or 4 bit-per-pixel Alpha channel, loaded in from a seperate file?

Also, would the 24mb limit be applicable to all iPhones / iPod touchs? Perhaps newer devices have more video ram? But 24mb is a good amount to work to (some devices may have more, but, it will never be less than 24mb), is that correct?

Thanks again,
Jamie.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - Skorche - Aug 5, 2010 01:00 PM

Sure, if you set up multi-texturing you can pull the alpha from a separate texture. It's a bit involved to set up though.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - mariocaprino - Aug 5, 2010 03:31 PM

(Aug 5, 2010 12:17 PM)Jamie W Wrote:  Also, would the 24mb limit be applicable to all iPhones / iPod touchs? Perhaps newer devices have more video ram?

The MBX chipset is found in all the older iPhone and iPod touch devices. iPhone 3GS and later use the SGX chipset - and I would naturally assume they have less restrictions, although I can't find any documentation verifying my assumption.


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - Jamie W - Aug 5, 2010 03:37 PM

Ah, thanks again for the replies chaps. Smile Just one more questions; the 24MB, is that for texture usage only, or is it all combined with other ram usage (program code, buffers, etc)? Thanks again. Smile


RE: How much can I stuff in to video ram? (on iPhone/iPod touch) - mariocaprino - Aug 6, 2010 05:23 AM

The Apple Platform Notes state that the 24MB limit is in respect to OpenGL ES memory usage (textures, buffers etc.)... BUT, you'll most likely hit a system memory warning on older devices long before you hit this limit!

Just be smart about memory usage and minimise concurrent amount of memory. I use lightweight handles to reference all my resources (textures, sound buffers etc.) and load the resource only when it is bound. All loaded resource are kept cached till I receive a memory warning - and are then flushed.

This works great for my usage and is easy to implement. You can also be more creative about the implementation for your specific use and level design.