optimize_overdraw

Function optimize_overdraw 

Source
pub fn optimize_overdraw<Vertex>(
    destination: &mut [u32],
    indices: &[u32],
    vertices: &[Vertex],
    threshold: f32,
)
where Vertex: Position,
Expand description

Reorders indices to reduce the number of GPU vertex shader invocations and the pixel overdraw.

If index buffer contains multiple ranges for multiple draw calls, this functions needs to be called on each range individually.

ยงArguments

  • destination: must contain enough space for the resulting index buffer (indices.len() elements)
  • indices: must contain index data that is the result of optimize_vertex_cache (not the original mesh indices!)
  • threshold: indicates how much the overdraw optimizer can degrade vertex cache efficiency (1.05 = up to 5%) to reduce overdraw more efficiently