fix: placed views of one texture share a shape whatever their padding words hold, and ownerless view entries are capped #382

Closed
github-bot wants to merge 2 commits from github-bot/gh-382 into main AGit
Owner

@⁠Skyfrye on GitHub · 2026-11-26 14:22 UTC · original
Skyfrye:nep/placed-view-shapes → main · +454 −11 · 4 files · 2 commits · closed without merging

Change

The title leaves some words of a placed view's two descriptions unwritten:

  • words 1 and 13 of the resource description, its padding;
  • of the view description, the padding after the component mapping and the tail of the union that the view's dimension does not use.

A placed view is named in its record by its shape (both descriptions without the address). So one view of one texture made a new shape each time it was written. The 4,194,304 shapes fill in about half an hour of play, and after that every placed view becomes a view-table entry that nothing frees.

TaynanGT/Vice-Tay found and fixed this (its PR #27). It measured 34.9 million such entries and 16.7 GB at 70 minutes. With the fix:

  • private memory went from 39-52 GB to 27 GB;
  • card memory went from 18.4 to 12.5 GB;
  • a long run went from 12.9 to 20.5 fps.

Our descriptor.rs has the same code (SHAPES, shape_of, Views::shape, Views::entry).

What this PR does:

  • placed_resource_words zeroes words 1 and 13 of the resource description.
  • placed_view_words zeroes the view words the view's dimension does not use, from the D3D12 SRV and UAV layouts. Three things are always kept: an unknown dimension (whole), a view of a buffer that names a texture dimension (whole, since the host reads the buffer member of those), and words 10 to 15 (the address and the console's words).
  • Entries no resource owns (constant buffer views, and placed views that do not fit a record) are capped. Views::ownerless keeps them oldest first. Past VICTORY_OWNERLESS_VIEWS (default 1,048,576; 0 keeps all), the oldest is freed under a new generation, so records naming it read stale, and the heap pass is told, as for a released resource.
  • The ram line shows the view table: entries, free ones, ownerless ones and the cap, how many were freed under it, and the shapes of placed views out of 4,194,304.

VICTORY_PLACED_FILLER=1 (until now the texture key only) keeps the filler of both descriptions as the title left it, as before. With VICTORY_VIEW_INLINE=0 the cap defaults to 0 (all kept): in that mode every constant buffer view is such an entry, and that switch is there to give the old behaviour.

Linked issue: none.

Verification

Windows 11 26300, Rust 1.98.1 (MSVC), on upstream main at b5a9d10 (no file of this PR changed up to 369bfa4), from third_party/victory:

cargo build --locked --release -p victory                                           -> Finished; the 2 warnings main has, no new one
VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib descriptor            -> 31 passed, 1 failed (28 passed, 1 failed on main)

The failure is spans_say_the_next_start_and_the_lowest_level_viewed, which fails the same way on main.

New tests:

  • placed_view_words_follow_the_d3d12_layout: checks the per-dimension tables against the windows crate's D3D12 structs (offset_of! and the last field's size).
  • placed_views_of_one_texture_share_a_shape_whatever_their_filler: covers every SRV dimension 0-12 and UAV dimension 0-9, and flips every view word but the address. A padding word changes nothing (one shape); a used word makes another shape. For the resource description, words 1 and 13 give one shape and every other word two.
  • ownerless_entries_are_capped.

The shape test fails without the change, at its first check. One existing test, views_at_new_addresses_add_no_entries, had non-zero filler words in its resource description; they are now 0.

In the world, my copy of the game: one run of 600 s with screen captures every 15 s, Series X, VICTORY_INDIRECT_RAW=3. This PR was stacked with #354 (VICTORY_TEXTURE_AUTO_MIP_CLAMP=auto), #381, VICTORY_STAGE_POOL_MB=2048, and the open #278, #279, #291, #292, #307 and #360-#362, on main at 8ed1109.

  • The view table held 9,211 entries, 1 of them ownerless, and 37,617 shapes out of 4,194,304 after 10 minutes.
  • The picture was right (cutscene, cell, corridor), with no exception and no device lost.
  • The run was too short to see the 30-minute fill on main; the figures for that are Vice-Tay's.

Oracle and test data

No game file. The counts come from my own run of my copy of the game.

Checklist

  • The PR covers a single reviewable behaviour: one placed view of one texture has one shape whatever its filler, and entries no resource owns are capped.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (Nothing unimplemented here.)
  • README: not touched. THIRD_PARTY.md: a row for Vice-Tay.
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: which description words it leaves unwritten, and table counts; no title code.
  • Code taken from another project: TaynanGT/Vice-Tay PR #27 (f07e54a2, ce914907, d3626d25), after JMAN730/project-flamingo b1e0cd1d and avatarmanz PR #206, GPL-3.0; credited in the commit and THIRD_PARTY.md.

AI assistance:

  • A Claude Opus 5.5 subagent in Claude Code ported the change from Vice-Tay and wrote the tests, after a Claude Opus 5.5 survey of the other ports found it.
  • Claude Opus 5.5 (coordinating) ran the game and wrote this description.

🤖 Generated with Claude Code

**@⁠Skyfrye** on GitHub · 2026-11-26 14:22 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/382) `Skyfrye:nep/placed-view-shapes` → `main` · +454 −11 · 4 files · 2 commits · closed without merging ## Change The title leaves some words of a placed view's two descriptions unwritten: - words 1 and 13 of the resource description, its padding; - of the view description, the padding after the component mapping and the tail of the union that the view's dimension does not use. A placed view is named in its record by its shape (both descriptions without the address). So one view of one texture made a new shape each time it was written. The 4,194,304 shapes fill in about half an hour of play, and after that every placed view becomes a view-table entry that nothing frees. TaynanGT/Vice-Tay found and fixed this (its PR #27). It measured 34.9 million such entries and 16.7 GB at 70 minutes. With the fix: - private memory went from 39-52 GB to 27 GB; - card memory went from 18.4 to 12.5 GB; - a long run went from 12.9 to 20.5 fps. Our `descriptor.rs` has the same code (`SHAPES`, `shape_of`, `Views::shape`, `Views::entry`). What this PR does: - `placed_resource_words` zeroes words 1 and 13 of the resource description. - `placed_view_words` zeroes the view words the view's dimension does not use, from the D3D12 SRV and UAV layouts. Three things are always kept: an unknown dimension (whole), a view of a buffer that names a texture dimension (whole, since the host reads the buffer member of those), and words 10 to 15 (the address and the console's words). - Entries no resource owns (constant buffer views, and placed views that do not fit a record) are capped. `Views::ownerless` keeps them oldest first. Past `VICTORY_OWNERLESS_VIEWS` (default 1,048,576; 0 keeps all), the oldest is freed under a new generation, so records naming it read stale, and the heap pass is told, as for a released resource. - The ram line shows the view table: entries, free ones, ownerless ones and the cap, how many were freed under it, and the shapes of placed views out of 4,194,304. `VICTORY_PLACED_FILLER=1` (until now the texture key only) keeps the filler of both descriptions as the title left it, as before. With `VICTORY_VIEW_INLINE=0` the cap defaults to 0 (all kept): in that mode every constant buffer view is such an entry, and that switch is there to give the old behaviour. Linked issue: none. ## Verification Windows 11 26300, Rust 1.98.1 (MSVC), on upstream `main` at `b5a9d10` (no file of this PR changed up to `369bfa4`), from `third_party/victory`: ``` cargo build --locked --release -p victory -> Finished; the 2 warnings main has, no new one VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib descriptor -> 31 passed, 1 failed (28 passed, 1 failed on main) ``` The failure is `spans_say_the_next_start_and_the_lowest_level_viewed`, which fails the same way on `main`. New tests: - `placed_view_words_follow_the_d3d12_layout`: checks the per-dimension tables against the `windows` crate's D3D12 structs (`offset_of!` and the last field's size). - `placed_views_of_one_texture_share_a_shape_whatever_their_filler`: covers every SRV dimension 0-12 and UAV dimension 0-9, and flips every view word but the address. A padding word changes nothing (one shape); a used word makes another shape. For the resource description, words 1 and 13 give one shape and every other word two. - `ownerless_entries_are_capped`. The shape test fails without the change, at its first check. One existing test, `views_at_new_addresses_add_no_entries`, had non-zero filler words in its resource description; they are now 0. In the world, my copy of the game: one run of 600 s with screen captures every 15 s, Series X, `VICTORY_INDIRECT_RAW=3`. This PR was stacked with #354 (`VICTORY_TEXTURE_AUTO_MIP_CLAMP=auto`), #381, `VICTORY_STAGE_POOL_MB=2048`, and the open #278, #279, #291, #292, #307 and #360-#362, on `main` at `8ed1109`. - The view table held 9,211 entries, 1 of them ownerless, and 37,617 shapes out of 4,194,304 after 10 minutes. - The picture was right (cutscene, cell, corridor), with no exception and no device lost. - The run was too short to see the 30-minute fill on `main`; the figures for that are Vice-Tay's. ## Oracle and test data No game file. The counts come from my own run of my copy of the game. ## Checklist - [x] The PR covers a single reviewable behaviour: one placed view of one texture has one shape whatever its filler, and entries no resource owns are capped. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (Nothing unimplemented here.) - [x] README: not touched. THIRD_PARTY.md: a row for Vice-Tay. - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: which description words it leaves unwritten, and table counts; no title code. - [x] Code taken from another project: TaynanGT/Vice-Tay PR #27 (`f07e54a2`, `ce914907`, `d3626d25`), after JMAN730/project-flamingo `b1e0cd1d` and avatarmanz PR #206, GPL-3.0; credited in the commit and THIRD_PARTY.md. AI assistance: - A Claude Opus 5.5 subagent in Claude Code ported the change from Vice-Tay and wrote the tests, after a Claude Opus 5.5 survey of the other ports found it. - Claude Opus 5.5 (coordinating) ran the game and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title leaves words of a placed view's two descriptions unwritten
(device methods 0x230 and 0x238): words 1 and 13 of the resource
description (its padding), and of the view description the padding after
the component mapping and the tail of the union that the view's dimension
does not use. A placed view is named in its record by its shape (both
descriptions without the address), so one view of one texture made a new
shape each time it was written. The 4,194,304 shapes fill in about half an
hour of play; after that every placed view becomes a view table entry
that nothing frees. TaynanGT/Vice-Tay measured 34.9 million such entries
and 16.7 GB at 70 minutes; with the fix, private memory 39-52 GB down to
27 GB, card memory 18.4 down to 12.5 GB, and 12.9 to 20.5 fps over a long
run.

- placed_resource_words zeroes words 1 and 13 of the resource description.
- placed_view_words zeroes the words of the view description that its
  dimension does not use, from the D3D12 SRV and UAV layouts
  (SRV_UNION_WORDS, UAV_UNION_WORDS, placed_view_used). An unknown
  dimension, and a view of a buffer that names a texture dimension (the
  host reads the buffer member of those), are kept whole; the address and
  the console's words (10 to 15) are always kept.
- Entries that no resource owns (constant buffer views and placed views
  that do not fit a record) are capped: Views::ownerless keeps them oldest
  first, and past VICTORY_OWNERLESS_VIEWS (default 1,048,576; 0 keeps all)
  the oldest is freed under a new generation, so records that name it read
  stale, and the heap pass is told, as for a released resource.
- The ram line shows the view table: entries and free ones, ownerless ones
  and the cap, how many were freed under it, and the shapes of placed
  views out of 4,194,304.

Switches: VICTORY_PLACED_FILLER=1 (until now the texture key only) keeps
the filler of both descriptions as the title left it, as before.
VICTORY_OWNERLESS_VIEWS=<n> sets the cap. With VICTORY_VIEW_INLINE=0 the
cap defaults to 0 (all kept): there every constant buffer view is such an
entry, and that switch is meant to give the old behaviour.

Tests: placed_view_words_follow_the_d3d12_layout checks the tables against
the windows crate's D3D12 structs;
placed_views_of_one_texture_share_a_shape_whatever_their_filler covers
every SRV and UAV dimension and every word (a padding word changes
nothing, a used word makes another shape); ownerless_entries_are_capped.

From TaynanGT/Vice-Tay PR #27 (f07e54a2, ce914907, d3626d25), after
JMAN730/project-flamingo b1e0cd1d and avatarmanz PR #206; ported by Claude
Opus 5.5 (subagent)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:23:03 +00:00
github-bot closed this pull request 2026-11-26 17:58:01 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.