Skip to content

Draw passes: no full consumer barrier after a fragment-only game barrier - #1572

Closed
Xipzer wants to merge 1 commit into
seedds:mainfrom
Xipzer:frag-barriers
Closed

Xipzer wants to merge 1 commit into
seedds:mainfrom
Xipzer:frag-barriers

Conversation

@Xipzer

@Xipzer Xipzer commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Draw passes no longer get the full consumer barrier after a game barrier that only orders fragments. Breath of the Wild now uses draw_barriers game.

With draw_barriers game (DM_NVN_BARRIER=game), any nvnCommandBufferBarrier gave the next draw pass the full consumer barrier (all stages before all stages).

NVN_BARRIER_ORDER_FRAGMENTS / ORDER_FRAGMENTS_TILED order only fragment work: the next rendering's vertex work may start early (vertex reads of earlier results need ORDER_PRIMITIVES). The last draw pass's relaxed end barrier (vertex and fragment stages before later fragment, dispatch and blit stages) already gives that order. So for barriers whose bits are only those two plus INVALIDATE_TEXTURE, the consumer barrier is left out, as when there was no barrier. Any other bit keeps the full barrier. DM_NVN_BARRIER_FRAG=0 restores the old behaviour.

Breath of the Wild issues about 150 barriers a frame with bits 0x12 (ORDER_FRAGMENTS | INVALIDATE_TEXTURE), 25 with 0x1, and a few 0x11 / 0x1b / 0xff / 0x20. Its profile now uses draw_barriers game: full pass-start barriers fall from about 150 to about 33 a frame (counter: 44370 full / 0 saved against about 9700 full / 35600 saved per window).

iPad Pro 13" M4 at a 120 fps target (GPU-bound), Deadline boost on, adjacent pairs (game / full):

  • 90.3 / 89.6 fps
  • 81.7 / 76.5 fps
  • 68.3 / 69.9 fps
  • 72.8 / 65.4 fps

The device warmed over the runs. Mac (M4 Max) screenshots at the same spot match. Graphics tests give the same results as main with and without DM_NVN_BARRIER=game (check_t_nvn and check_t_present_crop fail on main too).

For reference, upstream's own note for the mode: Ocarina of Time 25 to 18 ms GPU.

@Xipzer

Xipzer commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Note: I couldn't run scripts/regress.py check for this one. This Mac has Xcode 27.1 (Metal 32023.921), and the chain lock on main names 27.2's 32023.922, so the local games' shaders don't build against main's chain here. The change only affects games with draw_barriers game (Ocarina of Time and, with this PR, Breath of the Wild); others keep full barriers.

@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) docs Documentation game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild labels Nov 6, 2026
cfryerdev pushed a commit to cfryerdev/nxnative that referenced this pull request Nov 8, 2026
AmateurWizrd added a commit to AmateurWizrd/nxnative that referenced this pull request Nov 9, 2026
# Conflicts:
#	dm/gfx/nvn/nvn_mtl.m
#	docs/env_switches.tsv
With DM_NVN_BARRIER=game any game barrier gave the next draw pass the full
consumer barrier. A barrier that orders only fragments (ORDER_FRAGMENTS /
_TILED, INVALIDATE_TEXTURE) lets the next rendering's vertex work start early,
and the last pass's relaxed end already orders its fragments before later
fragment, compute and copy work, so the consumer barrier is left out.
DM_NVN_BARRIER_FRAG=0 restores it.

Breath of the Wild issues about 150 of these a frame (bits 0x12) and now uses
draw_barriers game: full pass-start barriers fall from about 150 to about 33 a
frame. iPad Pro 13" M4 at a 120 fps target, adjacent pairs (game / full):
90.3/89.6, 81.7/76.5, 68.3/69.9, 72.8/65.4 fps.
@Xipzer

Xipzer commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (04811a6); no changes besides conflict resolution (enc_r_begin_pass keeps main's command memory marks, DM_NVN_BARRIER_FRAG sits before DM_NVN_BC_ALIAS in the switch table).

Fasen24-AI added a commit to Fasen24-AI/swordboiMacNative that referenced this pull request Nov 10, 2026
…ment-only game barrier

Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR):
- seedds#1572 by Xipzer (open): Draw passes: no full consumer barrier after a fragment-only game barrier
@Xipzer

Xipzer commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Closing: superseded by e775054 (PR #2334). Main now keeps the game barrier's bits and skips the full consumer barrier unless they include ORDER_PRIMITIVES or ORDER_INDIRECT_DATA, which covers this PR's fragment-only case (Breath of the Wild's 0x12) and more.

Not on main from here: draw_barriers game in Breath of the Wild's profile. The iPad numbers above were measured on this PR's rule, and main's pass barriers differ now, so I'll measure that again on main before proposing the row.

@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 nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant