GPU: a readable texture does not share a host texture denied to shaders #2187
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2187
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@fuzeofficlal on GitHub · 2026-11-25 07:19 UTC · original
fuzeofficlal:fix/gpu-shared-texture-deny-srv→main· +72 −0 · 2 files · 1 commits · openProblem
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.@MamaLeVrai on GitHub · 2026-11-25 07:58 UTC · original
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.
@MamaLeVrai on GitHub · 2026-11-25 08:52 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 12:38 UTC · original · edited 2026-11-26 01:21 UTC
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
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.