Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Sync patcher: upstream ported the mtl_finish_gpu fix with their own comment

LNPANDYca346325badf
diff --git a/scripts/sync_upstream.py b/scripts/sync_upstream.py
index e0a3f2b8..0f5acdef 100644
--- a/scripts/sync_upstream.py
+++ b/scripts/sync_upstream.py
@@ -379,9 +379,9 @@ def patch_nvn_mtl(t):
# The fork's fix for the iOS save-load freeze (NX2Apple issue #4): an upload batch's commit can sit
# recorded in the open replay block (rec_commit_upload) while the submit thread sleeps on a slot or
# on g_up_pending — nothing else hands the block over mid-submission, so the submission can never
- # end and the wait never resolves. Upstream independently fixed the up_begin half (Little Nightmares
- # II, their comment in up_begin); ours is kept for the case their tree loses it, and the
- # mtl_finish_gpu half (a loader's QueueFinish mid-submission) is ours alone.
+ # end and the wait never resolves. Upstream fixed the up_begin half (Little Nightmares II) and then
+ # ported our mtl_finish_gpu half with their own comment (b87a0cc, plus their up_flush self-publish
+ # for waiters on any thread); the markers accept either comment, ours or theirs.
P = [
('up_begin publish', ['the iOS save-load freeze of NX2Apple issue #4', "Little Nightmares II's first render passes"], [(
''' unsigned slot = g_up_seq++ % 3;
@@ -389,7 +389,7 @@ def patch_nvn_mtl(t):
''' unsigned slot = g_up_seq++ % 3;
if (atomic_load(&g_up_alloc_busy[slot])) rec_publish(); // The commit of the batch that still holds this slot sits in the open replay block (rec_commit_upload). Hand the block to the encode thread before sleeping on the slot: a submit thread that opens a 4th batch within one submission would otherwise wait forever — nothing else hands the block over mid-submission, and the submission cannot end while up_begin blocks (the iOS save-load freeze of NX2Apple issue #4)
up_wait_zero(&g_up_alloc_busy[slot]);''')]),
- ('finish publish', ['hand it over before waiting on g_up_pending'], [(
+ ('finish publish', ['if (on_sub_thread()) rec_publish();'], [(
''' if (g_fence) mtl_wait(g_fence, UINT64_MAX);
up_wait_zero(&g_up_pending);''',
''' if (g_fence) mtl_wait(g_fence, UINT64_MAX);
@@ -440,7 +440,7 @@ MARKERS = {
'scripts/build_ipa_from_nsp.py': '--work-dir',
'dm/gfx/tools/shader_split.py': "ue_inline_shaders(d, f'/{rel}#{label}', out)",
'dm/ios/Sources/main.m': 'romfs.idx',
- 'dm/gfx/nvn/nvn_mtl.m': 'hand it over before waiting on g_up_pending',
+ 'dm/gfx/nvn/nvn_mtl.m': 'if (on_sub_thread()) rec_publish();',
'dm/games/0100A00019DE0000/game.tsv': 'build v1 1.0.137848',
}
PATCHERS = {