Skip to content

render scale: a per-game ceiling (render_scale_max) instead of a fixed 1.0 - #354

Closed
Xipzer wants to merge 2 commits into
seedds:mainfrom
Xipzer:render-scale-max
Closed

Xipzer wants to merge 2 commits into
seedds:mainfrom
Xipzer:render-scale-max

Conversation

@Xipzer

@Xipzer Xipzer commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

This is point 3 of @v0lumehi's review on #316, done the way he suggested, now that there is a measured number behind it.

The problem

The loader clamps DM_RENDER_SCALE to 0.5–1.0 for every game, so a build whose rewriter table has RENDER_SCALE can never render above the size the game picks itself, even where that holds. My earlier attempt simply raised the clamp to 2.0 with a warning, which was wrong: a slider that can crash a game is not a setting.

The fix

render_scale_max, a profile key, 1.0 by default. The loader refuses anything above it and names the key in the message; the iOS launcher's slider stops there. A range in settings.tsv may now take a bound from a DM_GAME_<NAME> macro, which is how the slider learns the ceiling.

Nothing changes for any game that does not set the key. The default gives the clamp and the slider exactly the range they have today.

Why the limit is per game

Above its own resolution a game renders into render target pools it sized for that resolution. The host cannot size those from outside, so a scene eventually needs more than a pool holds and the game takes a null allocation back. That point is a property of the game, not of the device.

Breath of the Wild 1.9.0 is 1.35, measured

gsys sub-allocates every render target from one 115 MB render buffer pool it sizes at start. With #303's DM_NVN_POOLPEAK on an iPad Pro 13" M4, docked, open world with the inventory and map opened:

Render scale Render buffer pool Result
1.40 112.8 MB of 115.0 MB (98.1%) plays
1.45 — SIGSEGV at main+0xed7128, address 0x20, while the field loads

That crash is gsys::RenderBufferContext taking a null back from a failed allocation, the same site @v0lumehi hit at 2560x1440 on an M2 Max. 1.40 is 2.2 MB from full, which is too close to ship, so the ceiling is the slider step below it.

For contrast, the other large pool in the same run was 256.0 MB of 500.0 MB with a 244 MB contiguous run free, so the pressure is specific to the render buffer pool.

Changes

  • dm/games/game.py: the key, validated 1.0 to 3.0, emitted as DM_GAME_RENDER_SCALE_MAX
  • dm/host/loader.c: the clamp takes the profile's ceiling
  • dm/games/settings.py: a range bound may be a DM_GAME_<NAME> macro
  • dm/games/settings.tsv: the render scale row uses it
  • dm/games/01007EF00011E000/game.tsv: render_scale_max 1.35, with the measurement in the comment
  • dm/games/README.md, docs/settings.md

Relationship to the other PRs

test_docs, test_env_switches, test_launcher_settings and test_profile_guess pass.

@Xipzer

Xipzer commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Second device, and it tightens the case for 1.35 rather than weakening it.

iPhone 17 Pro Max, Breath of the Wild 1.9.0, docked:

Render scale iPad Pro 13" M4 iPhone 17 Pro Max
1.35 plays plays
1.40 plays, 112.8 MB of 115.0 MB loads for a split second, then crashes
1.45 crashes —

So the M4 iPad survives 1.40 with 2.2 MB to spare and the iPhone does not survive it at all. The pool is the game's, not the device's, but what fits inside it is not identical across devices: the window the game composites into differs, and anything the host places in the same pool differs with it. 1.40 was never 2.2 MB of headroom, it was 2.2 MB on the most forgiving device we have.

That is the argument for the key rather than against it. A single number in the host would have to be the minimum across every device anyone runs, found by someone's game dying. A profile key with a measurement behind it can be the honest one, and 1.35 is now the last value verified on both devices rather than the last value verified on one.

No change to the diff; the profile comment will name both devices.

@Xipzer
Xipzer force-pushed the render-scale-max branch 3 times, most recently from e29ee72 to 22b116f Compare October 28, 2026 21:43
@Xipzer

Xipzer commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on current main (the meta column and the Mac rows). The Render scale row keeps level=basic and takes DM_GAME_RENDER_SCALE_MAX as its top; launcher_storage_check.swift's saved-range case now tests against the row's own maximum instead of a hard-coded 1.01. Launcher tests pass.

@Xipzer
Xipzer force-pushed the render-scale-max branch 2 times, most recently from 5ee9826 to 5fc263b Compare October 30, 2026 15:11
Xipz and others added 2 commits November 1, 2026 06:35
The clamp in the loader was 0.5 to 1.0 for every game, so a build whose rewriter
table has RENDER_SCALE could never render above the size the game picks itself,
even where it holds.

Above its own resolution a game renders into render target pools it sized for
that resolution, which the host cannot size from outside, so a scene eventually
needs more than a pool holds and the game takes a null allocation back. How far
that goes is per game and only measurement finds it, so the limit belongs in the
profile rather than in the host.

render_scale_max, 1.0 by default, is the highest DM_RENDER_SCALE the game
survives. The loader refuses anything above it and names the key in the message,
and the iOS launcher's slider stops there, because a slider that can crash a game
is not a setting. A range in settings.tsv may now take a bound from a
DM_GAME_<NAME> macro, which is how the slider learns the ceiling.

Breath of the Wild 1.9.0 is 1.35, measured rather than guessed. gsys
sub-allocates every render target from one 115 MB render buffer pool it sizes at
start. With seedds#303's DM_NVN_POOLPEAK on an iPad Pro 13" M4, docked, open world with
the inventory and map opened:

  render scale 1.40   112.8 MB of 115.0 MB used (98.1%), plays
  render scale 1.45   SIGSEGV at main+0xed7128 address 0x20 while the field
                      loads: gsys::RenderBufferContext takes a null back

1.40 is 2.2 MB from full, so the ceiling is the step below it.

No behaviour changes for any game that does not set the key: the default of 1.0
gives the clamp and the slider exactly the range they had.
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios) docs Documentation game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild labels Nov 3, 2026
@Xipzer

Xipzer commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Closing: main has a per-game ceiling by another route since b84ee29 (a render-scale stub states its largest scale, # RENDER_SCALE n, and the loader and the slider follow it), and rebasing this would put a second source for the same ceiling beside it.

What main still lacks from here: a fractional ceiling (it is a whole number), and Breath of the Wild above 100 % (its stub states 1; the measurements above put its pool's limit between 1.40 and 1.45 on an iPad Pro M4 and an iPhone 17 Pro Max). If that is wanted I'll send it as a small PR on the stub's mechanism.

@Xipzer Xipzer closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant