GPU: drop the unordered-access permission a format cannot carry, before any call names it #1830
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1832"
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 fiestorra on 2026-11-24T23:08:43Z.
The device removal comes from a description we hand the host, and the rule only drops a permission the host cannot honour
The debug layer names the condition itself — this is the message that ends the device:
Two things make it fatal where a creation ladder would not help:
GetResourceAllocationInfo, a query we make before creating anything, so any retry ofCreateCommittedResource— including the ladder in #1630 — happens after the device has already been removed;severity=1means it does not come back as a return code.The change
host_desc— the one place a title description becomes a host description — asks the host whether the format or any format it can be cast to takes a typed unordered access view, and drops the flag only when the answer is no for all of them:uav_of_element(format)istyped_uavovercastable(format)plus the format itself;typed_uavasksCheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT2)forUAV_TYPED_LOAD | UAV_TYPED_STORE. The answer is tri-state on purpose: when the host cannot be asked, the description is left exactly as the title wrote it. A typeless format is judged by the formats it casts to, which is what the debug layer does.This mirrors the message's own wording — "a format that either can be used as unordered access, or cast to a format that could be" — which is also why
GetResourceAllocationInfoneeds no list from us: the cast set is a property of the format.What the rule answers
typed_uavuav_of_elementhost_descof a 64×64 2D texture withALLOW_UNORDERED_ACCESSB5G5R5A1_UNORMSome(false)Some(true)B4G4R4A4_UNORMSome(false)Some(true)R8G8B8A8_UNORMSome(true)Some(true)R8G8B8A8_UNORM_SRGBSome(false)Some(true)Measured on an RTX 4070 Ti (Ada, driver 621.01, Windows 11) at
1a2057a, reported in the thread by @kalberts0089-hash.castable(86)is[49, 50, 51, 52, 54, 56, 57, 58, 59, 68, 69, 85, 115], and 68/69 take typed UAV, which is why 86 is kept. Over formats 1–132 the rule fires only for 5–8, 70–84, 94–99, 106 and 111–114 — formats whose whole element is colour-block or depth.An earlier head asked only about the format itself (
typed_uav(86) == Some(false)) and therefore dropped the flag for 86 and 27. That was an over-drop: it silenced the message, but it took a permission the host can honour. The rule here is the narrower one.Verification
The removal, on the machine that has it (integrated AMD,
mainat70564ae+ this change, release, real window 3840×2160):mainalone → 1×id=599, device removed at frame 128; with the change, three runs → 0 messages, no removal, 128/256/kept-presenting frames. That run was at the earlier head, where the rule was the broader one.On NVIDIA Ada at this head (@kalberts0089-hash, RTX 4070 Ti, 621.01): the test suites agree with
mainexcept the two new tests, both passing; with the debug layer,resource::tests::20 passed including both; the queries above produce 0 stored debug-layer messages andGetDeviceRemovedReasonis ok.a_typeless_format_is_judged_by_the_formats_it_casts_toandthe_permission_follows_the_whole_element, which assert the rule (the permission follows the answer) rather than a hard-coded table.cargo test -p victory-gpu --liband-p victory-shader --lib: the failures are the known NVIDIA ones onmain, identical on both sides.cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features→ clean.What I am not claiming
victory-gputests on NVIDIA in the suite aremain's, not this change's.no host texturefor theB4G4R4A4_UNORM1440p target (that is #1630's ladder) and the view heap capped at 1,000,000 with 310,720 slots past it (its own issue).No game data is involved: a description, a format number, warnings and counts only.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:36Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Drop the unordered-access permission a format cannot carry: fourth leg of the host-capability gating (#1775/#1787/#1801/#1843) — keep them consistent.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:11:28Z.
Overlap for the reviewers: #1787 (22:33) also drops
UNORDEREDfrom a texture's host description inresource.rswhen the host can't store the format (host_unordered_format), for the sameB5G5R5A1_UNORMdevice removal. #1763, #1775, #1780 and #1801 handle the view side indescriptor/host.rs. This PR and #1787 edit the sameresource.rspath, so one of the two is enough. From reading the file lists and descriptions; nothing built.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T23:16:07Z.
Tested against the real failure, and against the other two candidates: it is one of three causes
With the debug layer installed on a machine that reproduces the removal, the same scenario (session 1, window 3840×2160, empty cache, default adapter
AMD Radeon(TM) Graphics, driver32.0.21045.29003):id=599id=1419main70564aeSo on this machine this change alone is enough to stop the removal, while the texture ladder alone is not — it removes the
no host textureline and then uncovers a second rule violation (id 1419, the sampler heap) that was previously invisible because the run died at 599 first.That is worth saying in the pull request rather than in a later comment: a reviewer testing only this change on an NVIDIA card may see the removal go away and a different one appear later, and it is the id 1419 of #1778 in that case.
Full write-up with the chain: https://github.com/Marvisak/VIctory/issues/1754#issuecomment-7147203080
Still in the log with all three, and a different problem:
host view heap capped at 1000000and 310,720title slot past the host heap(https://github.com/Marvisak/VIctory/issues/1760). No removal on this machine, still costing frames.No game data is involved.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T23:41:13Z.
Correction to my own measurements: those runs were on the RTX 4090, not on the integrated GPU
I have been writing "default adapter, integrated
AMD Radeon(TM) Graphics, driver32.0.21045.29003" on the runs I made in session 1. That attribution is wrong, and the cause is worth knowing because it is the exact trap this repository keeps warning about.DXGI enumerates the adapters in a different order in the two sessions. Measured on this machine, same binary, same moment, with
cargo test --release -p victory-gpu -- --ignored adapters:So the default adapter is the integrated AMD in the agent's session and the RTX 4090 in the session where the title runs, which is precisely where every number I published in the last few rounds came from. With my selector in place the run says it plainly:
—
index=1is the AMD in session 1, the reverse of session 0, which is what made me notice.What this changes, and what it does not:
32.0.16.2124), not on the integrated GPU — which is the same vendor as the machines in #1754, #1755, #1758 and #1760. The chain in https://github.com/Marvisak/VIctory/issues/1754#issuecomment-7147203080 is NVIDIA evidence, not AMD evidence.B5G5R5A1_UNORM), the title in session 1 (RTX 4090, which does not). There was never a discrepancy — different device, different answer.32.0.21045.29003for a session-1 run should read32.0.16.2124(NVIDIA GeForce RTX 4090). I will put this note on the threads where the numbers were used rather than editing old comments, so the record keeps both.VICTORY_D3D12_ADAPTERis session-dependent, and a name substring is not. UseVICTORY_D3D12_ADAPTER=nvidiaor=amd, and check thehost GPU adapter=line rather than assuming which card the default is.No game data is involved: adapter descriptions, vendor ids and memory sizes only.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T23:47:54Z.
On the card that refuses it:
maindies at frame 64 with id 599, this branch reaches frame 256 with noneRe-ran the comparison on the RTX 4090 (driver
32.0.16.2124) with the D3D12 debug layer on, since that is the adapter where the rule fires — the integrated AMD here accepts the same description, which is why an AMD-only test cannot judge this. Session 1, real window 3840×2160, empty cache,diagbuild withVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1:main70564aeid=599(ALLOW_UNORDERED_ACCESSon aB5G5R5A1_UNORMtexture, inGetResourceAllocationInfo)id=1419draws=line)draws=1636, still presentingdropping unordered accessSo on the NVIDIA card the change does exactly what it claims: the description is made without a permission the format cannot carry, before any device call names it, and the device survives.
The log line from
mainfor the record, with the driver's own wording:Why this cannot be fixed where the rest of the texture work happens: the message is raised by a query (
GetResourceAllocationInfo), three calls before anything is created, so a retry ladder aroundCreateCommittedResource— including the one in #1630 — never gets to run. Andseverity=1means it is not returned as anHRESULT.Also worth saying plainly, because it decides how the fix should be judged: on this machine's integrated AMD the same
mainbuild shows no id 599, no cap and no removal, and ran 1,024 frames / 6,656 draws in the same 40 s (https://github.com/Marvisak/VIctory/issues/1754#issuecomment-7147748178). The failure is the NVIDIA driver's answer, so a reviewer with only an AMD card will see nothing here — the card to test this on is the one that refuses.Still in the log after this change, and deliberately not touched: the capped view heap (
host view heap capped at 1000000, 310,720 slots past it — #1760/#1779) and oneno host texture(#1630). They no longer remove the device; they still cost the frame.Verification of the branch:
cargo test -p victory-gpu --locked78 passed / 2 ignored, the ignored GPU testtyped_uav_follows_the_format_not_the_requestpassing,clippy --workspace --all-targets --all-features -D warningsclean,rustfmt --checkonresource.rsat the same 15 hunks asmain.No game data is involved: a format number, debug-layer ids, warnings and counts only.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T23:50:43Z.
The 120-second run: frame 2,048,
draws=13312,dispatches=1024, still no removalShort follow-up to the table above, because 40 seconds does not prove the device stays: same card (RTX 4090, driver
32.0.16.2124), samediagbuild with the debug layer and DRED on, session 1, empty cache, but for 120 s:versus
mainon the same card, which ends at frame 64 with id 599 and a removed device. So the skip is not a postponement: nothing else trips the layer in two minutes, and the draw and dispatch counters keep climbing.That also fixes what the frame does to the card's load: 2,048 frames and 13,312 draws in two minutes means it is not sitting in a corner avoiding the texture that used to kill it.
Nothing else changed in the branch; the verification in the comment above still holds.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-25T01:54:51Z.
Measured both bit choices on the cards where this matters: they agree, so the queue has two pull requests for one fix
I ran the two format-support tests side by side on the RTX 4090 (driver
32.0.16.2124, session 1 — the adapter that refuses this format) and on the integrated AMD of the same machine (32.0.21045.29003, session 0):Support1TYPED_UAV(0x100000)Support20xc0)B5G5R5A1_UNORM0xe4d3f00x200R8G8B8A8_UNORM0x33fcd3f30x102c0R32_FLOAT0x6f4d7fb0x2c8B8G8R8A8_UNORM_SRGB0x1010f00x200So for the format this is about,
Support1 & TYPED_UNORDERED_ACCESS_VIEW(#1926) andSupport2 & (UAV_TYPED_LOAD | UAV_TYPED_STORE)(#1832, mine) give the same answer, and the one format where they differ — the sRGB one — never reaches the check:host_descmaps sRGB with the unordered-access permission to its UNORM family before it, which is why the pair disagrees there harmlessly.Two consequences, and the second is the one worth acting on:
Support1is the flag the D3D12 documentation points at;Support2's typed load/store is what a shader actually does. On these two drivers they agree on the formats the title uses, and the sRGB case shows they will not always.host_descdrops the permission, tri-state when the host cannot be asked, measured on the 4090 — noGetResourceAllocationInforefusal, no removal, 2,048 frames in 120 s) and #1926 (+214/−34 across nine files, which also carries CPU, pipeline and manifest changes). A maintainer should only have to review one of them.I am not precious about which. Mine is smaller and was measured on the card that fails; yours is the one that reads the documented flag and additionally refuses the unsupported view at creation, which is a real improvement over dropping the permission alone. If you want yours in, say so and I close mine — I would only ask that the tri-state behaviour be kept: when the host cannot be asked, the description should stay as the title wrote it, because dropping a permission that was legal loses a texture's writes silently.
If it is easier the other way round, mine is
MERGEABLE/CLEANwith a green check today and yours is too, so it is a choice and not a queue problem.No game data is involved: formats, support masks and counts.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by SamuelGDMG on 2026-11-25T02:38:30Z.
Tested this fix locally and it's working — it resolves the
0x887A0001(DXGI_ERROR_INVALID_CALL) device removal onB5G5R5A1_UNORMand gets past the crash cleanly.Specs: Windows 11 (10.0.26200), Ryzen 5 5500, RTX 3050 8 GB, driver 610.88. Running
diagbuild on 940d32f withVICTORY_D3D12_DEBUG=1, andVICTORY_D3D12_DRED=1(Series 1.0.2.1, 0 missing imports).Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-25T04:14:19Z.
Merge check: the three GPU fixes together keep the suites where
mainhas themNobody can run this from CI, so I did it here:
main940d32fwith #1630, #1832 and #1778 merged into one tree (they touchresource.rs, the descriptor heap and the shader cache, and they do not conflict), then the tests and a boot.mainalonecargo test --workspace --lockedcargo test -p victory-shader --locked --libcargo test -p victory-gpu --features diagnostics --lib32.0.16.2124, session 1The one failure in both columns is
victory-hle::modules::lifecycle::tests::showing_a_title_window_shows_its_stand_in, which fails onmaintoo in a session without a desktop — it is the agent's environment, not the change.The GPU suite gained two tests and four skips because those are the tests the three pull requests add (the ladder's attempts, the typed-UAV rule, the sampler fallback), and some of them skip without a host. That is why the counts differ and why they are written out instead of "all green".
So, for a reviewer deciding whether these can go in together: they do not regress the suites, and together they change what a boot does — which is the only reason to merge them as a set rather than one at a time.
What this check does not cover: it says nothing about the title beyond those 120 seconds, and the run still stops at the terms-of-service screen, which is not a GPU matter. It also does not cover other people's fixes: the cap (#1779) is untouched here and still logs
host view heap capped at 1000000once per run.No game data is involved: test counts and frame numbers.
Written with an AI assistant.
victory configexits nonzero on an asset policy violation #1828Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:18:41Z.
Automated triage for the maintainers.
Needs work.
host_descincrates/victory-gpu/src/resource.rsdropsALLOW_UNORDERED_ACCESSwhentyped_uav(d.format)(Support2typed load/store) is false for the texture's own format. Issues:castable(format), and forB5G5R5A1_UNORM(86) that list includesR16_UINT/R16_FLOAT, which take typed UAVs. With the flag dropped,fitsindescriptor/host.rsrefuses all unordered views of the texture, including those 16-bit aliases. The check needs to consider the castable formats the texture is actually created with.typed_uavalso asks about typeless formats (for example 27 in the test). If a driver reports no typed-UAV support for a typeless format, its textures lose UAV access, even though every UAV view of them is typed. #1787 exempts typeless formats explicitly.CreateUnorderedAccessView(id 342), which #1763 (merge candidate) refuses. A log showing removal at resource creation with #1763 applied would show this is still needed.#1787 overlaps this change. One of the two should carry it forward.
CI:
checkpassing.Generated by Claude Code
victory configexits nonzero on an asset policy violation #1828victory configexits nonzero on an asset policy violation #1828Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T19:35:58Z.
RTX 4060 Laptop (610.47), merged onto main
13f91caewith a reproduction test: B5G5R5A1 UAV half fixed (flag dropped, UAVs null so stores are lost), B4G4R4A4 target half still removes the device; no new failures incargo test -p victory-gpu; also fixes the UAV half on Intel UHD, where main gets no host texture. Details and the side-by-side table with the other #1753 PRs: https://github.com/Marvisak/VIctory/issues/1753#issuecomment-7172510623. Tested with the help of an AI assistant (Claude Code).Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-26T12:18:02Z.
The rule now covers the formats a texture can cast to, and the typeless case with it
All three points are in, in
host_desc(crates/victory-gpu/src/resource.rs), head1a2057a3:uav_of_elementaskstyped_uavacrosscastable(format)and the format itself, and returnsSome(true)on the first that answers yes, so a texture that legal casts to a UAV format keeps its flag — exactly the case the old rule lost.castablereturns them), and the answer is the same for the typeless spelling and its family;a_typeless_format_is_judged_by_the_formats_it_casts_topins that with 27, 24 and 16.CreateTexturerather thanCreateUnorderedAccessView. If #1763 lands first, this change is a guard that never fires and I would rather close it than keep a second way to drop the flag; say so and I will.the_permission_follows_the_whole_elementchecks that 115 and 86 — both two bytes a texel, and castable to each other — get the same answer, which is the property the old unconditional test asserted for one spelling only.CI: passing locally (
cargo test -p victory-gpu --lib -- resource::tests, 20 passed; clippy-D warnings). The pushed branch was rebased onto842b0cb7first, so it no longer carries the stalepc_formatreverts the earlier head had.Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by kalberts0089-hash on 2026-11-27T10:57:45Z.
RTX 4070 Ti (Ada), driver 621.01, Windows 11: tests at head
1a2057aHead
1a2057a3e16e207620d079c22df974f69cf06aa9, which sits directly on currentmain(63bcca4), so it was tested as is with nothing merged or changed locally. No run at this head was in the thread yet.Confirmed
main63bcca41a2057acargo test -p victory-gpu --lib -- --test-threads=1cargo test -p victory-shader --lib --no-fail-fast(one test skipped, below)mainis the two new tests, both passing:a_typeless_format_is_judged_by_the_formats_it_casts_toandthe_permission_follows_the_whole_element. Each also passes 3/3 alone with--exact --nocapture.main, same assertions on both sides, unrelated to this change: victory-gpudynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views; victory-shadera_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zerosandgathers_at_a_level_match_the_hardware.heap_direct_texture_reads_mark_their_heap_indexwas skipped on both sides (#2571).--features diagnostics,VICTORY_D3D12_DEBUG=1):resource::tests::20 passed, including both new tests.What the rule answers on this card
The new tests do not print the host's answers or read the debug layer's queue, so I added a throwaway test locally (not part of the PR, not committed, removed afterwards) that prints them:
typed_uavuav_of_elementhost_descof a 64x64 2D texture withALLOW_UNORDERED_ACCESSB5G5R5A1_UNORMSome(false)Some(true)B4G4R4A4_UNORMSome(false)Some(true)R8G8B8A8_UNORMSome(true)Some(true)R8G8B8A8_UNORM_SRGBSome(false)Some(true)castable(86)is[49, 50, 51, 52, 54, 56, 57, 58, 59, 68, 69, 85, 115], of which 68, 69, 85 and 115 answer no and at least one of the 16-bit formats 49-59 answers yes.uav_of_elementisSome(false)only for 5-8, 70-84, 94-99, 106 and 111-114. Those are the only formats the rule can drop the flag for on this card.log_messages()isNone,GetDeviceRemovedReasonis ok.So at this head, on this card, a
B5G5R5A1_UNORMdescription with unordered access leaveshost_descthe same as onmain: the rule does not fire for it.Questions
1a2057a?GetResourceAllocationInfo, which takes no list of castable formats. Does the debug layer accept "cast to a format that could be used as unordered access" there for a format with no typeless family, when the cast is only possible through the list given at creation? I did not test this.typed_uav(d.format) == Some(false)) and names a test,typed_uav_follows_the_format_not_the_request, that is not in this head. Is it meant to be updated?Not tested
mainor on this head, so this report says nothing about whether the removal is fixed on Ada.host_desc.cargo xtask policy, other crates.Synthetic tests only, no game files. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-28T22:30:47Z.
Thanks — this is the first NVIDIA run at this head, and it answers something the thread only had from the AMD machine.
Your first question: yes, keeping the flag for 86 at this head is intended. The debug layer's own sentence is the rule: a texture with
ALLOW_UNORDERED_ACCESSmust be created with a format that "either can be used as unordered access, or cast to a format that could be used as unordered access".castable(86)includes 68 and 69, which do take a typed UAV on your card, so aB5G5R5A1_UNORMdescription with the flag satisfies the condition — anduav_of_element(86) == Some(true)is that sentence implemented.The earlier run that dropped the flag for 86 was the broader, wrong rule: it asked
typed_uav(d.format)and nothing else, so it took a permission the host can honour. It silenced the removal, which is why it looked like a fix; the narrower rule is the one in the head you tested.Your second question: we supply no cast list, and we are not meant to.
GetResourceAllocationInfotakes a description, and the cast set is a property of the format, which is why the message can name it without any input from us. That is also the reason the rule now asks overcastable(format)instead of over the format alone: it is the same set the driver is going to check.Your third question: the body was stale, and it is fixed — it now describes the rule in this head, names the two tests that exist, and credits your table. Thank you for flagging it; leaving a description that names a test the branch does not have is exactly how a reviewer is misled.
The one thing your report makes clear that the thread still owes: nobody has run the title on Ada at this head. The AMD measurement I posted was at the broader rule, and your run is the rule's answers plus "nothing logged, device fine" — which is necessary but not the same as the removal not happening. If you can run the title on the 4070 Ti with this head and
VICTORY_D3D12_DEBUG=1, the pair (id=599count, device removed or not) is the number that decides whether the narrow rule is enough there. If it turns out the removal recurs with 86's flag kept, the answer is not to go back to the broader rule — it would be to keep the flag only for formats whose element has a typed-UAV cast the driver actually accepts, and that is a different question from the one this PR asks.The detail in your table I would keep an eye on: format 29 (
R8G8B8A8_UNORM_SRGB) answersSome(false)for itself andSome(true)for its element, andhost_descturns it into format 27 with the flag kept. That is the sRGB-to-typless rule interacting with this one, and it is the case most likely to behave differently on another driver family.Written with an AI assistant.
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.