GPU: a render or depth view description with an unknown format names the resource's on a typeless host copy #2279

Open
github-bot wants to merge 1 commit from github-bot/gh-2279 into main AGit
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 09:29 UTC · original
denkencar-sketch:fix/desc-002 → main · +36 −12 · 1 files · 1 commits · open

Summary

A render or depth view description with an unknown format was passed to a typeless host copy with that format, which the host refuses. Only descriptionless views were given the format; a described view with an unknown format now takes the resource's.

Testing

Test an_unknown_format_in_a_view_description_is_the_resources fails without the substitution and passes with this change. cargo test --workspace --locked passes apart from the known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a real typeless depth view, and a run in the game.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 09:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279) `denkencar-sketch:fix/desc-002` → `main` · +36 −12 · 1 files · 1 commits · open ## Summary A render or depth view description with an unknown format was passed to a typeless host copy with that format, which the host refuses. Only descriptionless views were given the format; a described view with an unknown format now takes the resource's. ## Testing Test `an_unknown_format_in_a_view_description_is_the_resources` fails without the substitution and passes with this change. `cargo test --workspace --locked` passes apart from the known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a real typeless depth view, and a run in the game. AI-assisted.
Only descriptionless views were given the title's format; the host refuses
the unknown format of a described one.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:48 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-25 09:37 UTC · original

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.

**@⁠DesertGamer** on GitHub · 2026-11-25 09:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#issuecomment-7158581831) ### 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). :warning: 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.*
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 10:14 UTC · original · edited 2026-11-25 10:22 UTC

I tested the real typeless-depth case called out in the PR. 9b1a21f adds one test directly on 132472838c090346c18b3af5dd1df4c04ba33689.

A guest D32_FLOAT resource creates an R32_TYPELESS host texture. With the main descriptor code from 940d32f69b, the same test receives DXGI_FORMAT_UNKNOWN from the view decoder and stops before creating the DSV. On this PR it receives D32_FLOAT, records a host clear and reads back 0.375 from all 16 depth values on WARP. The full GPU suite on WARP passed with 148 passed and 2 ignored. Strict Clippy in both modes and the repository policy check passed.

Please preserve the test's Git author if you take it. If you fold it into another commit, please add:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted. Synthetic tests only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 10:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#issuecomment-7159427960) · edited 2026-11-25 10:22 UTC I tested the real typeless-depth case called out in the PR. [9b1a21f](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/9b1a21f72c67585131877bfce84ddc1cdc5a0006) adds one test directly on 132472838c090346c18b3af5dd1df4c04ba33689. A guest D32_FLOAT resource creates an R32_TYPELESS host texture. With the main descriptor code from 940d32f69b22265690a0b5a15d6ded572ba33baf, the same test receives DXGI_FORMAT_UNKNOWN from the view decoder and stops before creating the DSV. On this PR it receives D32_FLOAT, records a host clear and reads back 0.375 from all 16 depth values on WARP. The full GPU suite on WARP passed with 148 passed and 2 ignored. Strict Clippy in both modes and the repository policy check passed. Please preserve the test's Git author if you take it. If you fold it into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted. Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:32 UTC · original · edited 2026-11-26 01:22 UTC

Automated triage for the maintainers.

Merge candidate. Rebased; it merges cleanly again. In crates/victory-gpu/src/descriptor.rs, RtvRecord::host_desc now goes through host_words: a view that has a description but names the unknown format (0) gets the format from resource::view_format, just as a view without a description already did. A typeless host copy cannot take an RTV/DSV with an unknown format. Views with a typed host copy, and views that name a format, are unchanged. The new test an_unknown_format_in_a_view_description_is_the_resources covers those cases and the pc_format mapping (118 -> 20).

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#issuecomment-7163930961) · edited 2026-11-26 01:22 UTC <!-- victory-triage v1 head=bda54f776620b7bcbdaf04efaafcba9b9ad20110 verdict=merge-candidate at=2026-11-26T01:22:31Z --> Automated triage for the maintainers. **Merge candidate.** Rebased; it merges cleanly again. In `crates/victory-gpu/src/descriptor.rs`, `RtvRecord::host_desc` now goes through `host_words`: a view that has a description but names the unknown format (0) gets the format from `resource::view_format`, just as a view without a description already did. A typeless host copy cannot take an RTV/DSV with an unknown format. Views with a typed host copy, and views that name a format, are unchanged. The new test `an_unknown_format_in_a_view_description_is_the_resources` covers those cases and the `pc_format` mapping (118 -> 20). CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 09:35 UTC · original · reviewed

A render/depth view description with an unknown format resolves through the typeless host copy's own format (host_words). 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.

**@⁠catminou4** on GitHub · 2026-11-25 09:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#pullrequestreview-6055076068) · **reviewed** A render/depth view description with an unknown format resolves through the typeless host copy's own format (host_words). 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.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 09:42 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib descriptor::tests:: — 6 passed, 0 failed (including an_unknown_format_in_a_view_description_is_the_resources)
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean fallback using the resource's own format when an RTV/DSV description specifies DXGI_FORMAT_UNKNOWN on a typeless host copy. Looks good.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 09:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#pullrequestreview-6055167830) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib descriptor::tests::` — **6 passed, 0 failed** (including `an_unknown_format_in_a_view_description_is_the_resources`) - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean fallback using the resource's own format when an RTV/DSV description specifies `DXGI_FORMAT_UNKNOWN` on a typeless host copy. Looks good. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:27 UTC · original · requested changes

Tested bda54f776620b7bcbdaf04efaafcba9b9ad20110 merged onto origin/main (63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + Microsoft WARP, --features diagnostics with VICTORY_D3D12_DEBUG=1, Rust 1.98.1 MSVC).

The typeless-host cases (typeless D32_FLOAT, D16S8 mapped to 20, R8G8B8A8_UNORM_SRGB with ALLOW_UNORDERED_ACCESS, and shared-memory format aliases) all pass CreateRenderTargetView / CreateDepthStencilView with zero debug-layer errors on both RTX 5090 and WARP.

Blocking Issue: Format = DXGI_FORMAT_UNKNOWN (0) on typed castable colour render targets triggers D3D12 device removal (0x887A0001)

In crates/victory-gpu/src/descriptor.rs:369, RtvRecord::host_desc resolves own via crate::resource::view_format(self.resource), so host_words (L383-385) leaves words[0] == 0 (DXGI_FORMAT_UNKNOWN) whenever the host copy has the same typed format as the title resource (also asserted in L909).

However, crates/victory-gpu/src/resource.rs:1317-1381 (make_texture) creates every non-depth colour texture on ID3D12Device10 through CreatePlacedResource2 / CreateCommittedResource3 with an explicit pCastableFormats list (e.g. DXGI_FORMAT_R8G8B8A8_UNORM has 21 castable formats). In D3D12, passing a non-null D3D12_RENDER_TARGET_VIEW_DESC with Format = DXGI_FORMAT_UNKNOWN (0) for a resource created with a castable format list is illegal and immediately removes the device — even though the host texture's own format is typed (28) and pDesc = NULL (described == 0) succeeds.

Hardware Repro (RTX 5090 & WARP, both default and diagnostics builds)

  1. Create a committed TEXTURE2D with Format = DXGI_FORMAT_R8G8B8A8_UNORM (28) and Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET (1).
  2. Record an RTV via create_rtv with a non-null description [0, 4, 0, 0, 0, 0] (Format = DXGI_FORMAT_UNKNOWN, ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D).
  3. Call host.rtv(&copy.texture, rec.desc().as_ref()) (as draw.rs:430 and list.rs:1025 do).

Observed on both RTX 5090 and WARP:

  • resource::view_format returns None, so rec.desc() returns Some(D3D12_RENDER_TARGET_VIEW_DESC { Format: DXGI_FORMAT(0), ViewDimension: TEXTURE2D, .. }).
  • ID3D12Device::GetDeviceRemovedReason() immediately transitions from Ok(()) to Err(DXGI_ERROR_INVALID_CALL) (0x887A0001).
  • With --features diagnostics and VICTORY_D3D12_DEBUG=1, ID3D12InfoQueue logs:
    • D3D12_MESSAGE_ID(38): ID3D12Device::CreateRenderTargetView: The view format (0, UNKNOWN) was not specified in the list of castable formats. The resource ... was created with an explicit format cast list
    • D3D12_MESSAGE_ID(38): ID3D12Device::CreateRenderTargetView: The Format (0, UNKNOWN) cannot be used, when creating a View of a Texture2D.
    • D3D12_MESSAGE_ID(232): ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...)

Suggested Fix

When self.described != 0 and words[0] == 0, resolve the unknown format to the resource's title format (crate::resource::title_format(self.resource)) before pc_format, while keeping crate::resource::view_format(self.resource) for the self.described == 0 branch so descriptionless views on typed host copies still return None (pDesc = NULL):

let words = self.host_words(dimension, || {
    if self.described == 0 {
        crate::resource::view_format(self.resource)
    } else {
        crate::resource::title_format(self.resource)
    }
})?;

Locally tested this change on both RTX 5090 and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1) across 8 RTV/DSV cases — typed castable R8G8B8A8_UNORM (Format = 0, described = 0, and explicit cast to 29), typed D32_FLOAT (DEPTH | DENY_SHADER_RESOURCE), typeless D32_FLOAT, typeless D16S8 (118 -> 20), typeless R8G8B8A8_UNORM_SRGB (RT | UAV), and a shared-memory alias (29 on a 28 host copy): all 8 pass with GetDeviceRemovedReason() == Ok(()) and 0 debug-layer messages. (Updating the doc comment and unit test at descriptor.rs:909 to reflect resolving unknown formats on castable/typed resources as well would keep the test suite aligned.)

**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2279#pullrequestreview-6079532830) · **requested changes** Tested `bda54f776620b7bcbdaf04efaafcba9b9ad20110` merged onto `origin/main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + Microsoft WARP, `--features diagnostics` with `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1 MSVC). The typeless-host cases (typeless `D32_FLOAT`, `D16S8` mapped to `20`, `R8G8B8A8_UNORM_SRGB` with `ALLOW_UNORDERED_ACCESS`, and shared-memory format aliases) all pass `CreateRenderTargetView` / `CreateDepthStencilView` with zero debug-layer errors on both RTX 5090 and WARP. ### Blocking Issue: `Format = DXGI_FORMAT_UNKNOWN (0)` on typed castable colour render targets triggers D3D12 device removal (`0x887A0001`) In `crates/victory-gpu/src/descriptor.rs:369`, `RtvRecord::host_desc` resolves `own` via `crate::resource::view_format(self.resource)`, so `host_words` (`L383-385`) leaves `words[0] == 0` (`DXGI_FORMAT_UNKNOWN`) whenever the host copy has the same typed format as the title resource (also asserted in `L909`). However, `crates/victory-gpu/src/resource.rs:1317-1381` (`make_texture`) creates every non-depth colour texture on `ID3D12Device10` through `CreatePlacedResource2` / `CreateCommittedResource3` with an explicit `pCastableFormats` list (e.g. `DXGI_FORMAT_R8G8B8A8_UNORM` has 21 castable formats). In D3D12, passing a non-null `D3D12_RENDER_TARGET_VIEW_DESC` with `Format = DXGI_FORMAT_UNKNOWN (0)` for a resource created with a castable format list is illegal and immediately removes the device — even though the host texture's own format is typed (`28`) and `pDesc = NULL` (`described == 0`) succeeds. #### Hardware Repro (RTX 5090 & WARP, both default and diagnostics builds) 1. Create a committed `TEXTURE2D` with `Format = DXGI_FORMAT_R8G8B8A8_UNORM (28)` and `Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET (1)`. 2. Record an RTV via `create_rtv` with a non-null description `[0, 4, 0, 0, 0, 0]` (`Format = DXGI_FORMAT_UNKNOWN`, `ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D`). 3. Call `host.rtv(&copy.texture, rec.desc().as_ref())` (as `draw.rs:430` and `list.rs:1025` do). Observed on both RTX 5090 and WARP: - `resource::view_format` returns `None`, so `rec.desc()` returns `Some(D3D12_RENDER_TARGET_VIEW_DESC { Format: DXGI_FORMAT(0), ViewDimension: TEXTURE2D, .. })`. - `ID3D12Device::GetDeviceRemovedReason()` immediately transitions from `Ok(())` to `Err(DXGI_ERROR_INVALID_CALL)` (`0x887A0001`). - With `--features diagnostics` and `VICTORY_D3D12_DEBUG=1`, `ID3D12InfoQueue` logs: - `D3D12_MESSAGE_ID(38)`: `ID3D12Device::CreateRenderTargetView: The view format (0, UNKNOWN) was not specified in the list of castable formats. The resource ... was created with an explicit format cast list` - `D3D12_MESSAGE_ID(38)`: `ID3D12Device::CreateRenderTargetView: The Format (0, UNKNOWN) cannot be used, when creating a View of a Texture2D.` - `D3D12_MESSAGE_ID(232)`: `ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_INVALID_CALL: ...)` #### Suggested Fix When `self.described != 0` and `words[0] == 0`, resolve the unknown format to the resource's title format (`crate::resource::title_format(self.resource)`) before `pc_format`, while keeping `crate::resource::view_format(self.resource)` for the `self.described == 0` branch so descriptionless views on typed host copies still return `None` (`pDesc = NULL`): ```rust let words = self.host_words(dimension, || { if self.described == 0 { crate::resource::view_format(self.resource) } else { crate::resource::title_format(self.resource) } })?; ``` Locally tested this change on both RTX 5090 and WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`) across 8 RTV/DSV cases — typed castable `R8G8B8A8_UNORM` (`Format = 0`, `described = 0`, and explicit cast to `29`), typed `D32_FLOAT` (`DEPTH | DENY_SHADER_RESOURCE`), typeless `D32_FLOAT`, typeless `D16S8` (`118 -> 20`), typeless `R8G8B8A8_UNORM_SRGB` (`RT | UAV`), and a shared-memory alias (`29` on a `28` host copy): all 8 pass with `GetDeviceRemovedReason() == Ok(())` and 0 debug-layer messages. (Updating the doc comment and unit test at `descriptor.rs:909` to reflect resolving unknown formats on castable/typed resources as well would keep the test suite aligned.)
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/2279/head:github-bot/gh-2279'
git switch 'github-bot/gh-2279'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2279'
git switch 'github-bot/gh-2279'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2279'
git switch 'github-bot/gh-2279'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2279'
git switch 'main'
git merge --squash 'github-bot/gh-2279'
git switch 'main'
git merge --ff-only 'github-bot/gh-2279'
git switch 'main'
git merge 'github-bot/gh-2279'
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!2279
No description provided.