When a GPU processes geometry, it works out which primitives are going to be visible inside the view volume, and discards any that are not. This reduces the amount of pixel processing work required. To decide which primitives can be culled, the GPU performs the following tests:
- Frustum (or Z plane) test. Objects that are outside the camera's near and far clip planes can be discarded because we can guarantee they have no visible impact on screen.
- Facing (or XY plane) test. Triangles that are inside the camera’s near and far clip planes, but facing away from the camera are known as ‘back facing’ triangles. Only one side of each triangle is visible, representing the outer surface of an object. The other side is almost always invisible, because it’s inside the object being rendered.
- Sample test. If primitives pass the frustum and facing tests, they are rasterized into 2x2 pixel patches, called quads, prior to fragment shading. Triangles have to hit at least one rasterization sample point to be considered visible. Triangles that don’t hit any sample points are too small to be rasterized and are discarded.
Mali geometry usage
Use the Mali Geometry Usage chart to check how many primitives were sent to the GPU for processing, how many were visible on-screen, how many were culled.
Mali geometry culling rate
Use the Mali Geometry Culling Rate chart to see how much work was culled by each of the different tests. The values show the percentage of primitives that entered that stage, that were culled by it. These values are not expected to total 100%.
Because every triangle has a back-face, you should expect around 50% of input primitives to be culled by the facing test.
If you see more than 5% of primitives being culled by the sample test, this could indicate that your object meshes could be too complex. Even though the GPU can cull triangles that don't hit any sample points, there may still be many triangles that hit one or two sample points, which then need to be processed using the full quad. These triangles are disproportionately expensive for a GPU to process, as they make shader execution far less efficient. To reduce the number of small triangles, use mesh level-of-detail to force objects to use a simpler mesh when they are further away from the camera.
Tip: Use Graphics Analyzer to check the complexity of objects compared with their size on screen.
Geometry that passes the frustum, facing and sample tests, is sent through to be fragment shaded, where the GPU colors in the pixels to produce the final on-screen output. However it may still be culled by early or late depth and stencil testing.