metal: a refused pass keeps the submission's fence signals and barrier writes #78
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/78"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AeroUp on 2026-11-26T13:43:36Z.
What
When a pass cannot be encoded,
submit_passesreturned beforecb.commit(), so the whole submission vanished — including itsencodeSignalEventcalls for the title's fences and the bottom-of-pipe value writes other queues wait on.title.rsthen loggeda piece of title work was refusedand consumed the held item. The title's own crash log names the result:Unsignaled CrossQueueBarrier, followed by0xc0000005 at image+0x55e56f8.The command buffer now always commits: the failing pass is dropped, the signals and value writes go out, and the caller is still told which pass failed. Two related fixes in the same path:
0 colour [], depth None) is skipped as the no-op D3D12 makes of it, instead of being refused — Metal cannot create an encoder without an attachment.Evidence
From a run that reaches the world load (Series S profile, 4K output; the process runs the game's x86_64 code, Metal backend native):
and the title's crash log:
Unsignaled CrossQueueBarrier.Testing
cargo build --release --target x86_64-apple-darwinclean.no render encodersays which attachments Metal disliked.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:54:58Z.
Review: CHANGES_REQUESTED
Thanks, the direction is right, but there's a crash risk: in crates/victory-metal/src/gfx.rs (~1222) the "indexed draw without an index buffer"
?returns from encode_render with the render encoder still open, and the patch now keeps encoding later passes and commits that command buffer, which Metal asserts on. Please call endEncoding on that path and add a test where a pass is refused but its fence signals still land.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AeroUp on 2026-11-26T16:16:29Z.
Both points are fixed in the branch (force-pushed):
encode_renderwith the encoder open: that draw is dropped (continue) and logged once, so nothing can reachcommitwith a live encoder.a_refused_pass_keeps_its_fence_signal_and_the_passes_after_itincrates/victory-metal/tests/render.rs. A pass with a depth attachment of another size than the colour one is refused (new: attachments of different size or sample count are refused instead of Metal rendering to the intersection), its fence signal still lands, and the pass after it draws into the target —cargo test -p victory-metal --test renderis 4 passed.The mismatch check doubles as the deterministic refusal the test needs: Metal's encoder creation does not fail for bad attachment formats with validation off.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:37:56Z.
Review: APPROVED
The encoder-open path is closed, attachment mismatches are refused up front, and the new test shows a refused pass still lands its fence signal and the next pass draws. Merged onto main, victory-metal and the native tests pass, clippy and policy are clean, CI is green.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:38:54Z.
Approved. The branch is behind main (no conflicts, but main requires it up to date). Please merge main into the branch and I will merge it right after.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AeroUp on 2026-11-26T16:48:07Z.
Merged
upstream/maininto the branch (clean, 29 files) and re-ran the render test onx86_64-apple-darwin: 4 passed, includinga_refused_pass_keeps_its_fence_signal_and_the_passes_after_it.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:58:58Z.
Review: APPROVED
Rechecked on the updated head: victory-metal and native tests, windows clippy and policy are clean, CI is green.