Formats: reserve texture metadata memory in XG layouts #263
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/263"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T01:53:40Z.
What
Render targets and depth buffers carry compression metadata (HTILE, CMASK,
DCC) on the console. The XG layout reported only the data planes, so a title
that sized a pool from it could run out of memory. This adds a conservative
metadata reservation after the data planes in the reported size and
alignment.
The exact metadata plane shapes depend on the GPU's pipe configuration and
their XG usage codes are not published. Rather than invent plane types that
a title might try to copy from, this reserves upper-bound memory (one eighth
of the data for depth, one sixteenth for color, rounded to 64 KiB) and leaves
the plane list and the host's data-plane layout unchanged. Sampled textures
get no reservation.
An AI tool wrote part of this change.
Tested
cargo test --workspacewith PR #112's Linux build fix applied locally (not part of this PR): 167 passed, 0 failed, 3 ignored. Three new tests cover sampled versus render targets, offset/overflow behaviour and the XG layout output.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. Windows-only tests were not run; there is no Windows host here.cargo xtask policypasses (150 files ok). No game files or data from them were added.Checklist
cargo fmton the changed hunks; workspace tests and Windows cross-check pass.cargo xtask policypasses. No game files or data from them were added.Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:01:40Z.
Tested the open PR at head
50d27a5a9237aaf00fee8090fc236e0358a90f2f(still current when refreshed before posting).cargo test --locked -p victory-formats metadata_— passedmetadata_reserves_room_only_for_render_targetsandmetadata_never_overlaps_or_overflows, covering sampled versus render-target reservations, 1D handling, alignment and overflow bounds in texture.rs.cargo test --locked -p victory-hle render_targets_reserve_metadata_memory— passedrender_targets_reserve_metadata_memory, exercising the XG layout response for color/depth size and alignment while checking data-plane count in xg.rs.These are synthetic unit tests; a real title or console GPU was not exercised.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T13:16:37Z.
Review: APPROVED
Tested
e5eaf4aon Windows 11, RTX 5070, MSVC:cargo test -p victory-formats -p victory-hle110 passed, includingmetadata_reserves_room_only_for_render_targets.samples > 1, or adding FMASK explicitly, would keep the bound true for MSAA targets.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:01:05Z.
Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed