Index draw calls
Indexed draw calls allow for reuse of vertices and are more efficient than non-indexed draw calls.
You must understand the following concepts:
- Draw calls.
- Index buffers.
How to optimize index draw calls
Try using the following optimization steps:
- Use indexed draw calls whenever vertex reuse is possible.
- Optimize index locality for a post-transform cache.
- To minimize redundant processing and data fetch, ensure that the index buffer references the entire range of index values.
- Create tightly packed vertex ranges for lower level of detail meshes.
- Use glDrawRangeElements() for volatile resources.
- To implement geometry Level of Detail (LOD), create a contiguous set of vertices for each detail level.
Index draw call steps to avoid
Arm recommends that you:
- Do not use client-side index buffers.
- Do not modify the contents of index buffers. Doing so causes the driver to rescan the index buffer to determine the active index range.
- Do not use indices that sparsely access vertices in the vertex buffer.
- Do not use indexed draws for simple geometry which has no vertex reuse, such as simple quads or point lists.
- Do not create a low detail mesh by sparsely sampling vertices from the full detail mesh.
Negative impacts of inefficient index draw calls
Unoptimized index draw calls can lead to the following problems:
- The use of client-side index buffers increases the CPU load. Client-side index buffers first allocate server-side buffer storage, then copies the data, and finally, scans the contents to determine the active index ranges.
- The use of index buffers with frequently modified contents shows up as increased load on the CPU. The increased load is due to the need to rescan the buffer to determine the active index ranges.
- Inefficient mesh indexing that is due to index sparseness, or poor spatial locality. This shows up as extra GPU vertex processing time or extra memory bandwidth that is being used. The severity of the impact depends on the complexity of the mesh and the layout of the index buffer that is in memory.
Debugging index draw calls issues
Scan through all index buffers before submission. Optimize any buffers that include any unused indices.