This backports upstream 3Shain/dxmt aadf0fb ("add missing increment in loop") and the zero-count guard from the same functions on upstream main (3Shain/dxmt#200).
The bugs
gs_draw_arguments_marshalandts_draw_arguments_marshalnever advanceindex. The host setsend_of_commandonly on the last task. So any batch of two or more GS/TS draws spins ontasks[0]until the GPU times out, and the later tasks' dispatch arguments are never written.- A draw with zero vertices or instances underflows
x - 1, so it can request about 4G threadgroups.
Effect: Dark Souls III froze for good in combat on an iPhone Air. Frames stopped and never resumed, and the log shows tessellated draws in flight plus kIOGPUCommandBufferCallbackErrorInnocentVictim errors every ~10 s afterwards. Sekiro on macOS hit the same loop (3Shain/dxmt#200).
Tested: I built d3d11.dll (arm64ec) from 128b297 with this change and #40, and compiled the metallib with xcrun metal -std=metal3.1 --target=air64-apple-macos14.0 as meson does. With that DLL, DS3 did not freeze in the two combat sessions since (one ended in an unrelated crash, since fixed by a Wine setting). Before this change, it froze in combat in both earlier sessions.
🤖 Generated with Claude Code