D3D12.X: count CPU-backed title textures as they come and go #3576
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3576"
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 ivall/xcl. Originally posted by raylitebull on 2026-12-01T14:44:27Z.
update_lengthsruns under theTEXTURESlock on every placement, release, retirement and uncover, and counted the CPU-backed entries by walking all ofby_res. A retail title keeps tens of thousands of entries there (55k+ onamd-dev). NowTablekeeps the count up to date whereverby_reschanges.What is in it
title_textures.rs:Table::cpu_backed_count, maintained byinsert_active/remove_active(allby_resinserts and removals inTablego through them);update_lengthsstores it.update_lengthschecks the count against a full count, so a laterby_reschange that bypasses the helpers fails in tests instead of dropping uploads.the_cpu_backed_count_follows_the_active_textures.Tested
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu: no errors, no new warnings.x86_64-pc-windows-gnuand run under Wine 9.0 (no GPU) with--test-threads=4, next to the same filters onmainb2b1f109:hle::d3d12x::title_textures: 65 passed, 1 failed, 1 ignored (main: 64 / 1 / 1)The failures are the same tests on both, ones that need a D3D12 device or Windows' working-set queries, which Wine lacks.
Regression run
Not run yet: there was no Windows machine or title here.
scripts/smoke.ps1still has to run on a title, built frommainand from this head, soPR checksfails until those two blocks are added.Not tested
cargo test --workspace -- --test-threads=4) on Windows, with or without a GPU; CI's no-GPU job is the first Windows run.main, and any performance onmain: the numbers above are fromamd-dev.amd-devit is part of4d6d4a77, whose numbers cover all of its lock changes together.AI use
amd-devcommit4d6d4a77tomain, split it into this PR and five others, and wrote the test, the commit message and this description. Theamd-devmeasurements are raylitebull's own runs.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T14:50:08Z.
Review (head
013d8e3d, diff read, not a merge-check; draft):cpu_backedis set only when anEntryis created (title_textures.rs~589, ~674, ~4835, ~4960), and every non-testby_resinsert and remove goes throughinsert_active/remove_activeunderTEXTURES, so it can't drift or underflow now. Its one reader,refresh_parts(~1952), skips uploads when the count is 0 and the device has no sparse support. A future insert that bypasses the helpers would make it read 0 and drop uploads silently. Adebug_assert_eq!against a full count inupdate_lengths(~539) would catch that in tests.amd-dev4d6d4a77, which bundles six lock changes; a measurement of this change alone (placements / releases per second, or frame time on a title that streams textures) would show what it buys.Fine: shadowing and uncovering keep the count (an entry is in
by_resorshadowed, never both), and the default path only loses a full scan per placement and release. #3426 editsTable::removeand will conflict textually.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T14:59:01Z.
Follow-up (head
d2752076; the one-line diff from013d8e3dread). Thedebug_assert_eq!against a full count of CPU-backed textures is inupdate_lengths, so a futureby_reschange that bypassesinsert_active/remove_activefails in debug builds and tests instead of silently dropping uploads. That was my only code point; the gain on main is still unmeasured.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by capy-ai[bot] on 2026-12-01T15:06:16Z.
@Foniass thanks, the debug check is in (
d2752076), as you confirmed. A measurement onmainwill come with the smoke runs.AI use: written by Capy (Claude Opus 5.5) and posted on raylitebull's behalf, with their go-ahead.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T15:23:44Z.
Test report (not a merge-check: draft,
PR descriptionred)base:
b2b1f109d2head:
d275207689merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3576#issuecomment-7315145925, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run. A bookkeeping change whose cost a 60 s run capped at 60 presents per second can't show.
assessment: merges, builds and passes the whole suite on current main, including the new count check in the debug-build tests; still open: a measurement of the gain on main
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.