Sorting Geometry Effectively on PowerVR#

Distance#

On PowerVR hardware, there is no performance benefit to be gained by sorting opaque geometry based on distance from the camera. The Hidden Surface Removal (HSR) hardware will detect and remove occluded (opaque) geometry from the pipeline automatically before fragment processing begins. Performing this operation would be a waste of resources.

However, for blended geometry, sorting is necessary to get the correct results, and for alpha-tested geometry, it may actually be beneficial to sort. If the application uses opaque, alpha-tested, and alpha-blended objects in a scene, then it is advised that the application renders the opaque objects first, followed by the alpha-tested objects, and finally the transparent geometry.

Render state#

You can gain performance by sorting geometry based on render state – for example, common materials, shaders, render targets, or resources. Sorting the geometry based on this method can significantly reduce the amount of resources that are switched (operations which may incur significant overheads) by the driver during rendering of the frame. This can reduce the amount of work that the driver performs, therefore reducing CPU workload. It can also reduce the amount of time the graphics core spends idle waiting for resources to be ready before being able to render.

Render to texture#

For maximised performance, the preferred method for rendering to textures in OpenGL ES is through the use of frame buffer objects (FBOs) with textures as attachments.

An application should always render to frame buffer objects (FBO) in series, which means submitting all calls for one FBO before moving to the next. This serves to significantly reduce unnecessary system memory bandwidth usage, caused by flushing partially completed renders to system memory when the target FBO is changed. It also minimises state changes. For optimal performance, attachments should be unique to each FBO, and attachments should not be added or removed once the FBO has been created.

Note

PowerVR hardware exposes a unique extension to efficiently perform downsampling on frame buffer attachments. See Efficient Frame Buffer Downsampling with PowerVR for further information.