OpenGL ES Hardware Processors

All currently shipping iPhone, iPad, and iPod Touch devices use the PowerVR SGX graphics processors (535, 543, and 554). These processors support OpenGL ES 2.0 and also support OpenGL ES 1.1 by efficiently implementing the fixed-function pipeline using shaders.

Table 1-1 describes each processor-device combination.

Table 1-1  iOS graphics hardware compatibility

Device compatibility

PowerVR hardware platform

OpenGL ES versions supported

iPod Touch (3rd and 4th generations)

SGX 535

1.1, 2.0

iPod Touch (5th generation)

SGX 543

1.1, 2.0

iPhone 3GS, iPhone 3GS (China), and iPhone 4

SGX 535

1.1, 2.0

iPhone 4S and iPhone 5

SGX 543

1.1, 2.0

iPad Wi-Fi and iPad Wi-Fi + 3G

SGX 535

1.1, 2.0

iPad 2 Wi-Fi, iPad 2 Wi-Fi + 3G, iPad 3 Wi-Fi, and iPad 3 Wi-Fi + 3G

SGX 543

1.1, 2.0

iPad 4 Wi-Fi and iPad 4 Wi-Fi + 3G

SGX 554

1.1, 2.0

iPad Mini Wi-Fi and iPad Mini Wi-Fi + 3G

SGX 543

1.1, 2.0

The PowerVR SGX Hardware Platform

Imagination Technologies has several useful references about PowerVR technologies:

Tile-Based Deferred Rendering

PowerVR SGX series hardware uses a technique known as tile-based deferred rendering (TBDR). When you call OpenGL ES functions to submit rendering commands to the hardware, those commands are buffered until a large list of commands is accumulated. The hardware renders these commands as a single operation by dividing the framebuffer into tiles and then drawing the commands once for each tile, with each tile rendering only the primitives that are visible within it. The key advantage to a deferred renderer is that it accesses memory very 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.

Deferred rendering also 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 tile. To gain the most benefit from this feature, draw as much of the frame 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 app to sort primitives 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, the renderer loses much of its efficiency. For example, if your app renders batches of triangles using a texture and then modifies the texture, the OpenGL ES implementation must either flush out those commands immediately or duplicate the texture; neither option uses the hardware efficiently. Similarly, any attempt to read pixel data from the framebuffer requires that preceding commands be processed if they would alter that framebuffer.

Best Practices for both OpenGL ES 2.0 and OpenGL ES 1.1

These practices apply to OpenGL ES apps on SGX Series 5 hardware:

  • Avoid operations that modify OpenGL ES objects already in use by the renderer because of previously submitted drawing commands. When you need to modify OpenGL ES resources, schedule those modifications at the beginning or end of a frame. These commands include glBufferSubData, glBufferData, glMapBuffer, glTexSubImage, glCopyTexImage, glCopyTexSubImage, glReadPixels, glBindFramebuffer, glFlush, and glFinish.

  • To take advantage of the processor’s hidden surface removal, follow the drawing guidelines found in Do Not Sort Rendered Objects Except Where Necessary For Correct Rendering in OpenGL ES Programming Guide.

  • Vertex buffer objects (VBOs) provide a significant performance improvement on the PowerVR SGX. See Use Vertex Buffer Objects to Manage Copying Vertex Data in OpenGL ES Programming Guide.

  • Do not use separate stencil buffers. Instead use a combined depth/stencil buffer.

  • Use Core Animation rotations of renderbuffers to rotate content between landscape and portrait mode. For best performance, ensure that the renderbuffer’s height and width are each a multiple of 32 pixels.

OpenGL ES 2.0 on PowerVR SGX Series 5 Hardware

Table 1-2 provides a high-level summary for OpenGL ES 2.0 platforms.

Table 1-2  Summary of key OpenGL ES 2.0 attribute values implemented for SGX 535, 543, and 554

OpenGL ES 2.0 attributes

Values for SGX 535

Values for SGX 543 and 554

MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE

2048 x 2048

4096 x 4096

MAX_TEXTURE_IMAGE_UNITS

8

8

MAX_COMBINED_TEXTURE_IMAGE_UNITS

8

8

MAX_VERTEX_TEXTURE_IMAGE_UNITS

0

0

MAX_VERTEX_ATTRIBS

16

16

MAX_VERTEX_UNIFORM_VECTORS

128

128

MAX_FRAGMENT_UNIFORM_VECTORS

64

64

MAX_VARYING_VECTORS

8

8

Considerations

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. For more information, see Perform Vector Calculations Lazily in OpenGL ES Programming Guide.

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

  • Swizzling components of vectors declared with low precision is expensive and should be avoided.

  • Many built-in functions use medium-precision inputs and outputs. If your app provides low-precision floating-point values as parameters or assigns the results to a low-precision floating-point variable, the shader may have to include additional instructions to convert the values. These additional instructions are also added when swizzling the vector results of a computation.

The vertex shader and fragment processing combined cannot use more than 8 texture image units. See Section 2.10.5 in the Khronos OpenGL ES Version 2.0.25 specification for details. Additionally, texture fetches in vertex shaders are not supported.

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

Supported OpenGL ES 2.0 Extensions

The following extensions are supported for all SGX Series 5 processors: 535, 543, and 554:

The following extensions are supported for the SGX 543 and 554 processors only:

OpenGL ES 1.1 on PowerVR SGX Series 5 Hardware

OpenGL ES 1.1 is implemented on PowerVR SGX Series 5 hardware using customized shaders. Whenever your app changes OpenGL ES state variables, a new shader is implicitly generated as needed. Because of this, changing OpenGL ES state may be more expensive than it would be on a pure hardware implementation. You can improve the performance of your app by reducing the number of state changes it performs. For more information, see Be Mindful of OpenGL ES State Variables in OpenGL ES Programming Guide.

Table 1-3 provides a high-level summary for OpenGL ES 1.1 platforms.

Table 1-3  Summary of key OpenGL ES 1.1 attribute values implemented for SGX 535, 543, and 554

OpenGL ES 1.1 Attributes

Values for SGX 535

Values for SGX 543 and 554

MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE

2048 x 2048

4096 x 4096

MAX_TEXTURE_UNITS

8

8

LINE_WIDTH_RANGE

1.0 - 16.0 pixels

1.0 - 16.0 pixels

POINT_SIZE_RANGES

1.0 - 511.0 pixels

1.0 - 511.0 pixels

MAX_PALETTE_MATRICES_OES

11

11

MAX_VERTEX_UNITS_OES

4

4

MAX_CLIP_PLANES

6

6

MAX_TEXTURE_LOD_BIAS_EXT

4

4

Supported OpenGL ES 1.1 Extensions:

The following extensions are supported for all SGX Series 5 processors: 535, 543, and 554: