GPU: drop unsupported UAV/RT flags on typed host textures and guard RTV creation #1040
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!1040
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1040/head"
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?
@gabrielcruzg3 on GitHub · 2026-11-24 15:15 UTC · original
gabrielcruzg3:fix/host-texture-uav-support→main· +107 −8 · 4 files · 3 commits · closed without mergingAddresses #264 (Finding #4) and related D3D12 validation errors on formats that PC GPUs do not support as typed UAVs or render targets (such as B5G5R5A1_UNORM and B4G4R4A4_UNORM).
Changes
Verification
@shortselow-byte on GitHub · 2026-11-24 15:51 UTC · original
This PR has no CI run yet, so I ran the CI's checks at head
08e4c89: Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2). The new test fails on AMD and on WARP, so it would fail CI too.host_texture_drops_unsupported_uav_flag_for_b5g5r5a1fails atresource.rs:1904: theB5G5R5A1_UNORMtexture keepsALLOW_UNORDERED_ACCESS. Same failure on WARP (--features diagnostics,VICTORY_D3D12_WARP=1).D3D12_FEATURE_FORMAT_SUPPORTquery on both devices givesTYPED_UNORDERED_ACCESS_VIEWandRENDER_TARGETfor bothB5G5R5A1_UNORM(86) andB4G4R4A4_UNORM(115). So nothing is dropped there, as intended. The test hard-codes one driver's answer.Other checks:
d2a4bae, andcargo clippy -- -D warningsfails on that base (invictory-hleandvictory-gpucode that isn't from this PR). Merged locally ontomainffe310e, both clippy runs (default and--all-features) are clean. The workspace tests still stop at the failing test above.cargo xtask policy: ok.@NuraadGit on GitHub · 2026-11-24 16:17 UTC · original
This is the same problem as #55 and #89. Two things from an RTX 2080 (native Windows, driver 616.56) that apply to this version:
1. The
continueinset_targetsmoves later targets into the wrong slots. Whenhost.rtvreturnsNone, the target is left out ofrtvs. Every render target after it then binds one slot lower, so the pixel shader's later outputs go to the wrong textures. A null RTV in that slot keeps the order. @EduAzevedo made this point on #55 and posted a patch. Mine does it inHost::rtv: a typed null view (R8G8B8A8_UNORM,TEXTURE2D) when the resource lacksALLOW_RENDER_TARGET. The early return inclear_rtvis right as it is. (This one is from reading the diff; I haven't run this branch.)2. The guard is needed, but dropping the use loses the title's writes. In the world the host refuses exactly two textures here: 2560x1440 format 115 (flags RT, loses RT) and 2560x1440 format 86 (flags RT|UAV, loses the UAV). Without a guard, the device was removed with
DXGI_ERROR_INVALID_CALLat world entry, 2 of 2 runs. With one, the run stayed up for 8 minutes, but the first texture's draws and the second's compute writes go nowhere.Merging the efforts: the RTV guard and the null clear value (which #55 doesn't have) are useful on their own, for any format. For 86 and 115, #89 keeps the writes by making them
R8G8B8A8_UNORM. With a substitution like it on this card, no use is dropped, and the world ran 12 minutes at ~2,810 draws per frame. So I'd combine: the guard with a null RTV from here, the substitution from #89, and the use-dropping as the last resort for other formats.AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.
@Zipettte on GitHub · 2026-11-24 16:30 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
08e4c89: the new testresource::tests::host_texture_drops_unsupported_uav_flag_for_b5g5r5a1fails every time (3/3):4 is
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, so the UAV flag is kept on this machine. Maybe this RDNA3 driver reports typed UAV support for B5G5R5A1 and the flag is (correctly) not dropped. If so, the test may need to check the format support first instead of always expecting the flag to be removed. The other 43 victory-gpu tests pass.Tested with AI assistance (Claude).
@fuzeofficlal on GitHub · 2026-11-24 17:02 UTC · original
Tested across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics (
1002:13c0), and D3D12 WARP withVICTORY_D3D12_DEBUG=1, and put together a rebased branch fixing the two issues noted above:resource.rs: QueriesCheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)dynamically forB5G5R5A1_UNORM/B4G4R4A4_UNORM(stripping on NVIDIA while preserving supported flags on AMD and WARP), and tests unconditional RT+UAV flag stripping +pOptimizedClearValueomission onBC1_UNORM(71,flags = 5) and UAV stripping onB8G8R8X8_UNORM(88).ALLOW_RENDER_TARGETwas stripped (host.rs+draw.rs): Instead ofcontinueshifting subsequent targets down by one slot, pushes a typed null RTV (Host::null_rtv, falling back toR8G8B8A8_UNORMTEXTURE2Dwhen the texture's own format cannot back a host RTV) while keeping the non-RT texture out ofself.targetsso no invalidRENDER_TARGETbarrier is emitted. Verified with a synthetic MRT draw (SV_Target0bound toBC1_UNORM,SV_Target1bound toR8G8B8A8_UNORMreading back[0, 255, 0, 255]) with zero D3D12 debug errors on all three adapters.Branch ready to cherry-pick from (author attribution preserved): https://github.com/fuzeofficlal/VIctory/tree/fix/host-texture-uav-support-1040 (
1bdeeb4c)@MamaLeVrai on GitHub · 2026-11-24 20:08 UTC · original
Heads-up on this PR's test
host_texture_drops_unsupported_uav_flag_for_b5g5r5a1: onmainplus this PR alone it fails on an RX 6950 XT (left: 4, right: 0at the first assert).host_textureonly drops what the adapter refuses, viaCheckFeatureSupport, and that adapter accepts a typed UAV on B5G5R5A1_UNORM, so the flag stays; the test assumes every adapter refuses it. The CI runner has no GPU there (host()isNone, the test returns early), so CI would not show it. The code is right; the test can ask the adapter the same way and expect the flag kept or dropped accordingly. That is what the commit9b2e665of #1632 does (for B5G5R5A1 UAV and render target and for B4G4R4A4 render target). AI-assisted (Claude Code); no game data.@Marvisak on GitHub · 2026-11-25 00:30 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #55. same change as before (drop UAV/RT flags by a format-support query, skip UAV barriers by a hard-coded flag test, guard RTVs) and still conflicts; #55 fixes the same NVIDIA packed 16-bit refusals in 47 lines by retrying creation. Also carried by bundles #1632/#1638.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed