How much can I stuff in to video ram? (on iPhone/iPod touch)

Member
Posts: 129
Joined: 2009.03
Post: #1
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,
Quote this message in a reply
Member
Posts: 23
Joined: 2010.08
Post: #2
(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.

The Monkey Hustle - Now available on the App Store!
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #3
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?
Quote this message in a reply
Member
Posts: 23
Joined: 2010.08
Post: #4
(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.

The Monkey Hustle - Now available on the App Store!
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #6
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.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #7
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 23
Joined: 2010.08
Post: #8
(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.

The Monkey Hustle - Now available on the App Store!
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #9
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
Quote this message in a reply
Member
Posts: 23
Joined: 2010.08
Post: #10
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.

The Monkey Hustle - Now available on the App Store!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pause/Resume on IPod touch tonysameh 0 2,363 Jul 26, 2010 06:34 AM
Last Post: tonysameh
  iPod Touch not multitasking not working??? Toontingy 1 3,966 Jun 24, 2010 04:13 PM
Last Post: sealfin
  iPhone Only? Not for iPod Touch? daveh84 4 4,197 May 7, 2010 10:46 PM
Last Post: cmiller
  Lets make a living at this stuff, dang it!!! zel58 15 6,880 Apr 21, 2010 12:32 PM
Last Post: cmiller
  Detecting hardware, which iPhone/iPod I'm running on? Jamie W 9 7,546 Apr 13, 2010 11:27 AM
Last Post: Frank C.