Hardware GPU Information
Since the introduction of the original iPhone, Apple has continued to improve the GPU capabilities in new iOS devices. When you write a Metal or OpenGL ES app, you need to understand the specific limits of each device you app runs on. Currently, two distinct GPU categories are in common use:
-
The Apple A7, A8, and A9 GPUs
-
The PowerVR SGX 543 and 554 GPUs
Table 2-1 lists the devices that are compatible with Metal and OpenGL ES 3.0.
Device name | GPU |
---|---|
iPhone 6s iPhone 6s Plus iPhone SE | Apple A9 GPU |
iPhone 6 iPhone 6 Plus | Apple A8 GPU |
iPhone 5s | Apple A7 GPU |
iPad Pro (12.9-inch) Wi-Fi iPad Pro (12.9-inch) Wi-Fi + Cellular iPad Pro (9.7-inch) Wi-Fi iPad Pro (9.7-inch) Wi-Fi + Cellular | Apple A9 GPU |
iPad Air 2 Wi-Fi iPad Air 2 Wi-Fi + Cellular | Apple A8 GPU |
iPad Air Wi-Fi iPad Air Wi-Fi + Cellular | Apple A7 GPU |
iPad mini 4 Wi-Fi iPad mini 4 Wi-Fi + Cellular | Apple A8 GPU |
iPad mini 3 Wi-Fi iPad mini 3 Wi-Fi + Cellular iPad mini 2 Wi-Fi iPad mini 2 Wi-Fi + Cellular | Apple A7 GPU |
iPod Touch (6th generation) | Apple A8 GPU |
Table 2-2 lists the devices that are compatible with OpenGL ES 2.0.
Device name | GPU |
---|---|
iPhone 6s iPhone 6s Plus iPhone SE | Apple A9 GPU |
iPhone 6 iPhone 6 Plus | Apple A8 GPU |
iPhone 5s | Apple A7 GPU |
iPhone 5c iPhone 5 iPhone 4s | SGX 543 |
iPhone 4 iPhone 3GS iPhone 3GS (China) | SGX 535 |
iPad Pro (12.9-inch) Wi-Fi iPad Pro (12.9-inch) Wi-Fi + Cellular iPad Pro (9.7-inch) Wi-Fi iPad Pro (9.7-inch) Wi-Fi + Cellular | Apple A9 GPU |
iPad Air 2 Wi-Fi iPad Air 2 Wi-Fi + Cellular | Apple A8 GPU |
iPad Air Wi-Fi iPad Air Wi-Fi + Cellular | Apple A7 GPU |
iPad mini 4 Wi-Fi iPad mini 4 Wi-Fi + Cellular | Apple A8 GPU |
iPad mini 3 Wi-Fi iPad mini 3 Wi-Fi + Cellular iPad mini 2 Wi-Fi iPad mini 2 Wi-Fi + Cellular | Apple A7 GPU |
iPad mini Wi-Fi iPad mini Wi-Fi + Cellular | SGX 543 |
iPad Wi-Fi (4th generation) iPad Wi-Fi + Cellular (4th generation) | SGX 554 |
iPad Wi-Fi (3rd generation) iPad Wi-Fi + Cellular (3rd generation) iPad 2 Wi-Fi iPad 2 Wi-Fi + 3G | SGX 543 |
iPad Wi-Fi iPad Wi-Fi + 3G | SGX 535 |
iPod Touch (6th generation) | Apple A8 GPU |
iPod Touch (5th generation) | SGX 543 |
iPod Touch (3rd generation) iPod Touch (4th generation) | SGX 535 |
Apple A7, A8, and A9 GPU Hardware
Together, the Apple A7, A8, and A9 GPUs create a new generation of graphics hardware that support both Metal and OpenGL ES 3.0. To get the most out of a 3D, graphics-dominated app running on the A7, A8, and A9 GPUs, use Metal. Metal provides extremely low-overhead access to the A7, A8, and A9 GPUs, enabling incredibly high performance for your sophisticated graphics rendering and computational tasks. Metal eliminates many performance bottlenecks—such as costly state validation—that are found in traditional graphics APIs. If you do not want to use Metal, use OpenGL ES 3.0 when building an app. Both Metal and OpenGL ES 3.0 incorporate many new features, such as multiple render targets and transform feedback, that have not been available on mobile processors before. This means that advanced rendering techniques that have previously been available only on desktop machines, such as deferred rendering, can now be used in iOS apps. See Metal Programming Guide for more information about what features are visible to Metal apps.
To take advantage of the power of the A7, A8, and A9 GPUs, your app must support Metal or OpenGL ES 3.0. Using Metal or OpenGL ES 3.0 gives you access to the new features and also to a larger pool of rendering resources. For example, on the A7, A8, and A9 GPUs, an app that uses Metal or OpenGL ES 3.0 can access twice as many textures in a shader than an app that uses OpenGL ES 2.0.
Metal Feature Sets
A Metal feature set describes the features, limits, and capabilities of a Metal implementation. Each Metal feature set is tied to a specific OS and GPU pairing. See the Metal Feature Set Tables chapter of the Metal Programming Guide for specific information about each Metal feature set.
Best Practices for OpenGL ES 3.0
These practices apply to OpenGL ES apps on Apple A7, A8, and A9 GPU 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
, andglFinish
. -
Follow the drawing guidelines found in Do Not Sort Rendered Objects Unless Necessary in OpenGL ES Programming Guide for iOS.
-
When possible, your renderbuffer’s height and width should be a multiple of 32 pixels.
OpenGL ES 3.0 on Apple A7, A8, and A9 GPUs
Table 2-3 provides a high-level summary for OpenGL ES 3.0.
OpenGL ES 3.0 attributes | Values for A7, A8, and A9 GPUs |
---|---|
MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE | 4096 x 4096 |
MAX_ARRAY_TEXTURE_LAYERS | 2048 |
MAX_COLOR_ATTACHMENTS | 4 |
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS | 50048 |
MAX_COMBINED_TEXTURE_IMAGE_UNITS | 32 |
MAX_COMBINED_UNIFORM_BLOCKS | 24 |
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS | 51200 |
MAX_DRAW_BUFFERS | 4 |
MAX_FRAGMENT_INPUT_COMPONENTS | 64 |
MAX_FRAGMENT_UNIFORM_BLOCKS | 12 |
MAX_FRAGMENT_UNIFORM_COMPONENTS | 896 |
MIN_PROGRAM_TEXEL_OFFSET | -8 |
MAX_PROGRAM_TEXEL_OFFSET | 7 |
MAX_SAMPLES | 8 |
MAX_TEXTURE_IMAGE_UNITS | 16 |
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS | 64 |
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS | 4 |
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS | 4 |
MAX_VARYING_VECTORS | 15 |
MAX_VERTEX_ATTRIBS | 16 |
MAX_VERTEX_OUTPUT_COMPONENTS | 64 |
MAX_VERTEX_TEXTURE_IMAGE_UNITS | 16 |
MAX_VERTEX_UNIFORM_BLOCKS | 12 |
MAX_VERTEX_UNIFORM_COMPONENTS | 2048 |
MAX_UNIFORM_BLOCK_SIZE | 16384 |
Considerations
The A7, A8, and A9 GPUs process all 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 for iOS.
Medium- and low-precision floating-point shader values are computed identically, as 16-bit floating point values. This is a change from the PowerVR SGX hardware, which used 10-bit fixed-point format for low-precision values. If your shaders use low-precision floating point variables and you also support the PowerVR SGX hardware, you must test your shaders on both GPUs.
The Apple A7, A8, and A9 GPUs do not penalize dependent-texture fetches.
Always use framebuffer discard operations when your framebuffer contents are no longer needed. The penalty for not doing so is higher than it was on earlier GPUs. For best results, use the GLKView
class; it automatically implements framebuffer discard operations.
When rendering to multiple targets, limit your app to four image targets (and no more than 128 bits of total data on A7 and 256 bits of total data on A8 written to the targets). A single sRGB
target counts as 64 bits.
Supported OpenGL ES 3.0 Extensions
OpenGL ES 3 includes functionality provided by extensions in Apple’s implementation of OpenGL ES 2.0. If you are updating an existing OpenGL ES 2.0 app to use OpenGL ES 3.0, please note that many of these extensions are not provided in OpenGL ES 3.0. Therefore, your code must be updated to use the new core functionality instead.
The following extensions are supported for the A7, A8, and A9 GPUs in OpenGL ES 3 apps:
The A8 GPU supports the following additional extension: GL_KHR_texture_compression_astc_ldr.
The following extensions are supported, but OpenGL ES 3 provides core functionality that matches these extensions. If you are porting an OpenGL ES 2 app that uses these extensions, you should migrate your shaders to the core OpenGL ES 3 functionality.
OpenGL ES 2.0 on Apple A7, A8, and A9 GPUs
Table 2-4 provides a high-level summary for OpenGL ES 2.0.
OpenGL ES 2.0 attributes | Values for A7, A8, and A9 GPUs |
---|---|
MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE | 4096 x 4096 |
MAX_TEXTURE_IMAGE_UNITS | 8 |
MAX_COMBINED_TEXTURE_IMAGE_UNITS | 8 |
MAX_VERTEX_TEXTURE_IMAGE_UNITS | 8 |
MAX_VERTEX_ATTRIBS | 16 |
MAX_VERTEX_UNIFORM_VECTORS | 128 |
MAX_FRAGMENT_UNIFORM_VECTORS | 64 |
MAX_VARYING_VECTORS | 8 |
Considerations
The A7, A8, and A9 GPUs process all 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 for iOS.
Medium- and low-precision floating-point shader values are computed identically, as 16-bit floating point values. This is a change from the PowerVR SGX hardware, which used 10-bit fixed-point format for low-precision values. If your shaders use low-precision floating point variables and you also support the PowerVR SGX hardware, you must test your shaders on both GPUs.
The Apple A7, A8, and A9 GPUs do not penalize dependent-texture fetches.
Always use framebuffer discard operations when your framebuffer contents are no longer needed. The penalty for not discarding framebuffers is higher than it was on earlier GPUs. For best results, use the GLKView
class; it automatically implements framebuffer discard operations.
Supported OpenGL ES 2.0 Extensions
The following extensions are supported for the Apple A7, A8, and A9 GPUs:
PowerVR SGX Hardware
Imagination Technologies has several useful references about PowerVR technologies:
-
PowerVR SGX OpenGL ES2.0 Application Development Recommendations. Introduces the SGX Series of processors and describes how to optimize for them.
-
PowerVR 3D Application Development Recommendations. Introduces 3D graphics apps and provides some “golden rules” for developing such apps.
-
Imagination Technologies home page.
Best Practices for OpenGL ES 2.0
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
, andglFinish
. -
To take advantage of the processor’s hidden surface removal, follow the drawing guidelines found in Do Not Sort Rendered Objects Unless Necessary in OpenGL ES Programming Guide for iOS.
-
Vertex buffer objects (VBOs) provide a significant performance improvement on the PowerVR SGX. See Use Vertex Buffer Objects to Manage Copying Vertex Data inOpenGL ES Programming Guide for iOS.
-
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 2-5 provides a high-level summary for OpenGL ES 2.0 platforms.
OpenGL ES 2.0 attributes | Values for SGX 543 and 554 |
---|---|
MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE | 4096 x 4096 |
MAX_TEXTURE_IMAGE_UNITS | 8 |
MAX_COMBINED_TEXTURE_IMAGE_UNITS | 8 |
MAX_VERTEX_TEXTURE_IMAGE_UNITS | 8 |
MAX_VERTEX_ATTRIBS | 16 |
MAX_VERTEX_UNIFORM_VECTORS | 128 |
MAX_FRAGMENT_UNIFORM_VECTORS | 64 |
MAX_VARYING_VECTORS | 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 for iOS.
Although medium- and low-precision floating-point values are both processed in parallel, 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.
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: 543 and 554:
The following extensions are supported for the SGX 543 and 554 processors only: