GPU: clear ALLOW_RENDER_TARGET alongside ALLOW_UNORDERED_ACCESS on host depth resources #2143
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2145"
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-25T06:01:03Z.
Problem
Console D3D12 allows depth-stencil textures to carry
ALLOW_RENDER_TARGET(0x1) andALLOW_UNORDERED_ACCESS(0x4) alongsideALLOW_DEPTH_STENCIL(0x2), whereas PC D3D12 rejectsCreateCommittedResourcewheneverD3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCILis combined withD3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET. Currentlyhost_desc(crates/victory-gpu/src/resource.rs) stripsUNORDEREDonDEPTHresources while leavingRENDER_TARGETset.Changes
RENDER_TARGET(0x1) together withUNORDERED(0x4) inhost_descwhend.flags & DEPTH != 0so committed, placed, and address-backed depth resources create and shareHostTexturecopies cleanly (and strip any initialRENDER_TARGETresource state vialegal_for).resource::tests::depth_resources_drop_render_target_and_unordered_flagscoveringD32_FLOAT,D16_UNORM, andD32_FLOAT_S8X24_UINTwith0x3/0x7/0xbflags acrosscreate_committed,create_at_address(verifyingHostTexturesharing), andtexture_at, plus GPUClearDepthStencilViewreadback underVICTORY_D3D12_DEBUG=1across RTX 5090, AMD Radeon Graphics, and D3D12 WARP.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:24:05Z.
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 depth_resources_drop_render_target_and_unordered_flags— passed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean clearing of
ALLOW_RENDER_TARGETalongsideALLOW_UNORDERED_ACCESSon host depth resources. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:33:06Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
ALLOW_RENDER_TARGET cleared alongside ALLOW_UNORDERED_ACCESS — usage-flag hygiene fix; prevents invalid combos reaching D3D12.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T11:25:50Z.
Automated triage for the maintainers.
Needs work.
The PR makes
host_desc(crates/victory-gpu/src/resource.rs) clearALLOW_RENDER_TARGETas well asALLOW_UNORDERED_ACCESSon depth textures, so that D3D12 accepts their host copies. The premise is plausible: the PC API does not take depth-stencil together with render-target or unordered access on one resource.legal_foralready drops the render-target state bit once the flag is gone. CI: passing (check).What it needs:
0x3/0x7, or drop the claim. The new test (about 330 lines) checks that the flags are cleared after the change. It does not show a failure onmainthat this fixes.crate::twin). Render targets have nothing like that. Today a depth+RT texture has no host copy, soState::set_targets(draw.rs) andclear_rtv(list.rs) skip it. After this change they callHost::rtv→CreateRenderTargetViewon a host resource that lacksALLOW_RENDER_TARGET, which D3D12 treats as invalid. Please handle that case in those two paths (skip it with aonce!warning, or give it a twin) and cover it in the test. Alternatively, show that the title never makes an RTV on these textures.0x1/0x2/0x4/0x8. The named constants (DEPTH,UNORDERED, or a sharedRENDER_TARGET) would read better than the new localconst RENDER_TARGETinhost_desc.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T11:53:22Z.
Good catch in the triage review — checking across reported title runs confirms this came from a synthetic resource-flag probe rather than an actual title resource request (
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGETandD3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCILare mutually exclusive in Direct3D 12 as well), and strippingALLOW_RENDER_TARGETwithout an RTV twin would leaveset_targets/clear_rtvcallingCreateRenderTargetViewon a non-RT host resource.Closing this PR so we only carry fixes backed by real title behavior.
Pull request closed