GPU: revalidate depth state after a colour twin transition #3041
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3041"
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 ghptc on 2026-11-29T19:43:32Z.
What it changes
A graphics draw can keep the same DSV bound while an intervening command changes that texture's list state. For a single-plane depth texture, a shader can write the colour twin and the next depth draw can copy it back, leaving the texture in
COPY_DEST. An intervening read of the depth resource as an SRV can leave it in shader-resource state. The draw's cached state previously contained only the desired DSV state. It could skip the transition back even when the command list recorded a different actual state.Include the command-list epoch in the cached key when the DSV has a colour twin. Read the epoch after
twin_useand remember it afterensure_state. Consecutive draws in the same state and epoch still use the cache. The existing cache remains in use for resources without a twin. A transition on another resource can advance the list epoch and cause an additional tracker lookup.#1541 publishes dirty depth planes after the writer and replays bindings for that path. #2770 changes which draws mark depth/stencil written. This patch preserves main's existing write classification and can be applied independently of #2770. If both changes land, keep #2770's write predicate as the third argument and retain
twin_use's returned flag for the epoch key.Validation
An offline Rust control extracted the state and twin logic from
f889bb076fa884fff8d2b6f0b50ac86f72abfd98and this port. It modeled the command list and replaced graphics calls with CPU state checks.COPY_DEST(0x400) instead ofDEPTH_WRITE(0x10). The candidate restored0x10.0xc0). The candidate restored0x10.This control covers the state logic of a single-plane depth resource. The full Windows runtime, GPU and visual output are outside its scope. The invalid baseline sequence was evaluated in CPU state only.
Adapted from
8fa7b9799b0bf99eb558e50f8b3394c34f6f78e2, with the original authorship retained.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-12-01T14:42:47Z.
I applied
72cfdb94on top of current main5fabb46e. It applies cleanly, butcargo check --locked -p victory-gpu --all-targetsfails with E0308 in the newerClearStatepath.last_depth_stateis now(u32, u64), and that reset still assigns0.Locally, the same check passes after resetting it to
(0, 0)and updating the existing ClearState test to seed(0x10, 7)and expect(0, 0). The nonzero epoch also checks that the reset clears both fields. No title was used.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.