Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ea680b3
The NSP script's shader folder is named shader.noindex, so Spotlight …
PucaVaz Nov 6, 2026
82a24a4
Shader split: decompress zstd files in-process, so a worker no longer…
Nov 6, 2026
046f389
Guest thread wakes are signalled after the thread lock is let go
Xipzer Nov 6, 2026
0762d88
Texture checks without conformsToProtocol: the answer is kept per class
Xipzer Nov 6, 2026
02698e0
A long render pass starts on the GPU while it is translated
Xipzer Nov 6, 2026
bba2bb7
Snapshots: a draw that samples no attachment of its pass leaves fb_pr…
Xipzer Nov 6, 2026
507a76c
Argument tables: uniform-buffer-only changes copy the table and remak…
Xipzer Nov 6, 2026
e9cfaa7
Submit thread: tex_mtl, tex_by_id and rp_begin_ex return unretained
Xipzer Nov 6, 2026
0f510fd
Raw global memory lookups start from the entry they chose last: Ocari…
seedds Nov 6, 2026
c2fa4a5
Pools that hold shader code are no longer made resident to key their …
Nov 6, 2026
4919040
perf(shaders): store stage memory bytes with atomic AND and OR instea…
Nov 6, 2026
88eb39d
A pool table takes again only the IDs a change reaches instead of bei…
PucaVaz Nov 6, 2026
b4318c7
ŌKAMI HD plays on the Mac from its provisional profile: boot, the pro…
seedds Nov 6, 2026
38ed45a
Ocarina of Time's first start no longer shows a black picture with th…
Nov 6, 2026
e4cc4bb
A takeover's note names no texture because it changes no serial's tex…
PucaVaz Nov 6, 2026
6d928fd
The encode thread records and replays indirect task / mesh draws: Oca…
seedds Nov 6, 2026
bd9f422
HMMA chains keep their accumulators and A in the SIMD-group's matrice…
seedds Nov 6, 2026
d8184ff
fix(nvn): retain bound render targets across submissions
hlstwizard Nov 6, 2026
d4239a6
A storage takeover asks whether a live texture object holds each shar…
seedds Nov 6, 2026
c229bd7
A memory pool's texture IDs are marked gone before its CPU-written cl…
seedds Nov 6, 2026
339d9f2
Raw pool table words follow the pools at commit: a memory pool made b…
seedds Nov 6, 2026
51cc8bc
Minecraft Dungeons II plays on the Mac to first control in its first …
seedds Nov 6, 2026
9c2fb0c
A shader build leaves a few files instead of one per shader output: f…
seedds Nov 6, 2026
cac783a
Copy strides are command buffer state, as in NVN: Smash's one-texture…
seedds Nov 6, 2026
04df08d
Ocarina of Time's shaders all build: ATOMG.CAS translates, Metal take…
seedds Nov 6, 2026
37e7906
perf(pipelines): take compute pipelines from the pipeline archives in…
Nov 6, 2026
f6aa292
perf(shaders): faster cold Metal builds across all games
seedds Nov 6, 2026
f983a79
clang-tidy ratchet after the upstream merge: false positives marked, …
gnosticgeek Nov 6, 2026
d27661c
nvn_mtl: g_tex_live stores the texture's address with an explicit cas…
claude Nov 6, 2026
c2221c9
Merge remote-tracking branch 'origin/fix/clang-tidy-0.12.0' into rele…
claude Nov 6, 2026
0251172
Merge upstream seedds/nxnative main up to 04df08d into release-0.13.0
claude Nov 6, 2026
0e0238a
Merge upstream PR #1469
claude Nov 6, 2026
c7d85ee
Merge upstream PR #1466
claude Nov 6, 2026
75334af
Merge upstream PR #1472
claude Nov 6, 2026
11d6e59
Merge upstream PR #1484
claude Nov 6, 2026
0216f8a
Merge upstream PR #1493
claude Nov 6, 2026
2bc46cb
Merge upstream PR #1463
claude Nov 6, 2026
38bbdfc
Merge upstream PR #1467
claude Nov 6, 2026
1c847fa
Merge upstream PR #1473
claude Nov 6, 2026
7becc92
Merge upstream PR #1468
claude Nov 6, 2026
c89860f
Merge upstream PR #1489
claude Nov 6, 2026
e36d1e3
An image placed in its pool's heap is never taken as a resolution fam…
seedds Nov 6, 2026
159c364
Merge upstream PR #1502
claude Nov 6, 2026
1a5ff21
Merge upstream PR #1522
claude Nov 6, 2026
9ae1b2d
Merge upstream PR #1438
claude Nov 6, 2026
6fc4114
Merge upstream PR #1503
claude Nov 6, 2026
ee8a381
Merge upstream PR #1520
claude Nov 6, 2026
7f7b63d
Symptom index and switch table brought up to date after the merges (D…
claude Nov 6, 2026
0a4018c
CHANGELOG: Unreleased entry for 0.13.0 (performance release)
claude Nov 6, 2026
333f7b1
Translator rebuilt for release 0.13.0; chain lock and header regenera…
gnosticgeek Nov 6, 2026
223c567
nvn_mtl.m: drop the second copy of the serial-table hold count the me…
gnosticgeek Nov 6, 2026
e174543
t_vi_display: stubs for the frame history hle_vi.c now keeps (now_ns,…
gnosticgeek Nov 6, 2026
848255d
Tests follow the merges: the finish_all scheduler test goes with fini…
gnosticgeek Nov 6, 2026
b3c2f4d
gfx tests build and pass after the merges: dm_vi_frame_queued stubs f…
gnosticgeek Nov 6, 2026
a461e04
Codec: a late first "free" signal no longer aborts Mario Kart World
claude Nov 6, 2026
a82b71b
CHANGELOG 0.13.0: the Mario Kart World post-race fix
claude Nov 6, 2026
25a73c7
Dirty-page tracking skips addresses outside every pool; an OpenGL par…
claude Nov 6, 2026
4c7880d
Merge perf-0.14-small: dirty-page bounds check and OpenGL clear depth…
claude Nov 6, 2026
1dee635
CHANGELOG 0.13.0: dirty-page bounds check, OpenGL clear state
claude Nov 6, 2026
87e17de
vk_shaders.py: every child process gets stdin=/dev/null (from xinerqu…
claude Nov 6, 2026
722d61b
0.13.0 docs: BACKLOG 0.14 candidates and merge row, README credit for…
claude Nov 6, 2026
f89cffb
Release 0.13.0: CHANGELOG entry dated
claude Nov 6, 2026
46437ee
t_condvar: register arrays hold 32 entries, as svc_thread reads x30 (…
claude Nov 6, 2026
1d12207
t_fuse_check: compare the kept target's identity fields instead of me…
claude Nov 6, 2026
b9ce454
nvn_mtl: cps_prefetched checks the key before the dictionary lookup (…
claude Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
A long render pass starts on the GPU while it is translated
With no segment on the GPU and DM_NVN_PASS_SPLIT draws (256) encoded since the last cut, the open pass is ended
(attachments stored by rp_end as at every other mid-pass end), the segment committed, and the next draw opens the
pass again with loads; at most DM_NVN_PASS_SPLIT_MAX (2) splits a pass. A pass reopened by a split does not run
the dispatch-hoist scan again.
  • Loading branch information
Xipzer committed Nov 6, 2026
commit 02698e0ce9b79c07d2b00a54e949b90705d3f80d
27 changes: 25 additions & 2 deletions dm/gfx/nvn/nvn_mtl.m
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,9 @@ void mtl_prepare(void) {
if (!g_warm_started && prepare_on()) { mtl_init(); shmap_load(); }
}
static void sub_cut_begin(void); static void ts_sub_begin(void), ts_boundary(void); static int ts_on(void);
static void pass_split_try(void);
static uint64_t g_setrt_n; // render target changes so far (pass_split_try: splits per NVN pass)
static int g_split_resume; // the pass was split at this draw: it opens again where the dispatch scan already looked (cs_hoist_try)
void mtl_sub_begin(void) {
mtl_init(); g_sub_serial++; g_seg = 0; seg_clk_put(g_sclk); g_sclk = NULL; g_rc_npend = 0; g_rc_skip = 0;
sub_cut_begin();
Expand Down Expand Up @@ -11413,6 +11416,7 @@ static void draw_(const p_draw *dw, const p_draw_idx *di) {
}
if (!g_geo_mesh.on) geo_mesh_flush_draw(); // another draw (a geometry draw decides in geo_mesh_draw): a waiting run of mesh draws goes first
if (g_enc && g_enc_geo_nocolor != g_geo_omit_colors) rp_end();
if (g_enc && !g_geo_program && !g_geo_mesh.on) pass_split_try();
int mdx_on = (dw && dw->mdi_cnt) || (di && di->mdi_cnt) ? mdx_wanted(dw, di) : 0; // an indirect-count multi-draw's record masked on the GPU (mdx_run), else read after a wait
if (!mdx_on && ((di && di->mdi_cnt && !mdi_live(di->mdi_cnt, di->mdi_i)) || (dw && dw->mdi_cnt && !mdi_live(dw->mdi_cnt, dw->mdi_i)))) return; // past the multi-draw's count
if (mdx_on && mdx_next(dw, di)) return; // the next draw of a masked multi-draw: only the draw is encoded
Expand Down Expand Up @@ -11487,7 +11491,8 @@ static void draw_(const p_draw *dw, const p_draw_idx *di) {
// The deferral decision comes after hoist_try: hoisted pure-clear render passes are skipped in the lookahead, and only then can P's same-target continuation segment be recognized
if (!g_enc && tbdr_on() && !g_geo_program && !defer_has_in_p() && !g_defer_replaying && !g_fz.active && !g_fz_checking && g_exec_next) { defer_try(dw, di); if (g_defer_cur->active && g_defer_cur->in_p) return; }
if (!g_enc && tbdr_on() && !g_fz_checking && !g_geo_program) fuse_try(); // Readable tile render pass merge is on by default; when the structure / same-pixel proof does not hold it still falls back to a normal render pass, and it is not re-entered during the CHECK redraw
if (!g_enc && !tbdr_on() && !g_geo_program && cshoist_on()) cs_hoist_try(pr, dw, di); // see DM_NVN_CS_HOIST
if (!g_enc && !tbdr_on() && !g_geo_program && cshoist_on() && !g_split_resume) cs_hoist_try(pr, dw, di); // see DM_NVN_CS_HOIST
g_split_resume = 0;
int need = g_enc || !tbdr_on() ? 3 : pass_ds_need(), mode = defer_q_draw ? 0 : need == 0 ? 2 : need == 2 ? 3 : need == 1 ? 4 : 0; // 2 attach neither, 3 attach stencil only, 4 attach depth only
int skip_d = mode != 0;
if (!g_enc) { g_fd_dw = dw; g_fd_di = di; }
Expand Down Expand Up @@ -12595,6 +12600,24 @@ static void sub_cut(void) {
g_cut_draw0 = g_stat_draw;
if (!g_cuts++) MLOG("segmented submission: first segment submitted at frame %llu pass %llu", (unsigned long long)f, (unsigned long long)g_stat_pass);
}
// A long render pass is one segment: Breath of the Wild draws 2,700 of its 4,100 draws a frame into the G-buffer, and the GPU, done with the shadow passes before it,
// waited for the whole pass to be translated (about 2.5 ms of the 9 ms frame at 120 fps on the Mac). With no segment left on the GPU and DM_NVN_PASS_SPLIT draws (default 256,
// 0 = off) encoded since the last cut, the pass is ended (its attachments stored), the segment committed, and the next draw opens the pass again, loading them. Each split
// costs a store and a load of the attachments, so it is taken only while the GPU would otherwise wait
static uint64_t g_pass_splits, g_split_pass; static int g_split_n; // g_split_n: splits of the pass g_split_pass so far
static int pass_split_draws(void) { static int v = -1; if (v < 0) { const char *e = getenv("DM_NVN_PASS_SPLIT"); v = e ? atoi(e) : 256; } return v; }
static int pass_split_max(void) { static int v = -1; if (v < 0) { const char *e = getenv("DM_NVN_PASS_SPLIT_MAX"); v = e ? atoi(e) : 2; } return v; } // per NVN pass: each split stores and loads its attachments
static void pass_split_try(void) {
int n = pass_split_draws();
if (n <= 0 || !g_enc || !g_cb || g_stat_draw - g_cut_draw0 < (uint64_t)n || atomic_load_explicit(&g_seg_inflight, memory_order_relaxed)) return;
if (g_rt_merged || g_rt_range_active || g_rt_range_pending || g_sm_pass || g_hoist_n || g_defer_nact || g_defer_pend || g_fz.active || g_defer_replaying || g_lp.count) return;
if (g_split_pass != g_setrt_n) { g_split_pass = g_setrt_n; g_split_n = 0; }
if (pass_split_max() > 0 && g_split_n >= pass_split_max()) return;
g_split_n++;
rp_end(); sub_cut(); g_split_resume = 1;
if (!g_pass_splits++) MLOG("pass split: a long render pass was ended and its segment committed while the GPU had nothing to do (DM_NVN_PASS_SPLIT=%d, frame %llu pass %llu)", n, (unsigned long long)atomic_load(&g_cur_frame), g_stat_pass);
}
uint64_t mtl_pass_splits(void) { return g_pass_splits; }
uint64_t mtl_cut_count(void) { return g_cuts; }
uint64_t mtl_copy_cut_count(void) { return g_copy_cuts; }

Expand Down Expand Up @@ -12810,7 +12833,7 @@ void mtl_exec(const uint8_t *p) {
PD("Y update_ub cmd=%p src=%#llx dst=%#llx bytes=%llu f=%g,%g,%g,%g", p, (unsigned long long)((const uint8_t *)a + 16), (unsigned long long)d, (unsigned long long)n,
n >= 4 ? ((const float *)((const uint8_t *)a + 16))[0] : 0.f, n >= 8 ? ((const float *)((const uint8_t *)a + 16))[1] : 0.f, n >= 12 ? ((const float *)((const uint8_t *)a + 16))[2] : 0.f, n >= 16 ? ((const float *)((const uint8_t *)a + 16))[3] : 0.f); mtl_sub_update((const uint8_t *)a + 16, d, n); break; }
case OP_SET_RT: {
const p_set_rt *r = a;
const p_set_rt *r = a; g_setrt_n++;
if (defer_begin_q(p)) break;
int pend = R.clear_d || R.clear_s; for (int i = 0; i < 8; i++) pend |= R.clear_c[i];
if (g_enc && !pend && R.has_rt && tbdr_on() && rt_range_same(&R.rt,r)) {
Expand Down
2 changes: 2 additions & 0 deletions docs/env_switches.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ DM_NVN_PASSDUMP diagnostic `=<f>`, `<f1>-<f2>` or `every:<n>`: logs every render
DM_NVN_PASSDUMP_ALL diagnostic `=1` makes `DM_NVN_PASSDUMP` record every draw and binding change, not only the first per pass and stage, including copies and inline uniform updates
DM_NVN_PASSGPU diagnostic `=<file>` writes the GPU time of each render and compute pass from stage-boundary timestamp counters (off under Metal 4); also gives each dispatch its own encoder
DM_NVN_PASSGPU_SERIAL diagnostic `=1` makes each encoder on the main command buffer wait until all earlier work has finished, so `DM_NVN_PASSGPU` times read each pass's exclusive time (totals read high)
DM_NVN_PASS_SPLIT switch `=<draws>` (default 256, `0` off): a render pass is ended and its segment committed after this many draws while the GPU has no segment left, so the GPU starts a long pass (a G-buffer) before it is all translated; its attachments are stored and loaded again
DM_NVN_PASS_SPLIT_MAX switch `=<n>` (default 2, `0` no limit): the most splits of one render pass (`DM_NVN_PASS_SPLIT`), as each stores and loads its attachments
DM_NVN_POOL_CHUNKS switch `0` wraps a memory pool of 512 MB or more whole in one buffer, as before; by default it is wrapped in overlapping 16 MB chunks made as draws reach them, so only the parts in use are wired
DM_NVN_PREDICT switch `0` turns off the parallel precompile look-ahead: a pipeline miss compiles only the pipeline it needs
DM_NVN_PREFETCH switch `0` turns off loading a program's shader libraries in the background when the game makes it (`nvnProgramSetShaders`); they load at its first draw instead
Expand Down