iPhone OS Reference Library Apple Developer Connection spyglass button

Platform Notes

Apple provides different implementations of OpenGL ES for different hardware platforms. Each of these implementations has different limitations, from the maximum size allowed for textures to the list of OpenGL ES extensions that implementation supports. This chapter spells out the details on each platform to assist you in tailoring your applications to get the highest performance and quality.

The information in this chapter is current as of iPhone OS 3.0 but is subject to change in future hardware or software. For best results, your application must test for these capabilities at runtime, as described in “Determining OpenGL ES Capabilities.”

PowerVR SGX Platform

The PowerVR SGX is the graphics processor in the iPhone 3GS and is designed for OpenGL ES 2.0. The graphics driver for the PowerVR SGX also implements OpenGL ES 1.1 by efficiently implementing the fixed-function pipeline using shaders. More information about PowerVR technologies can be found in the PowerVR Technology Overview. Detailed information about the PowerVR SGX can be found in the POWERVR SGX OpenGL ES 2.0 Application Development Recommendations.

Tile-Based Deferred Rendering

The PowerVR SGX uses a technique known as tile based deferred rendering (TBDR). When you submit OpenGL ES commands for rendering, the PowerVR SGX defers rendering until it accumulates a large list of rendering commands and then operates on this list as a single action. The framebuffer is then divided into tiles, and the scene is drawn once for each tile, with each tile drawing only the content that is visible within it. The key advantage to a deferred renderer is that it accesses memory more efficiently. Partitioning rendering into tiles allows the GPU to more effectively cache the pixel values from the framebuffer, making depth testing and blending more efficient.

Another advantage of deferred rendering is that it allows the GPU to perform hidden surface removal before fragments are processed. Pixels that are not visible are discarded without sampling textures or performing fragment processing, significantly reducing the calculations that the GPU must perform to render the scene. To gain the most benefit from this feature, you should try to draw as much of the scene with opaque content as possible and minimize use of blending, alpha testing, and the discard instruction in GLSL shaders. Because the hardware performs hidden surface removal, it is not necessary for your application to sort its geometry from front to back.

Some operations under a deferred renderer are more expensive than they would be under a traditional stream renderer. The memory bandwidth and computational savings described above perform best when processing large scenes. When the hardware receives OpenGL ES commands that require it to render smaller scenes (or duplicate resources to avoid flushing the scene), the renderer loses much of its efficiency.

For example, if your application updates a texture in the middle of a frame by calling glTexSubImage, the renderer may need to keep both the modified and previous versions of the texture at the same time, increasing memory usage in your application. Similarly, any attempt to read pixel data from the framebuffer requires that preceding commands be processed if they would alter that framebuffer.

Best Practices on the PowerVR SGX

These practices apply to both OpenGL ES 1.1 and OpenGL ES 2.0 applications.

OpenGL ES 2.0 on the PowerVR SGX

Limits

Supported Extensions

The following extensions are supported:

iPhone OS 3.1 also supports rendering to cube map textures. Previous versions of iPhone OS return FRAMEBUFFER_UNSUPPORTED for cube maps.

Known Limitations and Issues

The following are known limitations as of iPhone OS 3.0:

Best Practices on OpenGL ES 2.0

The PowerVR SGX processes high-precision floating-point calculations using a scalar processor, even when those values are declared in a vector. Proper use of write masks and careful definitions of your calculations can improve the performance of your shaders. See “Be Cautious of Vector Operations” for more information.

Medium- and low-precision floating-point values are processed in parallel. However, low-precision variables have a few specific performance limitations:

For best results, limit your use of low-precision variables to color values.

OpenGL ES 1.1 on the PowerVR SGX

OpenGL ES 1.1 is efficiently implemented using shaders that are customized as your application changes OpenGL ES state. Because of this, OpenGL ES state changes may be more expensive than they would be on a traditional hardware implementation. You can improve the performnce of your application by reducing the number of state changes it performs. For more information, see “Avoid Changing OpenGL ES State Unnecessarily.”

Limits

Supported Extensions

PowerVR MBX

The PowerVR MBX implements the OpenGL ES 1.1 fixed-function pipeline. More information about PowerVR technologies can be found in the PowerVR Technology Overview. Detailed information about the PowerVR MBX can be found in the PowerVR MBX 3D Application Development Recommendations.

The PowerVR MBX is a tile-based deferred renderer. Although it does not support custom fragment shaders, as on OpenGL ES 2.0, the traditional pipeline is still accelerated by avoiding unnecessary fragment processing. See “Tile-Based Deferred Rendering” for more information on how to tailor your application to perform well on a deferred renderer.

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.

Best Practices on the PowerVR MBX

OpenGL ES 1.1 on the PowerVR MBX

Limits

Supported Extensions

The extensions supported by the OpenGL ES 1.1 implementation for iPhone and iPod touch are:

Known Limitations and Issues

The PowerVR MBX implementation of OpenGL ES 1.1 has a number of limitations that are not shared by iPhone Simulator or the PowerVR SGX. :

iPhone Simulator

iPhone Simulator includes complete and conformant implementations of both OpenGL ES 1.1 and OpenGL ES 2.0 that you can use for your application development. Simulator differs from the PowerVR MBX and PowerVR SGX in a number of ways:

Important: It is important to understand that 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 OS simulator (depending on your computer and what you are drawing) than on an actual device. You should always profile and optimize your drawing code on a real device and never assume that Simulator reflects real-world performance.

OpenGL ES 2.0 on Simulator

Supported Extensions

Simulator supports the following extensions to OpenGL ES 2.0:

OpenGL ES 1.1 on Simulator

Supported Extensions



Last updated: 2009-11-17

Did this document help you? Yes It's good, but... Not helpful...