Files
metal2vulkan/docs
Anees Iqbal 12f58a227f Keep no chunk of a buffer of mesh or patch draws alone: none of their draws is plain
922caf3199 records an execution of commands the CPU encoded chunk by chunk, each chunk
apart from a KeptContext of its own (a command pool, descriptor arena and uploads), and
keeps a chunk whose draws are all plain. A mesh draw and a patch draw are never plain
(render/executions.rs clears RenderLowering::replay_plain for both), so on a buffer whose
command types hold neither DRAW nor DRAW_INDEXED every chunk recorded apart was found not
plain, noted, and its execution finished through the apart encoder. That cost a command
pool and two more primaries, each with a barrier, on the first execution, and kept
nothing. RenderExecution::keeping now admits only a buffer whose command types intersect
DRAW | DRAW_INDEXED (the test settle already makes). A buffer of mesh or patch draws
alone records as it did before 922caf3199. A buffer that mixes them with draws of
primitives keeps today's path. docs/FAST-PATHS.md's known gap lists the buffers that
still record at every commit.

Runtime behaviour: such a buffer's executions record no chunk apart. An execution of a
chunk of resets alone on one of them, which draws nothing, is no longer kept either.

The cost gate showed the redundant work as three conformance rises, now withheld in the
records, all from 922caf3199. Each case measured alone, debug, M3 Max, over 8 runs:
- indirect-mesh-commands-object-threadgroup-lengths: command_buffers_begun 11 -> 9,
  continuations 3 -> 1, submitted 8 -> 6, cmd_pipeline_barrier 14 -> 12,
  end_command_buffer 11 -> 9, encoder_command_buffers_begun 9 -> 7.
- mesh-commands-unordered-draws: 9 -> 7, 3 -> 1, 6 -> 4, 11 -> 9, 9 -> 7, 8 -> 6.
- mesh-commands-own-state: 10 -> 8, 3 -> 1, 7 -> 5, 13 -> 11, 10 -> 8, 8 -> 6.
command_pools_made fell 2 -> 1 in each. Every gated count equals its value at
c00efdc7c0, 922caf3199's parent. The remaining differences are scheduler_sleeps,
scheduler_wakes_host and submit_stalls_on_work, which the race rule names.

Test: runtime_lane::mesh_commands::a_buffer_of_mesh_draws_alone_records_no_chunk_apart
executes the CPU's own commands on a buffer of both mesh kinds twice, after another
buffer's execution. It asserts the first execution begins as many command buffers as
the second, and that both draw Metal's words. Verified on the M3 Max (--cfg m2v_gpu):
it passes with the fix, and fails without it (left 9, right 7). own_commands_draw_metals_words,
which now shares encode_own, passes. clippy -D warnings, all targets and features, with
--cfg m2v_gpu, is clean for metal2vulkan-runtime and metal2vulkan-validation.

RUNTIME_VERSION and the runtime-sources pin are left to the stack.

(cherry picked from commit 132d0aeea055b9a3819c82619a12e3c4adf32646)
(cherry picked from commit 2a23d1882ceb4cd21506af2a66f92f8258b5b2b2)
2026-11-03 11:08:02 -08:00
..