Repository navigation
Reduce NVN command record memory for viewports and UBO binds - #1565
Closed
ishtiaq156 wants to merge 4 commits into
Closed
ishtiaq156 wants to merge 4 commits into
ishtiaq156 wants to merge 4 commits into
Conversation
ishtiaq156
marked this pull request as ready for review
November 6, 2026 20:28
This was referenced Nov 6, 2026
ishtiaq156
marked this pull request as draft
November 6, 2026 23:00
ishtiaq156
marked this pull request as ready for review
November 8, 2026 04:39
Contributor
Author
|
Closing as superseded for the Wonder Edition memory-budget use case. Upstream The optional pairing and draw mechanisms in this PR were not merged verbatim, so this is a scope cleanup rather than a claim that every individual change landed. The verified new allocations are documented in #1580. Thanks to upstream for the general solution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Reduce actual NVN command-record memory without changing game assets, shaders or
GetCommandMemoryUsedaccounting. Game engines use the measured command bytes both as direct offsets in recorded memory and to size resource heaps; avoidable record padding can exhaust those heaps.SetViewportsandSetViewportSwizzlesnow write only the supplied elements (instead of all 16), retaining original element strides and older capture compatibility.DM_NVN_UBO_PAIR=1writes two consecutive 24-byteOP_BIND_UBO_SMALLrecords as a single 40-byte op49 payload, saving eight real bytes while preserving both GPU addresses and their order. It never pairs across other commands, segment boundaries, memory-usage queries or insufficient room. The original single-record layout is the default. Replay, lookahead, relocation and capture accept both layouts.DM_NVN_DRAW_ONE=1records direct single-instanceDrawElements/DrawElementsBaseVertexin 32 bytes rather than 40, retaining primitive, index type, count, base vertex and full 64-bit index-buffer address. Replay restores the known instance count 1 and base instance 0. Instanced, indirect and multi-draw variants retain their original layout; capture relocation distinguishes the new payload by record size and accepts old captures. The 40-byte default is retained pending broader direct-command-patching compatibility evidence.Scope: #1580 remains a separate, unresolved NVN2 model-resource allocation issue. In Wonder Switch 2 Edition's NpcCommonerA, the new direct indexed draw layout reduces the exact model request
0x5424 → 0x5334(240 real bytes across 30 draws); it still crashes under the original resource table. Whole-frame texture and uniform pair savings similarly did not solve this model allocation. No RESTBL override, null-pool bypass, guessed native byte count or proprietary game resource is included here. This PR is an independently useful compaction, not a permanent Wonder model-memory fix.Checked
t_nvn260/260 andt_capture91/91 checks passed, covering actual command-byte accounting, the unchanged default, opt-in instance defaults, full instanced/indirect compatibility and relocation of both new and legacy indexed-draw formats.test_docs11/11 passed, andgit diff --checkpassed.pool 0x0, exit 139). No success is claimed for New Game or Continue without the separate temporary diagnostic overlay.Docs
docs/reference/nvn-objects.md.