Skip to content

Engine: Ocarina of Time's movie at full speed, and the Mac game keeps running out of focus - #911

Merged
v0lumehi merged 3 commits into
mainfrom
fix/oot-ndve-movie
Nov 7, 2026
Merged

v0lumehi merged 3 commits into
mainfrom
fix/oot-ndve-movie

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Ocarina of Time (0400486024DEC000) runs its title movie at 30 fps with the audio drifting behind the picture. After the opening it freezes when another app takes the key window.

What changes

Four engine patches on f25fa956:

  • 0092, 0093: Scale decoded NDVE movies on Metal and skip matched reconstruction seedds/nxnative#1331 by @givethesourceplox and @seedds. The decoded 1920x1080 movie frame is scaled into the 2560x1440 output with one bilinear Metal draw. The 13 NDVE reconstruction dispatches are skipped. The PR is based on a newer upstream. 0093 is adapted to the pin: mtl_pool_gpu_written(pool) became mtl_tex_gpu_written(tex) in upstream e2b76d4e.
  • 0094: the direct scaling is on by default. DM_NVN_NDVE_MOVIE_DIRECT=0 turns it off. It matches only Ocarina's two NDVE shader keys and the known dispatch sequence, so other games keep their path.
  • 0095: DM_FOCUS_KEEP is on by default on the Mac. Tears of the Kingdom and Ocarina of Time stop presenting and go silent out of focus. Clicking into another app froze the game until its window was clicked again. DM_FOCUS_KEEP=0 restores the old behavior. Minimizing still pauses the game.

Why

On an M2 Max the log shows 32.7 ms of GPU time per frame for the movie with 2 to 3 draws per frame (seedds/nxnative#1375). The freeze came right after oe focus state → 2 with no frame and no sound after it.

Checked

  • tools/engine.py check: 62 patches apply cleanly to f25fa956.
  • make GAME=0400486024DEC000 check_t_ndve_movie with Metal validation on an M2 Max: passes. Before the adaptation it did not compile.
  • dm/tools/env_switches.py --check, test_docs.py, test_env_switches.py: pass.
  • Both NDVE shader keys (49dff010b9832251, 4f41ccf24f163e0d) are in the shader_map.tsv of an nxb-built Ocarina app.

Not checked: a game run with these patches. Only the host changes, so a rebuild recompiles dmhost and reuses the shaders and the pipeline archive.

… running out of focus

Four patches on f25fa956:
- 0092, 0093: seedds/nxnative#1331, the direct NDVE movie scaling, adapted
  to the pin (mtl_tex_gpu_written).
- 0094: the direct scaling is on by default. DM_NVN_NDVE_MOVIE_DIRECT=0
  turns it off.
- 0095: DM_FOCUS_KEEP is on by default, so clicking into another app no
  longer freezes Tears of the Kingdom or Ocarina of Time.
@github-actions github-actions Bot added the patch-queue Changes the patch queue or the upstream pin label Nov 7, 2026
@thehobbit85 thehobbit85 added this to the v1.3.1 milestone Nov 7, 2026
@thehobbit85

Copy link
Copy Markdown
Contributor

Reviewed f2138775ffcf0f4a2f95e64e121a30294511d950. The 62-patch application check, NDVE Metal test under validation on an M2 Max, 14 docs/environment tests and environment-switch check pass. I found no important code defect in this review. The sequence/shader checks confine the direct NDVE path, and the focus change keeps input release and minimize handling.

Two merge requirements remain:

  • The PR explicitly has no patched game run yet. Please attach the engine’s required scripts/regress.py check --games ... report with baseline/candidate, games and cohort rationale. It needs to exercise Ocarina’s movie, picture/audio timing, and the changed focus/minimize/restore behavior. The focus default reaches other Mac games, so include representative affected-game coverage or explain a narrower cohort. Synthetic NDVE checks alone do not establish these runtime outcomes. See the engine’s AGENTS.md and docs/agents/06-dev-loop.md.
  • Patch 0095 changes the Mac-wide focus default as a fork product choice. That portion falls under the maintainer-feature 48-hour window, ending November 9 at 16:35:52 UTC (08:35:52 PST). CI must also finish green.

One documentation correction: patch 0094’s added rendering paragraph says both “on by default” and “is off by default.” Please make that sentence match the new default. Assigned to v1.3.1. Patch numbers will be reconciled at merge time once the remaining requirements are met.

@v0lumehi v0lumehi mentioned this pull request Nov 7, 2026
1 task done
The rendering paragraph that patch 0094 adds said the switch is on by
default and later said it is off by default. The code turns it on unless
DM_NVN_NDVE_MOVIE_DIRECT=0, so the second statement now says on by default.
@v0lumehi

v0lumehi commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

Fixed the sentence in patch 0094 in 9702c51. It now says the option is on by default, which matches the code (DM_NVN_NDVE_MOVIE_DIRECT=0 turns it off).

I tested the patched build by hand on my Mac with Ocarina of Time. The title movie takes the direct path in every run. The log shows NDVE movie: scaling the decoded RGBA frame directly from 1920x1080 to 2560x1440 and skipped 12 reconstruction dispatches. Picture and audio stay in sync to the end of the movie.

I did not run scripts/regress.py check. It would not cover this PR. Ocarina has no smoke.tsv, so the harness runs only the chain checks for it. regress.py also sets DM_FOCUS_KEEP=1 for every run, so it cannot see the focus change in 0095.

@v0lumehi
v0lumehi merged commit 9c1eddc into main Nov 7, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch-queue Changes the patch queue or the upstream pin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants