Preserve untouched mips and slices during water texture readback #1152
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1152
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1152"
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?
@BradRoland on GitHub · 2026-11-25 21:46 UTC · original
BradRoland:codex/texture-readback-subresources→main· +51679 −150 · 16 files · 20 commits · openThe water texture readback added in #999 records a writable texture when a draw or dispatch binds it. It previously discarded the UAV description and copied every mip and array slice back into title memory. On a synthetic R32_FLOAT array, this overwrote an untouched slice with a value left on the host by an earlier command list.
This patch records the mip and slices each bound UAV exposes, takes their union per texture within the command list, and copies and tiles those subresources using their original indices. A default view covers mip zero across all slices. Explicit array views support the all-remaining-slices count. A non-array 2D view of an array covers slice zero. The existing allocation snapshot and fence handling are retained.
The WARP regression exercises the draw binding path with real D3D12 clears on a three-mip 2D texture and a four-slice array. It checks updated texels, untouched texels, and padding after binding default and overlapping views. The regression failed on
9c184b3and passed after the change, including with the debug layer enabled. The graphics crate passed all 202 enabled diagnostics tests (six ignored). An earlier run hit the existing intermittent failure in #1118, which passed on an unchanged rerun.On the original PR head
643f05a0, an independent Series X replay on an RTX 5070 Ti kept the boat afloat and showed a continuous water surface in the sampled view. The tester reported small dark reflection spots, a dark sun disk, and one unsupported-tiling warning. A matched baseline is pending. Tester’s gameplay reportWith
VICTORY_TEXTURE_BACK=1, the existingtexture readback landedline now reports cumulativebindings,restricted_bindings,copied_subresources, andskipped_subresources. A restricted binding exposes only part of a texture. Repeated bindings count individually. The two subresource counters count each mip and array slice once per texture per command list at the write-back stage. A nonzeroskipped_subresourcesdelta shows that narrowing bindings reduced the number of copies in the measured window. The counters exclude stale allocations and tiling failures and share the existingcopiedreporting cadence.The counter regression passed on WARP and an RTX 4080 with the D3D12 debug layer enabled. Three synthetic readbacks produced nine valid bindings, eight restricted bindings, fourteen copied subresources, and five skipped subresources. An invalidated fourth readback left every counter unchanged. The final diagnostics run passed 202 tests with six ignored.
@SkillIssueXO on GitHub · 2026-11-25 22:08 UTC · original
Independent Series X replay on an RTX 5070 Ti. I tested
643f05a0on9c184b35with local keyboard/mouse and fullscreen changes, the README run 253 settings, andVICTORY_TEXTURE_BACK=1. The focused WARP regression passed here.The boat stayed afloat in the chase, with a continuous water surface in the sampled view. I saw small dark reflection spots and the dark sun disk. The run logged over 39,000 landed texture readbacks and one unsupported-tiling warning.
One 30-second chase window had 253 consecutive logged present intervals, averaging 8.45 FPS at 125.0 ms median and 233.4 ms p95. A matched baseline and counts of restricted UAV bindings are still pending, so these timings describe this run.
AI-assisted testing. Source identifiers and aggregate measurements only.
@BradRoland on GitHub · 2026-11-25 22:31 UTC · original
Thanks for running the boat chase on the 5070 Ti. I added the missing binding counts in
78d66d4. For a matched chase interval, the difference between twotexture readback landedlines gives the counts for that window.restricted_bindingscounts each valid view that covers part of its texture.skipped_subresourcescounts the mip/slice copies avoided after combining overlapping views. A run can have restricted bindings and still copy every subresource. The new fields use the existingVICTORY_TEXTURE_BACK=1setting.I verified those distinctions with synthetic textures on WARP and an RTX 4080. The 8.45 FPS figure remains the single-run measurement from your report.
@BradRoland on GitHub · 2026-11-25 23:36 UTC · original · edited 2026-11-25 23:42 UTC
Run 280 logged
Unsupportedwhile tiling a texture at mip 0, slice 0. In the layout walker that result means the layout can be sized but has no address equation for placing its texels back in title memory. The old path discovered this after transitioning the texture, recording a GPU copy and reading it back. The log did not identify which layout triggered it. Run 280 warningI added
5757e1ato this PR. At list close the renderer now checks the layout before the state transition or readback allocation. The first occurrence logs the title format, dimensions, swizzle and selected subresource. Supported layouts keep the existing copy path.I reproduced the unnecessary work on WARP with a synthetic 8×8
R32_FLOATXOR layout. Before the change one readback was queued and the texture ended inCOPY_SOURCE. With the change, two successive lists each queued zero readbacks, left the texture in UAV state and preserved the original title-memory bytes. Exactly one warning identified format 41 and swizzle 21. The mip, slice and remap controls still passed. The game log does not establish that its texture had this particular swizzle or how often it was encountered. Patch and regressionI also ran the same regression through the D3D12 hardware path. DXGI identified the device for the test as NVIDIA GeForce RTX 4080. The mip, array, remap and unsupported-layout assertions all passed on that device.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.