GPU: a readable texture does not share a host texture denied to shaders #2185
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2187"
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 Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T07:19:23Z.
Problem
A depth texture created with
D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCEkeeps that flag and its typed depth format (D32_FLOAT,D16_UNORM, ...) on the host.takesonly compared render target / depth / unordered uses (USES = 0x7) and the format family, so a later texture or placed view of the same memory (sameMemoryKey, which does not include0x8) that shaders read reused the denied host texture.fits()then refused its shader view, the slot became a null view, and shaders read zeros. Both title textures shared one host texture, soalias_source/texture::alias_copynever ran either.Changes
takesalso requiresserves_reads: a host texture made without shader access (denied, or a typed depth format) only serves descriptions that deny shader access too. A readable description gets a new host texture through the existing replacement path inshared_texture, and a placed view reads what the GPU wrote through the old one via the existingalias_source+texture::alias_copy.a_depth_texture_denied_to_shaders_reads_through_a_placed_view: clears aD32_FLOAT | DEPTH | DENY_SHADER_RESOURCEtexture to 0.75 and reads it back through a placedR32_FLOATview of the same memory in a compute shader. Tests that make alias copies now take a shared lock, since one of them countsALIAS_COPIES.Verification
VICTORY_D3D12_DEBUG=1(no debug layer messages).cargo test -p victory-gpu --lockedon hardware: only the two failures already on main (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views). WithVICTORY_D3D12_WARP=1anddiagnostics: allvictory-gputests pass.-D warnings(default anddiagnostics), rustfmt on the changed hunks, andcargo xtask policypass.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T07:24:27Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib a_depth_texture_denied_to_shaders_reads_through_a_placed_view— passed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean
serves_readscheck preventing readable textures from sharing a host texture created withDENY_SHADER_RESOURCE. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:02:58Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Readable texture no longer shares a host texture denied... — texture-state isolation fix.
Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T07:58:01Z.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head
df71bd02intomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 702 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). One thing to know: in the first full run a test that this PR does not touch,bindless::tests::heap_views_follow_writes_through_another_mapping(bindless.rs:612, "round 0, dword 0, left 0, right 1064"), failed once; the second full run and 6 further runs ofcargo test -p victory-gpu --libon the same tree all passed (144 passed each), so I could not reproduce it and cannot say whether it comes from this PR or from the test itself. The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T08:52:20Z.
Follow-up to my report above: the one failure I mentioned,
bindless::tests::heap_views_follow_writes_through_another_mappingatbindless.rs:612, is not from this PR. The same assertion ("round 0, dword 0, left 0, right 1064") failed onmain940d32falone in a later full run on the same machine, in the testbindless::tests::heap_views_are_current; I have opened an issue with the numbers (#2252).AI-assisted (Claude Code); no game data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:38:55Z.
Automated triage for the maintainers.
Merge candidate (unchanged). The push since the last triage (
df71bd0to9ceb7c4) is a rebase onto currentmain. The diff is identical line for line, and it still merges cleanly.takesincrates/victory-gpu/src/resource.rsgainsserves_reads, so a title texture that shaders read no longer shares a host texture made without shader access (a denied texture or a typed depth format). It gets its own host texture through the existing replacement path, with the contents copied over throughalias_source. The new test indraw.rsreads a cleared deniedD32_FLOATtexture through anR32_FLOATplaced view. The tests that count alias copies share theALIASEDlock.CI: passing (
check).Recommending a look, not approving.
Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 15:04:30 +00:00
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.