What a GL-on-Metal layer's frames cost the GPU where a compute dispatch before each draw fixes
up that draw's index buffer (each dispatch writing a Private buffer of its own, in serial compute
encoders of 256 dispatches, then render passes of 26 indexed draws, 4 passes a command buffer),
beside the same frame with the indices written once before (prefixed) and the compute encoders
alone (dispatches). The defaults follow a GL benchmark's per-second counts on the runtime (about
470 compute encoders of 256 dispatches, 4,650 passes of 26 draws, 1,270 command buffers).
The kernel and the draw's functions are a new owned MSL fixture,
fixtures/public/examples/fixed_indices.metal, compiled by regen-air-fixtures --dir examples.
Release measurement on an RTX 5080 Laptop GPU (b5080 entry glfix-framesplit-124152; GPU busy per frame, union of
command-buffer spans, median of 60 frames; a frame of 1280 draws):
- fixed: 0.526 ms;
- prefixed: 0.404 ms;
- compute encoders alone: 0.116 ms (0.09 us a dispatch).
fixed minus prefixed equals the dispatches' own time, so the compute-to-render transitions and the extra command
buffers cost about 0.006 ms a frame. No runtime source changes; the runtime pin moves alone.
Verified: msi m3-max-30123 at 195f2073fd:
- runtime crate clippy -D warnings --all-targets --all-features, plain and --cfg m2v_cpu_icd: 0;
- release build: 0;
- a lavapipe run of all three shapes: the index check passed after each.