Fix [fence 18446744073709551615 did not reach 348999] -> CopyTextureRegion subresource indices for partially resident mip chains #4126
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4126"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by Vlosokjia on 2026-11-30T16:24:57Z.
On v2026.11.30.01,v2026.11.30.02, v2026.11.30.03.I replayed the mission that had repeatedly failed with
0x80070057and got past the crash with this patch. The original command-list close failure is recorded in #4047.Change
If a host texture begins at guest mip 3, guest mip 3 is host mip 0. The direct
CopyTextureRegionpath still used the guest index, which could select a smaller mip or one outside the allocation. Resolve both endpoints independently throughresource::host_target, including the source used to calculate readback footprints. Compare the resolved indices for self-copies. When the primary destination lacks a mip, a placed twin that holds it can still receive the copy.This extends the placed-twin handling from
523485ba. The related report #3849 shows the same HRESULT with partial mip chains in use, though its release log does not identify the failing command. The cross-format BC copy reported in #2914 is a separate failure.Verification
a_copy_into_a_held_copy_takes_its_own_leveltest passed in isolation.card_passcalls inhost.rsthat omit the sixth argument.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Vlosokjia on 2026-11-30T18:39:12Z.
@trustno1-coder that fixes issue that is there since 3 versions
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-12-01T02:48:40Z.
crate::texture::card_writes(list, dst.resource, to, Some(dst.footprint.offset as u32))atlist.rs:1825passes the title-absolute subresource offset, not thedst_subresolved two lines above byhost_target()for exactly this case (a host allocation starting at a later title mip).card_writesforwards it straight intoTiledLevels::with_level, which expects a level relative to the host texture's own mip count and returns 0 oncelevel >= self.levels— so for a partially-resident mip chain, the on-demand-tile zeroing step silently no-ops for the level actually being written. The fence crash this PR fixes is fixed, but the destination level can now land the title's copy over un-zeroed tile memory instead of the zeroed backing the old (non-partial-residency) path relied on. SuggestSome(dst_sub)in place ofSome(dst.footprint.offset as u32)there.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Vlosokjia on 2026-12-01T05:38:13Z.
@shurhundo
Thanks for checking this. You’re right that card_writes gets the original subresource index. It only reaches with_level for on-demand tiled textures, which always start at mip 0 and keep the original index. For a host texture starting at a later mip, card_writes returns before reaching with_level. That’s why I’m keeping the call as is in this PR.
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.