GPU: fix CopyTextureRegion between mips of the same texture #3816
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3816
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3816"
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?
@senduora on GitHub · 2026-11-30 08:15 UTC · original
senduora:fix/same-resource-mip-copy→main· +140 −7 · 2 files · 1 commits · closed without mergingWhat it changes
When the source and destination name different subresources of the same native D3D12 texture, the whole-resource transition to
COPY_DESTalso changes the source mip.CopyTextureRegionrequires that source subresource to be inCOPY_SOURCE. D3D12 copy rulesKeep the existing whole-resource state tracking. Transition just the source subresource to
COPY_SOURCEfor the copy, then restore it toCOPY_DEST. If an additional placed twin needs the source, transition the texture back to the usual read state before copying to that twin. Copies between distinct native textures keep their existing path.How it was tested
mainat41adb55(v2026.11.29.05).cargo test --locked --release -p victory-gpu --lib list::tests -- --test-threads=1passed all 12 tests. The existing depth-twin copy test also passed separately.Checked for overlap
@tyr0nsur on GitHub · 2026-11-30 09:13 UTC · original
A placed twin can be the original copy source. On head
61d03c1, I reproduced three cases using two title views of the same backing. The whole-resource copy and the same-native-subresource region copy both try to mirror a resource back onto itself. The different-mip mirror changes the tracked state of the source toCOPY_DESTwhile it still needs to be read.Follow-up commit aedb634 skips the redundant mirrors before write tracking. It keeps the different-mip mirror, temporarily transitions just the native source subresource, and restores the source to a readable state before recording another mirror.
The regression checks source state before submission in all three cases and reads back the destination mip byte for byte from both views. The targeted
list::andresource::diagnostics suite passed on an RTX 4060 (66 passed, 1 ignored). Both mip-copy regressions also passed on WARP. The staged asset policy check passed.@Freeman022026 on GitHub · 2026-11-30 13:53 UTC · original
Tested on RTX 4090 24 GB (driver 621.14, Windows 11) on top of v2026.11.29.05 (
41adb551) alongside #3043 and #3792. The new GPU testcopy_region_between_mips_of_one_texturepasses, and an 81-minute gameplay run completed with 00x80070057crashes.In
copy_texture_region, checking onlysrc.footprint.offset as u32 == u32::MAX || dst.footprint.offset as u32 == u32::MAXstill lets any other out-of-range subresource index reachtransition_subresource(to, ..., src.footprint.offset as u32). Comparing both indices against the texture's actual subresource count fromto.GetDesc()(MipLevels * layers * planes, matchingsubresource_countin #3043) avoids emitting an invalid subresource barrier for out-of-range indices belowu32::MAXas well.@trustno1-coder on GitHub · 2026-12-01 18:48 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed