GPU: a shared texture's allocation size is asked of its own description (NVIDIA device removal) #2284

Merged
Bullet18x merged 1 commit from upstream-pr/2286 into main 2026-11-25 21:56:14 +00:00
Bullet18x commented 2026-11-25 09:48:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bullet18x on 2026-11-25T09:48:59Z.


Problem

Since 13bbd6f ("one host texture per texture memory"), shared_texture() asks GetResourceAllocationInfo for the bytes sharing saved, using the title's description d. That description can ask for uses its format does not take on the host. On NVIDIA it asks for unordered access on B5G5R5A1_UNORM, the query rejects it, and the device is removed a few seconds into the title on every NVIDIA card.

With VICTORY_D3D12_DEBUG=1 (RTX 5090, driver 621.40):

ID3D12Device::GetResourceAllocationInfo: A texture that has D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS set in
D3D12_RESOURCE_DESC::Flags must 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. FeatureLevel is D3D_FEATURE_LEVEL_12_2. D3D12_RESOURCE_DESC::Format is B5G5R5A1_UNORM.

followed by host GPU device removed after a submission of 1 lists ... (0x887A0001 DXGI_ERROR_INVALID_CALL) around frame 32.

Fix

Ask the size of the live texture the description is shared with (t.texture.GetDesc()), as HostTexture::new already does. That is a description the host made a texture from, so the query always accepts it. Only the SAVED statistic reads the result; it now counts the live texture's size, which is the memory the sharing actually saved.

Tested

  • RTX 5090 32 GB, driver 621.40, Windows 11 10.0.28000.
  • Debug-layer run: with this change, that GetResourceAllocationInfo error is gone and the run gets past frame 32 (before, the device was removed there every time).
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • cargo test -p victory-gpu: 141 passed, 2 failed. The 2 (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views) fail the same way on main on this card: NVIDIA's 1,000,000 view-heap cap, which #2177 / #2185 address.

Not covered

B5G5R5A1_UNORM also reaches CreateUnorderedAccessView and render-target creation on NVIDIA. #1780 and #2180 cover those; with them on top of this, the title gets much further on this card. This PR only fixes the statistics query, which main hits first.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6601696258 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2286). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-25T09:48:59Z. --- ## Problem Since 13bbd6f ("one host texture per texture memory"), `shared_texture()` asks `GetResourceAllocationInfo` for the bytes sharing saved, using the **title's** description `d`. That description can ask for uses its format does not take on the host. On NVIDIA it asks for unordered access on `B5G5R5A1_UNORM`, the query rejects it, and the device is removed a few seconds into the title on every NVIDIA card. With `VICTORY_D3D12_DEBUG=1` (RTX 5090, driver 621.40): ``` ID3D12Device::GetResourceAllocationInfo: A texture that has D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS set in D3D12_RESOURCE_DESC::Flags must 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. FeatureLevel is D3D_FEATURE_LEVEL_12_2. D3D12_RESOURCE_DESC::Format is B5G5R5A1_UNORM. ``` followed by `host GPU device removed after a submission of 1 lists ... (0x887A0001 DXGI_ERROR_INVALID_CALL)` around frame 32. ## Fix Ask the size of the live texture the description is shared with (`t.texture.GetDesc()`), as `HostTexture::new` already does. That is a description the host made a texture from, so the query always accepts it. Only the `SAVED` statistic reads the result; it now counts the live texture's size, which is the memory the sharing actually saved. ## Tested - RTX 5090 32 GB, driver 621.40, Windows 11 10.0.28000. - Debug-layer run: with this change, that `GetResourceAllocationInfo` error is gone and the run gets past frame 32 (before, the device was removed there every time). - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. - `cargo test -p victory-gpu`: 141 passed, 2 failed. The 2 (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`) fail the same way on `main` on this card: NVIDIA's 1,000,000 view-heap cap, which #2177 / #2185 address. ## Not covered `B5G5R5A1_UNORM` also reaches `CreateUnorderedAccessView` and render-target creation on NVIDIA. #1780 and #2180 cover those; with them on top of this, the title gets much further on this card. This PR only fixes the statistics query, which `main` hits first. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-25 10:07:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:03:16Z.

Review: APPROVED


Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Querying t.texture.GetDesc() instead of the incoming title d avoids passing host-invalid flag/format combinations (e.g. UAV on B5G5R5A1 on NVIDIA) to GetResourceAllocationInfo and eliminates the raw pointer cast / read_unaligned.
  • cargo test -p victory-gpu resource::: 10/10 passed on RTX 5090, 10/10 passed on WARP.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6055474799 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2286#pullrequestreview-6055474799). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T10:03:16Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Querying `t.texture.GetDesc()` instead of the incoming title `d` avoids passing host-invalid flag/format combinations (e.g. UAV on `B5G5R5A1` on NVIDIA) to `GetResourceAllocationInfo` and eliminates the raw pointer cast / `read_unaligned`. - `cargo test -p victory-gpu resource::`: 10/10 passed on RTX 5090, 10/10 passed on WARP. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 11:04:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:07Z.

Review: COMMENTED


Shared texture allocation size asked of the live texture's own GetDesc() instead of the requested desc (B5G5R5A1 UAV on NVIDIA removed the device). 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. Real device-removal fix, 5 lines.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055711361 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2286#pullrequestreview-6055711361). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:19:07Z. **Review:** COMMENTED --- Shared texture allocation size asked of the live texture's own GetDesc() instead of the requested desc (B5G5R5A1 UAV on NVIDIA removed the device). 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. Real device-removal fix, 5 lines.
Marvisak commented 2026-11-25 14:07:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:33:00Z.


Automated triage for the maintainers.

This is a small, focused fix that may matter a lot. In shared_texture (crates/victory-gpu/src/resource.rs), main sizes the SAVED statistic by calling GetResourceAllocationInfo on the title's description d. That description can ask for unordered access on a format the host cannot take that way (B5G5R5A1 on NVIDIA), and the PR's debug-layer log shows the call failing and the device being removed. The PR queries the live texture's own description instead, and only the statistic reads the result. CI passes. The same line is also fixed inside the much larger open #2212, which uses t.bytes instead, even simpler and with no COM call. That would be a fine one-line change here, but this PR is the cleaner one to merge.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163938319 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2286#issuecomment-7163938319). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:33:00Z. --- <!-- victory-triage v1 head=97df7659b64900ecf3599d1aa88e6eda2566904f verdict=merge-candidate at=2026-11-25T13:47:00Z --> Automated triage for the maintainers. This is a small, focused fix that may matter a lot. In `shared_texture` (`crates/victory-gpu/src/resource.rs`), main sizes the `SAVED` statistic by calling `GetResourceAllocationInfo` on the title's description `d`. That description can ask for unordered access on a format the host cannot take that way (B5G5R5A1 on NVIDIA), and the PR's debug-layer log shows the call failing and the device being removed. The PR queries the live texture's own description instead, and only the statistic reads the result. CI passes. The same line is also fixed inside the much larger open #2212, which uses `t.bytes` instead, even simpler and with no COM call. That would be a fine one-line change here, but this PR is the cleaner one to merge. --- _Generated by [Claude Code](https://claude.ai/code)_
KainanP commented 2026-11-25 20:06:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T19:36:10Z.


RTX 4060 Laptop (610.47), merged onto main 13f91cae: neither half fixed alone (the UAV in 86 and the RTV in 115 still remove the device; without the debug layer the allocation-size query did not remove it here); no new failures. 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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172522712 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2286#issuecomment-7172522712). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T19:36:10Z. --- RTX 4060 Laptop (610.47), merged onto main 13f91cae: neither half fixed alone (the UAV in 86 and the RTV in 115 still remove the device; without the debug layer the allocation-size query did not remove it here); no new failures. 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).
upstream-sync closed this pull request 2026-11-25 22:03:36 +00:00
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2284
No description provided.