Skip to content

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

Sync upstream b87a0cc

sync-bot39ef3db9248f
diff --git a/.upstream-ref b/.upstream-ref
index 3150cafc..deeffc3d 100644
--- a/.upstream-ref
+++ b/.upstream-ref
@@ -1 +1 @@
-156d3c2a18a362331aa52bc04c542792a5004586
+b87a0cc6aacb4f60c661c1bced067cea4f1d0e3e
diff --git a/dm/gfx/nvn/nvn_mtl.m b/dm/gfx/nvn/nvn_mtl.m
index 986d1a0f..bed0af97 100644
--- a/dm/gfx/nvn/nvn_mtl.m
+++ b/dm/gfx/nvn/nvn_mtl.m
@@ -1281,7 +1281,7 @@ int mtl_wait(uint64_t fence, uint64_t timeout_ns) {
static void mtl_finish_gpu(void) {
if (g_fence) mtl_wait(g_fence, UINT64_MAX);
- if (on_sub_thread()) rec_publish(); // Pending upload commits sit in the open replay block: hand it over before waiting on g_up_pending, or a loader's QueueFinish mid-submission (Three Houses-style per-resource waits) sleeps forever. Other threads (suspend, diagnostics) cannot publish the submit thread's block; their waits resolve once the submission ends
+ if (on_sub_thread()) rec_publish(); // a batch's commit may still be a record in the encode thread's current block (rec_commit_upload), as in up_begin and q_cb
up_wait_zero(&g_up_pending);
}
void mtl_present_flush(void);
@@ -1641,6 +1641,9 @@ static void up_flush(void) {
res_commit();
[cb endCommandBuffer];
rec_commit_upload(cb, o);
+ // Outside a submission nothing else hands the encode thread its current block until the next submission, so a batch flushed on the spot stayed a record and every wait for it
+ // (nvnQueueFinish on any thread, up_begin on another) waited for that submission: hand it over now (from PR #141, which found the nvnQueueFinish half)
+ if (!g_cb) rec_publish();
g_up_cb = nil; if (g_up_block) { if (g_up_block != g_up_slot_blk[slot]) defer_obj_release(g_up_block); g_up_block = nil; } g_up_block_off = g_up_block_size = 0; // the slot's own block stays (UP_SLOT_BLOCK)
for (id obj in g_up_keep) defer_obj_release(obj);
[g_up_keep removeAllObjects];