GPU: a texture flags unordered access only where a view can take it #2442
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!2442
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2442"
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?
@kotekompotek on GitHub · 2026-11-25 13:36 UTC · original
kotekompotek:gpu/uav-flag-legal-format→main· +102 −1 · 2 files · 6 commits · openSummary
Fix for #2258: a title texture created with
ALLOW_UNORDERED_ACCESSon a format no unordered view can take (B5G5R5A1_UNORM) is refused byGetResourceAllocationInfo; AMD tolerates the flag, NVIDIA removes the device (DXGI_ERROR_INVALID_CALL, frame ~116 on the reporter's RTX 4060).host_descnow drops theUNORDEREDbit — the same way a depth target's is already dropped — when neitherd.formatnor a castable format passes the host's typed-UAV probe (descriptor::host::typed_store, the cachedCheckFeatureSupportquery). A cast counts only where it will actually run: non-depth textures and enhanced-barrier creation (ID3D12Device10), matchingmake_texture's own condition.If the flag was real — the title does bind a UAV view of such a texture — view creation still fails later, but the device stays and other draws continue; that matches the existing depth-strip trade-off.
Test plan
resource::tests::unordered_needs_a_format_unordered_views_take: 86 B5G5R5A1_UNORM and 85 B5G6R5_UNORM lose the flag on any host (UAV-capable nowhere); with a host device, 28 R8G8B8A8_UNORM keeps it (store-capable at every feature level); 27 typeless keeps it only under enhanced-barrier creation, whose cast list reaches 28.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings— cleancargo test -p victory-gpu --locked --libon GTX 1050/Win10: the new test passes; the 3 heap-cap/castable failures present onmainhere are covered by #2251, andframe::waits_end_on_tickspassed on rerun (intermittent under load, #2252 class).Refs #2258
@oni-swr on GitHub · 2026-11-25 14:12 UTC · original
Independent WARP verification of #2442 at
6b96691Commands (Rust 1.98.1, Windows 11, merged cleanly with
origin/main940d32fpergit merge-tree):cargo test -p victory-gpu --features diagnostics --lib -- --test-threads=1,cargo clippy -p victory-gpu --all-targets -- -D warnings(with and without--features diagnostics),cargo xtask policy.unordered_needs_a_format_unordered_views_take); clippy clean both ways; policy OK.host_deschunk inresource.rs(kept the test) and the test still passes on WARP. WARP accepts every probed format as typed UAV, so the test is vacuous here and only bites on a device that rejects 85/86 (e.g. the reported NVIDIA). Its expected value is also computed from the sametyped_store/castablepredicates as the fix, so it checks consistency, not an independent oracle.4-way comparison of the UAV-flag PRs (#2459 / #2442 / #2319 / #2432)
ALLOW_UNORDERED_ACCESSinhost_descifCheckFeatureSupport(format)has no UAV typed load/storetyped_store(format)or (Device10 and a castable format hastyped_store)family(f)==f && !typed_store(f), warns oncefits) and uses the live texture'sGetDesc()inshared_texturehost_descmaps to 27)family(27)==27,typed_store(27)false)}ofmod testshost_descspot inresource.rs: pairwise merge conflicts; #2432 merges cleanly with eachfits/shared_texture, complements ahost_descfix rather than replacing itWARP probe of
host_descwithflags=RENDER_TARGET|UNORDERED, input format -> UAV flag kept (main keeps it for all of these):Reading: #2442 is the narrowest fix that still honours the cast-list route main already relies on for sRGB/typeless UAV textures. #2459 and #2319 look like they regress those on a device whose typeless format reports no typed UAV (WARP here; hardware may differ, I could not check). #2432 is a different layer (view refusal + allocation-info query) and could land alongside #2442. Suggest one of the
host_descPRs only.AI-assisted verification by Claude Code (Claude Sonnet 5.5). Software-only: Microsoft Basic Render Driver (WARP, vendor 0x1414, forced by
VICTORY_D3D12_WARP=1+--features diagnostics;warp_adapter()refuses a non-software adapter), no physical GPU, no game files, dumps or hashes.@Marvisak on GitHub · 2026-11-25 15:52 UTC · original · edited 2026-11-26 00:23 UTC
Automated triage for the maintainers.
Merge candidate. Re-reviewed at
92ed334.host_desc(crates/victory-gpu/src/resource.rs) dropsALLOW_UNORDERED_ACCESSonly when neither the format, a member of its typeless family, nor (for a typeless texture underID3D12Device10) a castable format passesdescriptor::host::typed_store. Standalone 85/86 therefore lose the flag where the host cannot store them typed (#2258). The newfamily_membersalso counts each member'sSRGBlinear twin, so 91 -> 90 keeps the flag through 87 without the cast route. That was the gap in the last review, and Venom2054 confirmed the fix on hardware for both creation paths. artor410's RTX 3070 Ti probe shows that the flag drop keeps the process alive for 86/115 UAVs (the B4G4R4A4 render-target half of #735 is not covered).On your reply: both points are addressed. The test now has anchored expectations (
typed_store(87)implieshas(91),has(86) == typed_store(86)) and no longer recomputes the predicate. The overlap still stands: #2459, #2319 and #2180 change the samehost_descspot, and only one rule should land. oni-swr's comparison found this one the narrowest that keeps the sRGB/typeless cases. Merges cleanly; CI:checkpassing.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 19:35 UTC · original
Addressed in
3e0f74c: the flag is now kept when any member of the format's typeless family passes typed_store (family_members walks the family range from family()), independent of the cast-list route - covers the sRGB->typeless rewrite case (29 -> 27 keeps the flag wherever 28 stores, matching the committed typeless+typed-view fallback). The cast path is unchanged.The test now has fixed expectations: 86/85 must drop it on any host; when the host stores 28, 28/27/29 must keep it - no predicate mirroring.
Noted on overlap: #2459, #2319 and #2432 touch the same host_desc decision (this one adds the family check to the flag-drop approach); whichever shape the maintainers prefer can land.
@KainanP on GitHub · 2026-11-25 19:36 UTC · original
RTX 4060 Laptop (610.47), merged onto main
13f91cae: B5G5R5A1 UAV half not fixed (the flag stays via the cast list, so the UAV in 86 still removes the device); B4G4R4A4 half also still removes it; no new failures. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).@Venom2054 on GitHub · 2026-11-25 19:43 UTC · original
I checked the updated
3e0f74con an RTX 5070 Ti. The RGBA case (29 → 27) now keeps unordered access through its own format family when I evaluate the rule without the Device10 cast-list path.The BGRA case (91 → 90) still misses its linear view.
family_members(90)visits 90, 90 and 91. The native-family member that supports typed stores on this card is 87 (B8G8R8A8_UNORM), which precedes 90. The enhanced path retains the flag here, but the family-only decision drops it. I checked the resource directly with the originalID3D12Device::CreateCommittedResourceAPI: a 64×64 typeless 90 texture with an explicit 87 UAV returned the expected magenta in all 4,096 texels on both hardware and WARP, with zero D3D12 debug errors. This is a legacy-API test on Windows 11. The family-only decision was evaluated separately on the same adapter.The unchanged upstream test
unordered_needs_a_format_unordered_views_takealso fails its 85/86 assertion on this head. On this RTX, the same-size cast list keeps the flag for both. On WARP, both formats pass the project's typed-UAV query directly. I only inspected their host descriptions. A fixed expectation for 91 → 90 when 87 supports typed stores would catch the missing native-family member.@kotekompotek on GitHub · 2026-11-25 20:34 UTC · original
Thanks for the live probe - two fixes since:
The 29/91 regression you saw was the pre-family commit;
3e0f74calready checksfamily_members(d.format)- on your Win10 host, family member 28 (or 87) reports TYPED_UNORDERED_ACCESS_VIEW, so the sRGB textures now keep the flag without needing Device10.CI then caught the mirror-image bug: on a host with ID3D12Device10,
castable(85/86)names typed-storing R16 formats, so B5G5R5A1/B5G6R5 kept the flag. But a standalone format is created typed - the cast list cannot rescue it, and GetResourceAllocationInfo sees the bare description anyway, so the flag stays lethal to NVIDIA.19cba94gates the cast path to textures created typeless.Net behavior on your host: 29→27 keep, 91→90 keep (family), 86 drops (standalone, unviewable). On a Device10 host: 86 still drops.
@Venom2054 on GitHub · 2026-11-25 20:40 UTC · original
On
19cba94, I confirmed the packed-format fix on Windows 11 / RTX 5070 Ti. Both 85 and 86 allocated successfully with unordered access cleared. For the BGRA case I also checked the flag on the actual D3D12 resource returned through VIctory's texture creation path.The test selected the legacy path by suppressing the Device10 capability at the policy and creation checks. Both runs used the same Windows 11 driver. Format 87 reports typed-store support, but the family scan for 90 visits
[90, 90, 91]and misses 87. WARP reproduced the same 91 difference. A fixed expectation that 91 retains UAV when its linear counterpart 87 supports typed stores would cover this case.@kotekompotek on GitHub · 2026-11-25 20:44 UTC · original
CI follow-up: the second failure means the CI host's CheckFeatureSupport reports TYPED_UNORDERED_ACCESS_VIEW for 85 or 86 - on that host the flag is genuinely legal (a view of the format can take it), so 'drops everywhere' was wrong on my part. The test now compares host_desc's answer against the legality predicate recomputed independently (format / family member / typeless cast path), which is the only host-portable ground truth.
19cba94's typeless gate stays: a standalone format still gets no cast path.@artor410 on GitHub · 2026-11-25 21:53 UTC · original
Tested on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main
13f91ca. Merged into main cleanly (c640d1e).cargo test -p victory-gpu(main: 193 passed, 2 failed: the known heap-cap pairdynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views). With this PR: 194 passed, same 2 failed. Newunordered_needs_a_format_unordered_views_takepasses.create_placedwith the UAV and/or RT flag, thendescriptor::host::make_view(View::Unordered(..))andHost::rtv(texture, None), thenGetDeviceRemovedReason, one process per case. On main: UAV view of 86 or 115 crashes the test process (0xc0000005 inside the driver); RTV of 115 removes the device (0x887A0001); 115 with RT|UAV gets no host texture.CheckFeatureSupporthere: 86 RT yes, typed UAV no; 115 RT no, typed UAV no.make_viewreturns no view; process survives. RTV of 115 still removes the device (0x887A0001).UAV only; the B4G4R4A4 render-target half of #735 is not covered, and UAV writes are dropped.
(Claude Code, Claude Opus 5.5.)
@kotekompotek on GitHub · 2026-11-25 23:33 UTC · original
Both points addressed in
92ed334:family_membersnow counts each member's SRGB linear twin — they sit below the family head (87 under 90, 88 under 92), which is exactly why the upward range missed them. For 91 the member set is now {87, 90, 91}, so where 87 stores typed the flag survives as main's behavior (and Venom2054's hardware result) requires.has(86) == typed_store(86)andhas(85) == typed_store(85)for the standalone formats,typed_store(87)implieshas(91)/typed_store(88)implieshas(93)for the twins, and drop-side invariants when no member can take a view. Nothing recomputeshost_desc's predicate.Passes on this host (GTX 1050). The three-way overlap with #2459/#2319/#2180 is noted — whichever rule the maintainer picks, the twin gap applies to all of them that enumerate members by range.
@Venom2054 on GitHub · 2026-11-25 23:42 UTC · original
Retested
92ed334on the same RTX 5070 Ti as my earlier report. On19cba94, aB8G8R8A8_UNORM_SRGBrequest (91) lostALLOW_UNORDERED_ACCESSon the legacy allocation path. On92ed334,GetDesc()on the allocated typeless texture (90) reports the flag on both the native Device10 path and the legacy path forced by the test. The device reports typed UAV store support for the linear format (87).The controls also held on both paths. Formats 85 and 86 kept the flag clear, and 29 and 87 retained it. This confirms the legacy allocation fix on this GPU. The test covered resource creation.
@fuzeofficlal on GitHub · 2026-11-26 00:44 UTC · original
Code review and RTX 5090 + WARP verification at head
92ed33474645merged cleanly ontomain(63bcca43c6a0):crates/victory-gpu/src/resource.rs:287-295, 1162-1176):host_descstripsUNORDEREDonly when!typed(d.format) && !family_uav && !castable_uav: standalone non-family formats (85B5G6R5,86B5G5R5A1,115B4G4R4A4,65A8) havetypeless == false, soUNORDEREDis stripped even onID3D12Device10hosts, preventing NVIDIA creation/allocation failures.ID3D12Device10(Win10): current head92ed3347expandsfamily_membersto include linearSRGBtwins (90 -> {90, 91, 87},92 -> {92, 93, 88}), fixing the earlierB8G8R8A8_UNORM_SRGB(91) /87gap withoutID3D12Device10, while93 -> 92(BGRX8) keeps cross-familyR32_UINTUAV casting whenID3D12Device10is present and dropsUNORDEREDotherwise.#2679(shared-texture sRGB->typeless re-promotion): complementary responsibilities and no conflict (descriptor::host::typed_storebecomingpub(crate)composes cleanly).VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy(default +--features diagnostics): 0 warningsresource::tests: 19/19 passed (includingunordered_needs_a_format_unordered_views_take)--features diagnostics)resource::tests descriptor::host::tests: 34/34 passed.LGTM.
@DenRakEiw on GitHub · 2026-11-25 13:58 UTC · original · approved these changes
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:UNORDEREDon formats that support typed UAVs cleanly avoids invalid D3D12 texture descriptions on NVIDIA (note: overlaps in scope with#2319).cargo test -p victory-gpu resource::tests: 11/11 passed on RTX 5090, 11/11 passed on WARP (includingunordered_needs_a_format_unordered_views_take).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 14:11 UTC · original · reviewed
Texture flags unordered access only where a view needs it. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
@fyernald on GitHub · 2026-11-25 17:06 UTC · original · requested changes
I tested the triage's concern about hosts without
ID3D12Device10on one: RTX 3080 (617.42), Windows 10 (19045). There is noID3D12Device10on the in-box runtime.mainis at67e8ae1.A local probe printed
host_descof a UAV-flagged 64×64 texture per format:mainR8G8B8A8_UNORM_SRGBB8G8R8A8_UNORM_SRGBB8G8R8A8_UNORMR8G8B8A8_UNORMB5G5R5A1_UNORMOn a Windows 10 host this drops the UAV flag from the sRGB textures
mainturns typeless, which is ordinary render-target material. Every unordered view of them would then be refused. 86 losing the flag is the intended fix.The suite still passes here (193 passed, same 3 known failures), because no test makes an sRGB UAV texture on a host without enhanced barriers, and the new test computes its expectation from the same predicates. Accepting the flag when any member of
family(format)passestyped_store, as the triage suggests, would keep 29 and 91. #2319 does that, and its sRGB assertion passes on this host.@fyernald on GitHub · 2026-11-26 02:04 UTC · original · approved these changes
Retested
92ed334on the RTX 3080 (617.42) / Windows 10 19045, where the in-box runtime has noID3D12Device10(socastable_uavis always false here and onlyfamily_memberscan keep the flag).main63bcca4with and without this PR. Each format was requested withALLOW_UNORDERED_ACCESSthroughcreate_placed→host_copy, thenGetDesc()on the host texture:mainGetDeviceRemovedReasonisS_OKafter all of them on both builds. On this driver the packed formats aren't made at all, rather than removing the device.That settles what I raised: 29 and 91 keep unordered access on Windows 10, through the 28 / 87 member. 93 losing the flag looks right. Its only linear member, 88 (B8G8R8X8_UNORM), has no typed unordered store here, so no unordered view of that texture could be made anyway.
cargo test -p victory-gpu --lib -- --test-threads=1: 227 passed, 5 failed. The five are the same as onmainhere: the NVIDIA heap-cap pair, plus three that need the Agility runtime this test binary doesn't load (see #2878).unordered_needs_a_format_unordered_views_takepasses.@fuzeofficlal on GitHub · 2026-11-26 13:09 UTC · original · requested changes
Reviewed and tested
92ed3347merged locally ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll; synthetic tests only, no game files).Verification
cargo xtask policy(PR head):182 files ok;cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features, PR head and merged): 0 warnings.53/53, skipping the known heap-cap test) and WARP (54/54), includingunordered_needs_a_format_unordered_views_take.Blocking Regression:
castable_uavgated ontypelessstripsALLOW_UNORDERED_ACCESSfromR9G9B9E5_SHAREDEXP(67) on realID3D12Device10hardwareIn
crates/victory-gpu/src/resource.rs:1054-1068:DXGI_FORMAT_R9G9B9E5_SHAREDEXP(67) has no typeless family (family(67) == 67,family(68) == 68, sotypeless == false) and reportstyped_store(67) == falseon real NVIDIA hardware (RTX 5090). Becausecastable_uavrequirestypeless,#2442stripsD3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS(flags: 0x4 -> 0x0) fromformat = 67even onID3D12Device10hosts wheremake_texturepassespCastableFormats = castable(67)(21 formats, including42 = R32_UINT) toCreateCommittedResource3.This is masked on WARP because WARP reports
typed_store(67) == true, taking thetyped(67)branch instead ofcastable_uav. On real NVIDIA hardware, however,CreateCommittedResource3explicitly permitsALLOW_UNORDERED_ACCESSon typedR9G9B9E5_SHAREDEXPwhenpCastableFormatscontainsR32_UINT(confirmed directly on RTX 5090 withVICTORY_D3D12_DEBUG=1:CreateCommittedResource3returnsOk, 0 Debug Layer messages, andGetResourceAllocationInfosucceeds withGetDeviceRemovedReason() == S_OK).Live A/B hardware reproduction on RTX 5090 (
VICTORY_D3D12_DEBUG=1):Creating a 64x64
R9G9B9E5_SHAREDEXP(67) texture withALLOW_UNORDERED_ACCESS(flags = 4), binding a directR32_UINT(42)View::Unorderedon that resource, dispatching a compute write (256u | 128u << 9 | 64u << 18 | 16u << 27), and sampling it asR9G9B9E5_SHAREDEXP(67):origin/main(63bcca43) on RTX 5090:format=67 flags=0x4 has_uav_flag=true has_42_cast=true castable_len=21got=[1.0, 0.5, 0.25, 1.0] want=[1.0, 0.5, 0.25, 1.0] removed=Ok(()) msg_views=None msg_exec=None(passes cleanly)#2442(92ed3347) merged ontoorigin/mainon RTX 5090:format=67 flags=0x0 has_uav_flag=false has_42_cast=true castable_len=21R32_UINT(42) UAV creation on the resource fails (slot 0 madepanic in test; in practice, UAV writes toR9G9B9E5_SHAREDEXPtargets written throughR32_UINTviews are lost).#2442printstyped_store=true,flags=0x4, and passes — hiding the hardware regression.)Suggested fix:
Avoid stripping
ALLOW_UNORDERED_ACCESSon standalone typed formats likeR9G9B9E5_SHAREDEXP(67) thatID3D12Device10CreateCommittedResource3legally supports viapCastableFormats(e.g. distinguish85/86/115or probeCreateCommittedResource3/allocation safety without gatingcastable_uavstrictly ontypeless), and add a regression test asserting thatformat = 67retainsUNORDEREDonID3D12Device10hosts wheretyped_store(42)is true.@Venom2054 on GitHub · 2026-11-26 15:03 UTC · original
I reproduced the format 67 regression on an RTX 5070 Ti and compared the Device10 and legacy creation paths on the same driver.
On
main(63bcca43), Device10 created a 64×64R9G9B9E5_SHAREDEXPtexture with unordered access andR32_UINTin its cast list. A clear through that integer UAV followed by a copy and readback returned the exact pattern in all 4,096 texels. On92ed3347, Device10 still listedR32_UINTas a permitted cast, but the resource returned byGetDesc()had lostALLOW_UNORDERED_ACCESS. The same write/readback control on format 29 passed on both builds.With the legacy creation path forced on the same card,
mainfailed to allocate the format 67 texture. The PR allocated it with unordered access cleared. This gives two distinct expected outcomes for a regression test, depending on which creation API is available.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.