iPhone simulator: OpenGL ES: Internal texture format
After several tests in iPad simulator I have discovered that 1024x1024 16-bit texture in GL_RGBA GL_UNSIGNED_SHORT_4_4_4_4 format allocates 4 MB of memory what is 1024x1024 32 bpp. Currently I can not test this behaviour on a real device.
Does anybody know if RGBA 4 bits per channel is nativly supported by iPad or not?
It i开发者_JS百科s recommended in documentation to use GL_UNSIGNED_SHORT_4_4_4_4 for memory efficiency and it is recommended to use simulator for memory tests... something is wrong here.
Actually, the OpenGL ES Programming Guide for iOS tells you to not test on the Simulator for performance:
Important: Rendering performance of OpenGL ES in Simulator has no relation to the performance of OpenGL ES on an actual device. Simulator provides an optimized software rasterizer that takes advantage of the vector processing capabilities of your Macintosh computer. As a result, your OpenGL ES code may run faster or slower in iOS simulator (depending on your computer and what you are drawing) than on an actual device. Always profile and optimize your drawing code on a real device and never assume that Simulator reflects real-world performance.
In the "Best Practices for Working with Texture Data" section of that guide, they recommend using PowerVR Texture Compression (PVRTC) textures instead of any of the uncompressed formats. The PVRTC textures will use far less memory than any uncompressed format (8X or 16X less when compared to a 32-bit uncompressed texture).
In regards to the 4 bits per channel, they do state this:
If your application cannot use compressed textures, consider using a lower precision pixel format. A texture in RGB565, RGBA5551, or RGBA4444 format uses half the memory of a texture in RGBA8888 format.
精彩评论