GPU: create a texture without a host UAV format without the flag #2319

Open
github-bot wants to merge 2 commits from github-bot/gh-2319 into main AGit
Owner

@⁠Calvix2k on GitHub · 2026-11-25 10:33 UTC · original
Calvix2k:codex/gpu-uav-format-fallback-2307 → main · +63 −1 · 2 files · 2 commits · open

A texture the title creates with D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS in a format the host has no typed UAV for, and with no typeless family to stand in (B5G5R5A1_UNORM, and the console's two-byte formats that pass through as DXGI numbers), removes the device: on a strict driver GetResourceAllocationInfo fails with

D3D12_RESOURCE_DESC::Format is B5G5R5A1_UNORM; a texture that has ALLOW_UNORDERED_ACCESS must be created with a format that ... can be used as unordered access

as reported in #2307 on an RTX 3070 / Windows 10. The title then runs at 30 fps with a black screen.

What the fix does

host_desc drops ALLOW_UNORDERED_ACCESS for exactly those textures — no family to map to, and typed_store says the device cannot make a typed unordered view of the format — and logs a one-time warning naming the format. The texture is created, the title keeps running, and its unordered views are refused later by fits (the view half, #1763). Formats with a family are untouched: the sRGB mapping and the case where the device does store to the type keep the flag.

Verification

  • cargo test -p victory-gpu --features diagnostics --lib on Windows 10 19045 / RX 7800 XT: 146 passed, 1 failed — the known placed-view test on a runtime without ID3D12Device10 (#1999), identical on main; clippy -D warnings clean.
  • New test a_format_without_unordered_access_loses_the_flag covers the drop and the "keeps the flag" arm. On the AMD driver here typed_store reports true for 85/86/115, so the drop arm skips; that is why the device removal is NVIDIA-only in the report. It needs an NVIDIA or WARP run to be exercised for real.
**@⁠Calvix2k** on GitHub · 2026-11-25 10:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319) `Calvix2k:codex/gpu-uav-format-fallback-2307` → `main` · +63 −1 · 2 files · 2 commits · open A texture the title creates with `D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS` in a format the host has no typed UAV for, and with no typeless family to stand in (`B5G5R5A1_UNORM`, and the console's two-byte formats that pass through as DXGI numbers), removes the device: on a strict driver `GetResourceAllocationInfo` fails with ``` D3D12_RESOURCE_DESC::Format is B5G5R5A1_UNORM; a texture that has ALLOW_UNORDERED_ACCESS must be created with a format that ... can be used as unordered access ``` as reported in #2307 on an RTX 3070 / Windows 10. The title then runs at 30 fps with a black screen. ### What the fix does `host_desc` drops `ALLOW_UNORDERED_ACCESS` for exactly those textures — no family to map to, and `typed_store` says the device cannot make a typed unordered view of the format — and logs a one-time warning naming the format. The texture is created, the title keeps running, and its unordered views are refused later by `fits` (the view half, #1763). Formats with a family are untouched: the sRGB mapping and the case where the device does store to the type keep the flag. ### Verification - `cargo test -p victory-gpu --features diagnostics --lib` on Windows 10 19045 / RX 7800 XT: **146 passed, 1 failed** — the known placed-view test on a runtime without `ID3D12Device10` (#1999), identical on `main`; clippy `-D warnings` clean. - New test `a_format_without_unordered_access_loses_the_flag` covers the drop and the "keeps the flag" arm. On the AMD driver here `typed_store` reports true for 85/86/115, so the drop arm skips; that is why the device removal is NVIDIA-only in the report. It needs an NVIDIA or WARP run to be exercised for real.
Part of #2307 (the allocation half; #1763 covers the view half).

A texture the title creates with `D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS` in a format the host has no typed UAV for, and that has no typeless family to stand in (`B5G5R5A1_UNORM`, and the console's two-byte formats that pass through as DXGI numbers), removes the device at `GetResourceAllocationInfo` on a strict driver: "a texture that has ALLOW_UNORDERED_ACCESS must be created with a format that ... can be used as unordered access". `host_desc` now drops the flag for exactly those formats with a one-time warning, so the texture is created and the title keeps running; its unordered views are refused later by `fits` (#1763), instead of the device disappearing.

Formats with a family are untouched: the sRGB case keeps its existing mapping, and a format whose type the device stores to keeps the flag.

## Verification

- `cargo test -p victory-gpu --features diagnostics --lib` on Windows 10 19045 / RX 7800 XT: 146 passed, 1 failed — the known placed-view test on a runtime without `ID3D12Device10` (#1999), identical on `main`; clippy `-D warnings` clean.
- `a_format_without_unordered_access_loses_the_flag` checks the new arm and the "keeps the flag" arm. It skips where the device does report a typed UAV for those formats — this AMD driver does (85, 86, 115 all true here), which is why the removal is NVIDIA-only in the reports; the drop needs an NVIDIA/WARP run to be exercised.
Review feedback on #2319: `family(f) == f` is also true for every typeless
format, so the new drop would have taken `ALLOW_UNORDERED_ACCESS` from sRGB
textures the block above just made typeless (29 -> 27, 91 -> 90, 93 -> 92)
and from typeless UAV textures of the title's own (R32_TYPELESS). Their
unordered views would then be refused by `descriptor::host::fits`, a
regression from `main`.

Use the test `fits` uses for "no family at all": `family(f) == f &&
family(f + 1) != f`. The test now also checks that an sRGB UAV texture (29)
keeps the flag and comes out as its typeless family 27; that assertion runs
before the device-dependent early return, so it is checked on AMD too. Move
the test inside `mod tests` (it sat after the module's closing brace).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:09 +00:00
Author
Owner

@⁠qtLkz on GitHub · 2026-11-25 12:40 UTC · original

Ran the drop arm on NVIDIA, with the output visible: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR on top of main 940d32f.

cargo test -p victory-gpu --lib --locked a_format_without_unordered_access_loses_the_flag -- --nocapture
running 1 test
test resource::a_format_without_unordered_access_loses_the_flag ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 145 filtered out

No this device stores to 86 as a typed UAV; skipped line was printed, so on this card typed_store(86) is false and the test really took the drop arm: format 86 with ALLOW_UNORDERED_ACCESS comes back from host_desc without the flag and still as 86. The "28 keeps the flag" arm ran as well (no assertion failed).

This matters because the test returns early as a pass when the device does report a typed UAV for 86 (as on the RX 7800 XT above), so a bare "1/1 passed" does not by itself show the new arm ran. With --nocapture, the missing skip line does show it.

Same nit as above: the test sits just outside mod tests (its path is resource::a_format_without_unordered_access_loses_the_flag), harmless.

AI-assisted (Claude).

**@⁠qtLkz** on GitHub · 2026-11-25 12:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7162699247) Ran the drop arm on NVIDIA, with the output visible: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR on top of main `940d32f`. ``` cargo test -p victory-gpu --lib --locked a_format_without_unordered_access_loses_the_flag -- --nocapture running 1 test test resource::a_format_without_unordered_access_loses_the_flag ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 145 filtered out ``` No `this device stores to 86 as a typed UAV; skipped` line was printed, so on this card `typed_store(86)` is false and the test really took the drop arm: format 86 with `ALLOW_UNORDERED_ACCESS` comes back from `host_desc` without the flag and still as 86. The "28 keeps the flag" arm ran as well (no assertion failed). This matters because the test returns early as a pass when the device does report a typed UAV for 86 (as on the RX 7800 XT above), so a bare "1/1 passed" does not by itself show the new arm ran. With `--nocapture`, the missing skip line does show it. Same nit as above: the test sits just outside `mod tests` (its path is `resource::a_format_without_unordered_access_loses_the_flag`), harmless. AI-assisted (Claude).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:17 UTC · original · edited 2026-11-25 16:45 UTC

Automated triage for the maintainers.

Merge candidate (worth a look; small). resource.rs host_desc now drops ALLOW_UNORDERED_ACCESS only for a format with no family at all (family(f) == f && family(f + 1) != f, the same test descriptor::host::fits uses) that the host cannot use for typed unordered views (typed_store). This stops the device removal from #2307 for formats such as B5G5R5A1. Typeless heads (sRGB UAV textures turned typeless, R32_TYPELESS) keep the flag, so the gap from the previous review is closed. Their unordered views behave as on main. A refused view on a dropped format is then refused in fits, as the comment says. The test is inside mod tests now, and its sRGB assertion (29 keeps the flag and becomes 27) runs before the device-dependent early return, so it runs on every host. An RTX 4070 Ti run in this thread shows the drop arm executing. CI check: passing. Nit: resource.rs now ends with an extra blank line.

On your reply: confirmed. The condition and the test match what was asked.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7166599752) · edited 2026-11-25 16:45 UTC <!-- victory-triage v1 head=3558858922580cf43af43ab3c3a983af2d85c298 verdict=merge-candidate at=2026-11-25T16:44:54Z --> Automated triage for the maintainers. **Merge candidate (worth a look; small).** `resource.rs` `host_desc` now drops `ALLOW_UNORDERED_ACCESS` only for a format with no family at all (`family(f) == f && family(f + 1) != f`, the same test `descriptor::host::fits` uses) that the host cannot use for typed unordered views (`typed_store`). This stops the device removal from #2307 for formats such as B5G5R5A1. Typeless heads (sRGB UAV textures turned typeless, R32_TYPELESS) keep the flag, so the gap from the previous review is closed. Their unordered views behave as on `main`. A refused view on a dropped format is then refused in `fits`, as the comment says. The test is inside `mod tests` now, and its sRGB assertion (29 keeps the flag and becomes 27) runs before the device-dependent early return, so it runs on every host. An RTX 4070 Ti run in this thread shows the drop arm executing. CI `check`: passing. Nit: `resource.rs` now ends with an extra blank line. On your reply: confirmed. The condition and the test match what was asked. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 16:15 UTC · original

The gap is fixed in 3558858 (rebased onto main 67e8ae1): the drop now needs family(f) == f && family(f + 1) != f, the same "no family at all" test fits uses, so typeless formats (sRGB UAVs turned typeless, R32_TYPELESS) keep ALLOW_UNORDERED_ACCESS and their unordered views stay as on main.

The test also covers that: an sRGB UAV texture (29) keeps the flag and comes out as its typeless family 27. I put that assertion before the device-dependent typed_store(86) early return so it runs on AMD too (here 86 answers true and the B5G5R5A1 half skips). The test is now inside mod tests.

Local: cargo test -p victory-gpu --features diagnostics --lib 146 passed / 2 ignored, plus the known placed-view failure (#1999); clippy -D warnings clean.

**@⁠Calvix2k** on GitHub · 2026-11-25 16:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7167726253) The gap is fixed in `3558858` (rebased onto `main 67e8ae1`): the drop now needs `family(f) == f && family(f + 1) != f`, the same "no family at all" test `fits` uses, so typeless formats (sRGB UAVs turned typeless, R32_TYPELESS) keep `ALLOW_UNORDERED_ACCESS` and their unordered views stay as on `main`. The test also covers that: an sRGB UAV texture (29) keeps the flag and comes out as its typeless family 27. I put that assertion before the device-dependent `typed_store(86)` early return so it runs on AMD too (here 86 answers true and the B5G5R5A1 half skips). The test is now inside `mod tests`. Local: `cargo test -p victory-gpu --features diagnostics --lib` 146 passed / 2 ignored, plus the known placed-view failure (#1999); clippy `-D warnings` clean.
Author
Owner

@⁠davesousa on GitHub · 2026-11-25 19:18 UTC · original

In-game result on NVIDIA: RTX 3070 Ti (Ampere, 8 GB), driver 621.40, Windows 11 26200, 32 GB RAM. Title Series 1.0.2.1. diag build (--features diagnostics), after translate --cache --pipelines. This PR (3558858) merged onto main 13f91ca. On this card, a_format_without_unordered_access_loses_the_flag passes without its skip line, so the drop arm runs.

Build Result
main 13f91ca Host device removed about 35 s after start, during the first-boot screens, in 2 of 2 runs. With VICTORY_D3D12_DEBUG=1, the last messages before RemoveDevice (DXGI_ERROR_INVALID_CALL) are id=599 at GetResourceAllocationInfo (B5G5R5A1_UNORM with ALLOW_UNORDERED_ACCESS) and id=342 (typed UAV of B5G5R5A1_UNORM). This is the same as #2563 on an RTX 3070.
main + #2319 (3558858) No removal at that point. The log shows the PR's warning once (format=86). First-boot, legal and start screens run at 30 fps (33.3 ms/frame) for 6 minutes.

After the start screen, while loading into the world, the + #2319 run ended with a GPU hang: 0x887A0006, after a 10.5 s submission of 34 lists (TDR delay 8 s). The log shows 42 compute pipelines refused by the host before it. That looks like the known NVIDIA world hang (#1968, #2220), not this PR.

Also seen on both builds, unchanged by this PR: view heap capped at 1,000,000 (the title asks for 1,245,184; #1760), and the 2560x1440 format 115 render target refused (#797).

AI-assisted (Claude Code); the runs are on my machine.

**@⁠davesousa** on GitHub · 2026-11-25 19:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7172114334) In-game result on NVIDIA: RTX 3070 Ti (Ampere, 8 GB), driver 621.40, Windows 11 26200, 32 GB RAM. Title Series 1.0.2.1. `diag` build (`--features diagnostics`), after `translate --cache --pipelines`. This PR (`3558858`) merged onto `main` `13f91ca`. On this card, `a_format_without_unordered_access_loses_the_flag` passes without its skip line, so the drop arm runs. | Build | Result | |---|---| | `main` `13f91ca` | Host device removed about 35 s after start, during the first-boot screens, in 2 of 2 runs. With `VICTORY_D3D12_DEBUG=1`, the last messages before `RemoveDevice` (`DXGI_ERROR_INVALID_CALL`) are id=599 at `GetResourceAllocationInfo` (B5G5R5A1_UNORM with `ALLOW_UNORDERED_ACCESS`) and id=342 (typed UAV of B5G5R5A1_UNORM). This is the same as #2563 on an RTX 3070. | | `main` + #2319 (`3558858`) | No removal at that point. The log shows the PR's warning once (`format=86`). First-boot, legal and start screens run at 30 fps (33.3 ms/frame) for 6 minutes. | After the start screen, while loading into the world, the + #2319 run ended with a GPU hang: `0x887A0006`, after a 10.5 s submission of 34 lists (TDR delay 8 s). The log shows 42 compute pipelines refused by the host before it. That looks like the known NVIDIA world hang (#1968, #2220), not this PR. Also seen on both builds, unchanged by this PR: view heap capped at 1,000,000 (the title asks for 1,245,184; #1760), and the 2560x1440 format 115 render target refused (#797). AI-assisted (Claude Code); the runs are on my machine.
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 19:36 UTC · original

RTX 4060 Laptop (610.47), merged onto main 13f91cae: B5G5R5A1 UAV half fixed (flag dropped, UAVs null), B4G4R4A4 target half still removes the device; no new failures in cargo test -p victory-gpu. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).

**@⁠KainanP** on GitHub · 2026-11-25 19:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7172519327) RTX 4060 Laptop (610.47), merged onto main 13f91cae: B5G5R5A1 UAV half **fixed** (flag dropped, UAVs null), B4G4R4A4 target half still removes the device; no new failures in `cargo test -p victory-gpu`. Details and the side-by-side table with the other #1753 PRs: https://git.gtahub.st/github/Marvisak--VIctory/issues/1753. Tested with the help of an AI assistant (Claude Code).
Author
Owner

@⁠qtLkz on GitHub · 2026-11-25 20:30 UTC · original

Re-ran the updated head (3558858) on the same NVIDIA setup: RTX 4070 Ti, driver 621.01, Windows 11 Pro build 26300, merged onto main 13f91ca (clean merge).

cargo test -p victory-gpu --lib --locked a_format_without_unordered_access_loses_the_flag -- --nocapture
test resource::tests::a_format_without_unordered_access_loses_the_flag ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 196 filtered out

Again no "skipped" line, so the drop arm for 86 ran. The new sRGB case (29 keeps the flag as typeless 27) passes too, and the test now sits inside mod tests (path resource::tests::...). Thanks for moving it.

AI-assisted (Claude).

**@⁠qtLkz** on GitHub · 2026-11-25 20:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7173782564) Re-ran the updated head (`3558858`) on the same NVIDIA setup: RTX 4070 Ti, driver 621.01, Windows 11 Pro build 26300, merged onto main `13f91ca` (clean merge). ``` cargo test -p victory-gpu --lib --locked a_format_without_unordered_access_loses_the_flag -- --nocapture test resource::tests::a_format_without_unordered_access_loses_the_flag ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 196 filtered out ``` Again no "skipped" line, so the drop arm for 86 ran. The new sRGB case (29 keeps the flag as typeless 27) passes too, and the test now sits inside `mod tests` (path `resource::tests::...`). Thanks for moving it. AI-assisted (Claude).
Author
Owner

@⁠krcenov on GitHub · 2026-11-25 22:06 UTC · original

Tested this PR at 3558858 on an RTX 3070 (driver 32.0.16.1714), Windows 10 22H2 (19045). The only local change is an Agility SDK 1.620.2 export (D3D12SDKVersion/D3D12SDKPath), which Windows 10 needs; see #2563. It was a diag build with VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1.

  • Fixed: No device removal in a 5-minute run. On 940d32f without a fix, the device was removed at 40–66 s. It held a steady 30 fps on menus and loading screens.
  • Format 86 handled: The B5G5R5A1 texture is created without the unordered flag. The view is then refused instead of removing the device: view the host does not allow unordered=true format=86 flags=1.
  • Still reported, not fatal: The format-115 render target (id=817 / id=599, B4G4R4A4_UNORM) and NumDescriptors 2097152 (id=645).
**@⁠krcenov** on GitHub · 2026-11-25 22:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2319#issuecomment-7175948854) Tested this PR at `3558858` on an RTX 3070 (driver 32.0.16.1714), Windows 10 22H2 (19045). The only local change is an Agility SDK 1.620.2 export (`D3D12SDKVersion`/`D3D12SDKPath`), which Windows 10 needs; see #2563. It was a `diag` build with `VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1`. - **Fixed:** No device removal in a 5-minute run. On `940d32f` without a fix, the device was removed at 40–66 s. It held a steady 30 fps on menus and loading screens. - **Format 86 handled:** The B5G5R5A1 texture is created without the unordered flag. The view is then refused instead of removing the device: `view the host does not allow unordered=true format=86 flags=1`. - **Still reported, not fatal:** The format-115 render target (id=817 / id=599, B4G4R4A4_UNORM) and `NumDescriptors 2097152` (id=645).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2319/head:github-bot/gh-2319'
git switch 'github-bot/gh-2319'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2319'
git switch 'github-bot/gh-2319'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2319'
git switch 'github-bot/gh-2319'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2319'
git switch 'main'
git merge --squash 'github-bot/gh-2319'
git switch 'main'
git merge --ff-only 'github-bot/gh-2319'
git switch 'main'
git merge 'github-bot/gh-2319'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2319
No description provided.