Skip to content

GPU: refuse typed UAVs in unsupported formats regardless of family or castability - #1763

Open
n-romanovich wants to merge 4 commits into
Marvisak:mainfrom
n-romanovich:fix/typed-uav-format-support
Open

n-romanovich wants to merge 4 commits into
Marvisak:mainfrom
n-romanovich:fix/typed-uav-format-support

Conversation

@n-romanovich

@n-romanovich n-romanovich commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #1753
Fixes #1754

Related: #1755, #1758

fits() in crates/victory-gpu/src/descriptor/host.rs previously checked typed_store() only when cast && family(view) != family(own). When a typed UAV used the texture's own format, a default view (view == 0), or a same-family cast (such as B5G5R5A1_UNORM), CreateUnorderedAccessView was still called on formats without D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW, triggering DXGI_ERROR_INVALID_CALL (0x887A0001) on NVIDIA.

  • Always check typed_store() for unordered == true in fits(), including view == 0 and same-family/non-castable targets.
  • Add synthetic unit test unsupported_typed_uav_format_is_refused.

AI-assisted; verified with cargo test -p victory-gpu --locked -- unsupported_typed_uav_format_is_refused and cargo build --release --locked -p victory on Windows 11 / RTX 5060 Ti.

@DesertGamer

Copy link
Copy Markdown

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: Windows-only code (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.

Typed UAVs in unsupported formats are refused regardless of family or castable-ness: unsupported_typed_uav_format_is_refused pins the refusal. This tightens view validation — please confirm the format list matches what the hardware tests cover, since over-refusal breaks titles that worked.

@WillyboPeep

Copy link
Copy Markdown

Tested on an RTX 4090 (Ada, 32-lane waves, driver 621.01), Windows 11 build 26300, 32 GB RAM. 70564ae + this PR (ca168de), cargo build --release --locked -p victory, shader cache and pipeline library warmed first with translate --cache --pipelines (25,669 shaders translated, 316 refused; 26,664 of 28,164 pack pipelines in the library). Title 1.0.2.1, Series X profile, scripted Enter presses.

unsupported_typed_uav_format_is_refused passes on this card.

Build Result
70564ae device removed, DXGI_ERROR_INVALID_CALL (0x887A0001) after a submission of 1 list, 28 s after start, during the boot screens
70564ae + #1763 the format is refused once (an unordered view in a format the host cannot store target=86 own=86); boot, menus and loading run at 30 fps and the world is reached about 76 s after start

So on this card it fixes the #1753 / #1754 removal.

What stops it next, about 13 s into the world: 1.2 then 0.4 fps with 2,587 to 3,013 draws dropped per frame, then slow host submission ms=3041 lists=25 (all compute pipelines), then the device is removed with 0x887A0006 (hung) after that submission of 25 lists. The NVIDIA driver logged two Error occurred on GPUID: 100 events (nvlddmkm 153) at the moment of the hang; there was no display-driver reset (no event 4101). The view heap is capped as in #1760 (host view heap capped at 1000000, title count 1,245,184, no room for the null buffer views, 310,720 title slot past the host heap warnings), so this looks like the world stall that #1760 traces to the capped heap, not something this PR adds.

Run and written up with Claude Code.

@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown

Overlap for the reviewers: #1775 (22:20) and #1780 (22:25) make the same change as this PR (22:09). In descriptor::host::fits, check typed_store for every unordered view, not only one cast to another family, so the B5G5R5A1_UNORM UAV is refused on NVIDIA (#1753 / #1754). This one closes both issues; #1775 closes #1753, #1780 #1754. Only one can merge as is. From reading the three descriptions and file lists (all descriptor/host.rs); nothing built.

AI-assisted (Claude Code).

@Ryanarcx2

Copy link
Copy Markdown

Tested ca168de on an RTX 5070 Ti (driver 32.0.16.1742), Windows 11, after translate --cache --pipelines. On plain 70564ae this machine removes the device 16 to 17 s after start (see #1753).

Run Duration B5G5R5A1 debug messages End
release, no debug layer 2m39s n/a past the account picker; device removed after 7 lists ("GPU will not respond to more commands"), frame rate 0.2 to 0.3 fps beforehand
diag, VICTORY_D3D12_DEBUG=1 7m53s 1 (CreateCommittedResource3 ALLOW_UNORDERED_ACCESS warning, non-fatal) no device removal; the title's own crash handler fired (Breakpad minidump, upload blocked by the net policy)

So the startup INVALID_CALL from #1753 is gone on this card. The later failures look like the existing NVIDIA problems rather than this PR: the diag run still logs 185 CreateComputeShader wave64 refusals and 182 UAV-state "invalid for use as a vertex buffer" messages, and the release run's late removal matches the cutscene hang seen on ffe310e.

One remaining debug-layer note on the same texture: CreateCommittedResource3 also warns that the D3D12_CLEAR_VALUE format is not valid as a render target when ALLOW_RENDER_TARGET is set.

@n-romanovich

Copy link
Copy Markdown
Author

All review feedback has been addressed in dbd4fc2:

  • fits() in crates/victory-gpu/src/descriptor/host.rs does not use a hardcoded format list — typed_store(format) queries ID3D12Device::CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) on the live host device for D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW.
  • sRGB textures with ALLOW_UNORDERED_ACCESS are created typeless on the host in crates/victory-gpu/src/resource.rs, and fits() maps sRGB UAV view formats to their linear counterparts before calling typed_store, so valid sRGB/linear UAVs are not over-refused.
  • Added descriptor::host::tests::supported_typed_uav_formats_are_accepted to pin that supported typed UAV formats (R8G8B8A8_UNORM, R8G8B8A8_UINT, R8G8B8A8_UNORM_SRGB → R8G8B8A8_UNORM, and default/explicit UAVs on R32_UINT and R16G16B16A16_FLOAT) remain accepted while None on typeless is still refused.

Verified on Windows (dbd4fc2):

  • cargo test -p victory-gpu --locked -- descriptor::host::tests::supported_typed_uav_formats_are_accepted descriptor::host::tests::unsupported_typed_uav_format_is_refused — 2 passed, 0 failed.

@AgneyaK

AgneyaK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tested in the title on an RTX 3050 6 GB Laptop (driver 32.0.16.2124, Windows 11 26300): 70564ae + this PR (dbd4fc2, clean merge), diag build, VICTORY_D3D12_DRED=1, local NVIDIA-adapter patch.

  • Plain 70564ae removes the device (0x887A0001) right after frame 128 here.
  • With this PR: no removal in 5 minutes, frames 128 → 4,096 (the menus, about 15 fps). It logged an unordered view in a format the host cannot store target=86 own=86 once.

One run. Details and the comparison with a sampler-heap change: #1754 (comment)

AI use: Claude Code (Claude Opus 5.5) ran the build and wrote this; the results are from the run described.

@alexodee

Copy link
Copy Markdown

Another NVIDIA data point for this problem: RTX 3070 Ti Laptop 8 GB (driver 596.36, 32-lane waves), 16 GB RAM, Windows 11 26300, Series X mode, 70564ae, diag build, shader cache and pipeline library pre-built.

I tested my own local equivalent, not this PR's commit: in descriptor::host::fits, every unordered view whose final format fails typed_store is refused, including a view in the texture's own format.

build runs result
70564ae 6 of 6 device removed, 0x887A0001, about 40 s after start (frame 128 to ~200), before the profile screen was passed
70564ae + that check 7 of 7 no 0x887A0001; menus at 30 fps and the loading art are reached

Some of the runs also had local diagnostics (probes, per-list submission, reserved textures), so this is not a clean A/B beyond the view check itself.

Where the device goes. The debug layer is not installed here, so I checked GetDeviceRemovedReason after every descriptor call. The first failing call is the CreateUnorderedAccessView in make(), View::Unordered:

view:  format 86 (B5G5R5A1_UNORM), TEXTURE2D, mip 0
host:  2560x1440, 1 mip, format 86, flags 0x5 (RENDER_TARGET | UNORDERED_ACCESS)
title: format 86
castable: [49, 50, 51, 52, 54, 56, 57, 58, 59, 68, 69, 85, 115]

So it is the view in the texture's own family that gets past fits(): the existing typed_store check only covers castable views of another family. With the check, the log has one line, an unordered view in a format the host cannot store view=86 own=86, and the run goes on.

What this does not fix: later, as the world loads, this machine still loses the device with 0x887A0006 (one compute list run alone) or 0x887A0007 / 0x8007000E with memory nearly full. Those look like separate problems.

AI use: Claude Code (Claude Opus 5.5) did the diagnosis and wrote this; posted at the request of the person whose machine ran the tests.

zhaibingye added a commit to zhaibingye/VIctory that referenced this pull request Nov 24, 2026
Backport Marvisak#1763 (related to issues Marvisak#1753 and Marvisak#1754). The integrated host.rs is byte-identical to the independently tested PR head. Windows MSVC-target GPU test compilation passed with blake3/pure only in a disposable Linux check. The source PR records one RTX 3050 Laptop Windows 11 menu run with no early removal; no exact target machine run here.
@dragoso

dragoso commented Nov 25, 2026

Copy link
Copy Markdown

I tested this on a Blackwell card, and it clears the boot-time removal reported in #1754 and #1753.

Setup

  • RTX 5060 Ti 16 GB, driver 617.42, Windows 11 26300. DXGI adapter 0 is the 5060 Ti.
  • diag build with VICTORY_D3D12_DRED=1.
  • Shader cache and pipeline library warmed with translate --cache --pipelines on 70564ae.
  • The same scripted Enter presses in both runs.

main 70564ae

This PR (dbd4fc2) on 70564ae

  • No INVALID_CALL. The run gets past frame 128, through the menus and the start screen, and on into loading.
  • About 2 min 20 s in, the device is removed with 0x887A0006 (HUNG), after 16 lists.
  • DRED stops at command 53 of 69 in list 5, a single dispatch between barriers: compute f607780aa8e502d0.
  • Slow submissions before that: 24, median 459 ms, max 5,685 ms. That looks like a separate GPU timeout, not a problem with this change.

The host view heap capped at 1000000 warning (#1760, #1808) appears in both runs.

No retail data, logs or screenshots are attached.

AI-assisted (Claude Code).

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work. Thanks for rebasing; it merges cleanly now. After the rebase, though, the fix itself is no longer in this diff: main already checks typed_store for every typed unordered view in fits() (crates/victory-gpu/src/descriptor/host.rs), merged in #2462 (ea488a9). What this branch still adds are the two tests, unsupported_typed_uav_format_is_refused and supported_typed_uav_formats_are_accepted. main has no test for fits(), so they have value, in particular the sRGB-to-linear mapping and the typeless-without-format refusal.

To make it mergeable as what it now is: retitle it and rewrite the description as tests for fits() (drop "Fixes #1753/#1754", since #2462 fixed those). Otherwise it can be closed as already in main.

CI: passing (check).


Generated by Claude Code

@n-romanovich

Copy link
Copy Markdown
Author

@Marvisak, rebased onto the current main and resolved the conflict in crates/victory-gpu/src/descriptor/host.rs.

…support

# Conflicts:
#	crates/victory-gpu/src/descriptor/host.rs
@R34P3RGit

Copy link
Copy Markdown

Confirmed startup fix on an RTX 5080 (NVIDIA driver 621.40). On unmodified main 13f91ca, the device was removed about 16 seconds after launch, after one submitted list, with DXGI_ERROR_INVALID_CALL (0x887A0001). The D3D12 debug layer reported an unsupported B5G5R5A1_UNORM typed UAV (ID 342), then device removal (ID 232).

With PR #1763 at 73a602b, the process passed the former failure point and stayed alive for a 35-second smoke test, which I ended intentionally. An interactive follow-up also worked past startup. This confirms the immediate NVIDIA startup fix on this setup; later rendering is not yet confirmed. A separate B4G4R4A4_UNORM render-target allocation refusal remains.

@KainanP

KainanP commented Nov 25, 2026

Copy link
Copy Markdown

RTX 4060 Laptop (610.47), merged onto main 13f91ca: B5G5R5A1 UAV half fixed (views refused, both with and without a description), B4G4R4A4 target half still removes the device; no new failures. Also tested together with #2626 (small conflict in fits, resolution in the linked comment): both halves pass. Details and the side-by-side table with the other #1753 PRs: #1753 (comment). Tested with the help of an AI assistant (Claude Code).

…support

# Conflicts:
#	crates/victory-gpu/src/descriptor/host.rs
0xkn0wh3r3 added a commit to 0xkn0wh3r3/VIctory that referenced this pull request Nov 26, 2026
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
…ess of family or castability)

descriptor/host.rs tests: main's image-descriptor size test and Marvisak#1763's
typed-UAV format tests both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
Upstream main merged Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906 and Marvisak#1152 and took up what
Marvisak#1769 (LDS bounds, Marvisak#1949) and Marvisak#1763 (typed UAV formats, Marvisak#2462) did; main's
code is kept for those.
- emit/lower.rs: ds_bpermute within each half (main's Marvisak#573, same as
  Marvisak#439's); LDS bounds as main's Marvisak#1949 (Marvisak#1769's test-only counter kept, its
  and_guard dropped); title-memory marks: main's straddling-write lookup
  (Marvisak#2484) with Marvisak#2167's current head (3cb308d, rebased on 63bcca4): guarded
  dirty atomics, raw_dword2, memory_null, synthetic_mark_dxil in
  lower/mark_tests.rs; the old Marvisak#2167 head taken out first.
- emit/host.rs: main's shared WARP device and lock (Marvisak#244) with Marvisak#439's
  adapter list and Host::on (create_device takes an optional adapter).
- descriptor/host.rs: main's Marvisak#2462 format checks; Marvisak#1763's tests kept.
- gpu host.rs: main's multi-plane present with Marvisak#2310's crumbed copy.
- pipeline.rs: Marvisak#2118/Marvisak#2311's builder and BVH checks with main's skip
  hashes (Marvisak#1320); draw.rs, shadow.rs, main.rs: both sides.
- Tests main added since get Marvisak#439's Parts fields and emit's Target.
- README: base 63bcca4; rows of PRs merged upstream, superseded or closed
  taken out, with a note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
The previous renderer (old upstream base 940d32f) is the first parent and
is also kept as the branch renderer-2026-11-25-oldbase; the second parent
is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with
the renderer stack merged on it: Marvisak#439 (on main: update/439-main's
resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292,
Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small
windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes.
Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by
main: Marvisak#1769, Marvisak#1763, Marvisak#2366.

The picture on this base still shows the overlay that plain upstream main
shows too; that is being looked into.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet