You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d24d7c2
Browse filesBrowse the repository at this point in the historyBrowse files
Cache Metal 4 compute pipelines for Mario Kart World and Z-A
Backport nxnative 30fb213 for the two iOS game profiles. Keep compute captures out of render-only compaction, bound background capture, and preserve the existing shader chain and legacy renderer.
Copy file name to clipboardExpand all lines: dm/gfx/nvn/nvn_mtl.m
+57-7Lines changed: 57 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -6187,10 +6187,11 @@ static int arch_compact_allowed(void) {
6187
6187
// pipeline found in the files. The flush used to hold a lock against every such compile instead, and one compile that did not return (Super Mario Odyssey's alRenderMaterialUber
6188
6188
// with the front end at -O2: 33.7 minutes until Metal gave up, GitHub issue #294) held the flush, and the flush every compile and draw that came after it. Now such a compile
6189
6189
// holds back the file of its own period and nothing else
6190
-
@interface ArchEpoch : NSObject { @public id<MTL4Compiler> comp; id<MTL4PipelineDataSetSerializer> ser; dispatch_group_t busy; _Atomic int active, n, vd; int compacting; } @end
6190
+
@interface ArchEpoch : NSObject { @public id<MTL4Compiler> comp; id<MTL4PipelineDataSetSerializer> ser; dispatch_group_t busy; _Atomic int active, n, vd, cs; int compacting; } @end
6191
6191
// n, vd: bases captured, those with a vertex layout
6192
6192
@implementation ArchEpoch @end
6193
6193
static ArchEpoch *g_ep; static os_unfair_lock g_ep_lock = OS_UNFAIR_LOCK_INIT; // the current period
6194
+
static int g_cps_files;
6194
6195
static int g_arch_cap; // compiles are captured (an archive folder, a serializer): immutable after pso4_init
6195
6196
static dispatch_group_t g_arch_pending; // periods handed over and not written yet
else MLOG("[RED] pipeline archive file %s not usable (%s): its bases are built again", p.UTF8String, ae ? ae.localizedDescription.UTF8String : "not a pipeline archive");
if ([ep->comp newComputePipelineStateWithDescriptor:d compilerTaskOptions:nil error:nil]) {
6467
+
atomic_fetch_add(&ep->n, 1);
6468
+
atomic_fetch_add(&ep->cs, 1);
6469
+
atomic_fetch_add(&g_arch_new, 1);
6470
+
arch_note_new();
6471
+
}
6472
+
ep_leave(ep);
6473
+
} });
6474
+
}
6475
+
return ps;
6476
+
}
6427
6477
static void arch_compact_finish(void) { // after the period that holds the recaptured bases is written (arch_write): the old files go once their bases are in the new one
6428
6478
if (!g_compact_files || !g_compacted) return;
6429
6479
if (!g_arch_flush_ok) { MLOG("[RED] pipeline archive: compaction left the old files (the flush failed)"); return; }
0 commit comments