GPU: a texture is made in the uses its format takes #2771

Open
kais7654 wants to merge 2 commits from upstream-pr/2773 into main
kais7654 commented 2026-11-25 20:12:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T20:12:34Z.


Fixes #2725 (group A — 14 of the 20 crashes; may also help #2719's group A).

What

The console makes any texture a render target or unordered storage. The host (D3D12) refuses resources with uses their format cannot take — on NVIDIA the 16-bit packed ones: B4G4R4A4 has no render-target support and neither B4G4R4A4 nor B5G5R5A1 supports typed UAVs. Until now the creation itself (and even a plain GetResourceAllocationInfo of such a description) was an invalid call, which removed the device: the verbose log of #2725 reproduces one of these crashes 13 s after launch.

Now a format's uses come from a cached CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) query, and host_desc leaves the refused uses away before anything reaches the device. The texture is created without them (its shader reads keep working). Host::rtv/Host::dsv report None for a resource its view would not be valid on, and set_targets, ClearRenderTargetView and ClearDepthStencilView leave such a target out, as they already do for a target without a recorded view — a dropped clear instead of a device removal.

On formats that do take their uses (everything else), nothing changes.

Verified on hardware (RTX 5070, driver 616.87)

  • CheckFeatureSupport there: B4G4R4A4 (115) — no RT, no UAV; B5G5R5A1 (86) — RT yes, UAV no — matching the report's debug-layer output.
  • New test a_target_of_a_format_the_device_refuses_the_uses_of_is_made_without_them: the sanitized description agrees with the device's own answer for 86/115/87.
  • cargo clippy --workspace --all-targets --locked -- -D warnings clean (standard and --all-features).
  • cargo test -p victory-gpu --features diagnostics: 200 passed; the 2 failures are the heap-cap pair pre-existing on main on this machine (NVIDIA heap cap, #1943 family), unrelated to this diff.

Not covered: the report's group B (DEVICE_HUNG in a mesh draw) and group C (feature level) are separate causes, and the 1M descriptor-heap cap of #2725's section 2 is its own fix; this PR takes the group that was 14/20 crashes.

AI-assisted: implemented with Mistral Vibe.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6612844308 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T20:12:34Z. --- Fixes #2725 (group A — 14 of the 20 crashes; may also help #2719's group A). ## What The console makes any texture a render target or unordered storage. The host (D3D12) refuses resources with uses their format cannot take — on NVIDIA the 16-bit packed ones: B4G4R4A4 has no render-target support and neither B4G4R4A4 nor B5G5R5A1 supports typed UAVs. Until now the creation itself (and even a plain `GetResourceAllocationInfo` of such a description) was an invalid call, which removed the device: the verbose log of #2725 reproduces one of these crashes 13 s after launch. Now a format's uses come from a cached `CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)` query, and `host_desc` leaves the refused uses away before anything reaches the device. The texture is created without them (its shader reads keep working). `Host::rtv`/`Host::dsv` report `None` for a resource its view would not be valid on, and `set_targets`, `ClearRenderTargetView` and `ClearDepthStencilView` leave such a target out, as they already do for a target without a recorded view — a dropped clear instead of a device removal. On formats that do take their uses (everything else), nothing changes. ## Verified on hardware (RTX 5070, driver 616.87) - `CheckFeatureSupport` there: B4G4R4A4 (115) — no RT, no UAV; B5G5R5A1 (86) — RT yes, UAV no — matching the report's debug-layer output. - New test `a_target_of_a_format_the_device_refuses_the_uses_of_is_made_without_them`: the sanitized description agrees with the device's own answer for 86/115/87. - `cargo clippy --workspace --all-targets --locked -- -D warnings` clean (standard and `--all-features`). - `cargo test -p victory-gpu --features diagnostics`: 200 passed; the 2 failures are the heap-cap pair pre-existing on main on this machine (NVIDIA heap cap, #1943 family), unrelated to this diff. Not covered: the report's group B (DEVICE_HUNG in a mesh draw) and group C (feature level) are separate causes, and the 1M descriptor-heap cap of #2725's section 2 is its own fix; this PR takes the group that was 14/20 crashes. AI-assisted: implemented with Mistral Vibe.
fuzeofficlal commented 2026-11-25 21:03:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T20:27:31Z.


Reviewed and tested 05d444c4 (merged cleanly onto main 13f91ca) on Windows 11 (RTX 5090 + WARP).

Blocking bug confirmed on both RTX 5090 and WARP: format_uses strips RT and UAV flags from all TYPELESS and sRGB + UNORDERED textures

In crates/victory-gpu/src/resource.rs:1131-1150, host_desc first promotes sRGB + UNORDERED formats (29/91/93) to TYPELESS (27/90/92) and then queries format_uses(d.format) via CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT).

In D3D12, D3D12_FEATURE_FORMAT_SUPPORT reports RENDER_TARGET = false and TYPED_UNORDERED_ACCESS_VIEW = false for every TYPELESS format (views on a typeless resource supply the typed format, not the resource format itself). Probed directly on this branch on both RTX 5090 and WARP:

  • format_uses(27 / R8G8B8A8_TYPELESS) -> rt = false, uav = false
  • format_uses(90 / B8G8R8A8_TYPELESS) -> rt = false, uav = false
  • format_uses(92 / B8G8R8X8_TYPELESS) -> rt = false, uav = false
  • Consequently, host_desc returns fmt = 27, flags = 0x0 for both R8G8B8A8_UNORM_SRGB (29) + RENDER_TARGET | UNORDERED and title-created R8G8B8A8_TYPELESS (27) + RENDER_TARGET | UNORDERED, stripping both ALLOW_RENDER_TARGET and ALLOW_UNORDERED_ACCESS.
  • Similarly, for B8G8R8X8_UNORM (88) + RENDER_TARGET | UNORDERED, format_uses(88) strips ALLOW_UNORDERED_ACCESS even when a castable R32_UINT (42) UAV is valid on the resource.

Skipping TYPELESS formats in format_uses (or probing a representative typed format in the family) and preserving UNORDERED for formats castable to UAV-capable formats would avoid stripping legitimate RT/UAV flags.

Verification & merge compatibility

  • RTX 5090 (--features diagnostics): resource::tests 18/18 passed; full --test-threads=1 197 passed, 2 failed (only the 2 pre-existing RTX 5090 >1M heap-cap baselines).
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics --test-threads=1): 199 passed, 0 failed, 1 ignored.
  • cargo clippy (default & diagnostics): 0 warnings; cargo xtask policy: 184 files ok.
  • Merge-tree: clean vs 13f91ca, #2187, #2767 (semantically mutually exclusive with #2767); conflicts with #2679 in resource.rs.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7173700904 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7173700904). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T20:27:31Z. --- Reviewed and tested `05d444c4` (merged cleanly onto `main` `13f91ca`) on Windows 11 (RTX 5090 + WARP). ### Blocking bug confirmed on both RTX 5090 and WARP: `format_uses` strips RT and UAV flags from all `TYPELESS` and `sRGB + UNORDERED` textures In `crates/victory-gpu/src/resource.rs:1131-1150`, `host_desc` first promotes `sRGB + UNORDERED` formats (`29/91/93`) to `TYPELESS` (`27/90/92`) and then queries `format_uses(d.format)` via `CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)`. In D3D12, `D3D12_FEATURE_FORMAT_SUPPORT` reports **`RENDER_TARGET = false` and `TYPED_UNORDERED_ACCESS_VIEW = false` for every `TYPELESS` format** (views on a typeless resource supply the typed format, not the resource format itself). Probed directly on this branch on both RTX 5090 and WARP: - `format_uses(27 / R8G8B8A8_TYPELESS)` -> `rt = false, uav = false` - `format_uses(90 / B8G8R8A8_TYPELESS)` -> `rt = false, uav = false` - `format_uses(92 / B8G8R8X8_TYPELESS)` -> `rt = false, uav = false` - Consequently, `host_desc` returns `fmt = 27, flags = 0x0` for both `R8G8B8A8_UNORM_SRGB (29) + RENDER_TARGET | UNORDERED` and title-created `R8G8B8A8_TYPELESS (27) + RENDER_TARGET | UNORDERED`, stripping **both** `ALLOW_RENDER_TARGET` and `ALLOW_UNORDERED_ACCESS`. - Similarly, for `B8G8R8X8_UNORM (88) + RENDER_TARGET | UNORDERED`, `format_uses(88)` strips `ALLOW_UNORDERED_ACCESS` even when a castable `R32_UINT (42)` UAV is valid on the resource. Skipping `TYPELESS` formats in `format_uses` (or probing a representative typed format in the family) and preserving `UNORDERED` for formats castable to UAV-capable formats would avoid stripping legitimate RT/UAV flags. ### Verification & merge compatibility - **RTX 5090 (`--features diagnostics`)**: `resource::tests` **18/18 passed**; full `--test-threads=1` **197 passed, 2 failed** (only the 2 pre-existing RTX 5090 >1M heap-cap baselines). - **WARP (`VICTORY_D3D12_WARP=1`, `--features diagnostics --test-threads=1`)**: **199 passed, 0 failed, 1 ignored**. - `cargo clippy` (default & `diagnostics`): **0 warnings**; `cargo xtask policy`: **184 files ok**. - Merge-tree: clean vs `13f91ca`, `#2187`, `#2767` (semantically mutually exclusive with `#2767`); conflicts with `#2679` in `resource.rs`.
oni-swr commented 2026-11-25 21:03:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T20:36:14Z.


Independent verification of head 05d444c4 (WARP/CPU): code looks right, but its test cannot catch the bug here.

  • Diff: host_desc drops the render target / unordered use when CheckFeatureSupport says the format cannot take it. Host::rtv and Host::dsv return None for a resource without the flag, and the draw and clear paths skip such targets. This matches the described intent and is in scope. Tests: victory-gpu --lib 196 pass, 0 fail (baseline 195). Clippy -D warnings is clean.
  • Negative control is inconclusive on WARP: with the flag-clearing block in host_desc disabled, a_target_of_a_format_the_device_refuses_the_uses_of_is_made_without_them still passes. The test compares host_desc against the device's own report, and WARP takes all three formats, so it cannot fail there. It only catches the bug on a host that refuses a use, such as the NVIDIA case from #2725. The rtv/dsv None paths have no test at all. A device-free unit test of the None path, or a stubbed support table, would make this verifiable without that GPU.
  • Minor: format_uses caches true, true permanently if host() is not yet available on its first call (!reported), so a later query is not redone.

Method: WARP/CPU only (no physical GPU; VICTORY_WARP=1, VICTORY_D3D12_WARP=1, Windows SDK dxil.dll on PATH, so DXIL validation ran), cargo test -p <crate> --lib --locked and cargo clippy -p <crate> --all-targets --locked -- -D warnings, compared with origin/main 13f91cae. Nothing from the game was used.

AI-assisted review (Claude Code / Claude Sonnet 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173914676 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7173914676). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T20:36:14Z. --- Independent verification of head `05d444c4` (WARP/CPU): **code looks right, but its test cannot catch the bug here**. - Diff: `host_desc` drops the render target / unordered use when `CheckFeatureSupport` says the format cannot take it. `Host::rtv` and `Host::dsv` return `None` for a resource without the flag, and the draw and clear paths skip such targets. This matches the described intent and is in scope. Tests: `victory-gpu --lib` 196 pass, 0 fail (baseline 195). Clippy `-D warnings` is clean. - **Negative control is inconclusive on WARP**: with the flag-clearing block in `host_desc` disabled, `a_target_of_a_format_the_device_refuses_the_uses_of_is_made_without_them` still passes. The test compares `host_desc` against the device's own report, and WARP takes all three formats, so it cannot fail there. It only catches the bug on a host that refuses a use, such as the NVIDIA case from #2725. The `rtv`/`dsv` `None` paths have no test at all. A device-free unit test of the `None` path, or a stubbed support table, would make this verifiable without that GPU. - Minor: `format_uses` caches `true, true` permanently if `host()` is not yet available on its first call (`!reported`), so a later query is not redone. Method: WARP/CPU only (no physical GPU; `VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, Windows SDK `dxil.dll` on PATH, so DXIL validation ran), `cargo test -p <crate> --lib --locked` and `cargo clippy -p <crate> --all-targets --locked -- -D warnings`, compared with `origin/main` 13f91cae. Nothing from the game was used. AI-assisted review (Claude Code / Claude Sonnet 5.5).
kotekompotek commented 2026-11-25 21:03:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T20:38:46Z.


Tightens the right seam: fits() now refuses any unordered view naming a format the device can't store - including the default view case (view==0 on a typed unstorable resource), which the old cast-only guard missed. Complements the creation-side work (making RTV/DSV fallible and skipping untaken uses keeps a dropped view from silently becoming device removal). Layers well with #2442's flag-drop: even where the flag survives, a bad view reads null instead of removing the device.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173976306 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7173976306). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T20:38:46Z. --- Tightens the right seam: fits() now refuses any unordered view naming a format the device can't store - including the default view case (view==0 on a typed unstorable resource), which the old cast-only guard missed. Complements the creation-side work (making RTV/DSV fallible and skipping untaken uses keeps a dropped view from silently becoming device removal). Layers well with #2442's flag-drop: even where the flag survives, a bad view reads null instead of removing the device.
kais7654 commented 2026-11-25 21:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T20:51:05Z.


Reviewed and tested 05d444c4 (merged cleanly onto main 13f91ca) on Windows 11 (RTX 5090 + WARP).

Blocking bug confirmed on both RTX 5090 and WARP: format_uses strips RT and UAV flags from all TYPELESS and sRGB + UNORDERED textures

In crates/victory-gpu/src/resource.rs:1131-1150, host_desc first promotes sRGB + UNORDERED formats (29/91/93) to TYPELESS (27/90/92) and then queries format_uses(d.format) via CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT).

In D3D12, D3D12_FEATURE_FORMAT_SUPPORT reports RENDER_TARGET = false and TYPED_UNORDERED_ACCESS_VIEW = false for every TYPELESS format (views on a typeless resource supply the typed format, not the resource format itself). Probed directly on this branch on both RTX 5090 and WARP:

  • format_uses(27 / R8G8B8A8_TYPELESS) -> rt = false, uav = false
  • format_uses(90 / B8G8R8A8_TYPELESS) -> rt = false, uav = false
  • format_uses(92 / B8G8R8X8_TYPELESS) -> rt = false, uav = false
  • Consequently, host_desc returns fmt = 27, flags = 0x0 for both R8G8B8A8_UNORM_SRGB (29) + RENDER_TARGET | UNORDERED and title-created R8G8B8A8_TYPELESS (27) + RENDER_TARGET | UNORDERED, stripping both ALLOW_RENDER_TARGET and ALLOW_UNORDERED_ACCESS.
  • Similarly, for B8G8R8X8_UNORM (88) + RENDER_TARGET | UNORDERED, format_uses(88) strips ALLOW_UNORDERED_ACCESS even when a castable R32_UINT (42) UAV is valid on the resource.

Skipping TYPELESS formats in format_uses (or probing a representative typed format in the family) and preserving UNORDERED for formats castable to UAV-capable formats would avoid stripping legitimate RT/UAV flags.

Verification & merge compatibility

  • RTX 5090 (--features diagnostics): resource::tests 18/18 passed; full --test-threads=1 197 passed, 2 failed (only the 2 pre-existing RTX 5090 >1M heap-cap baselines).
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics --test-threads=1): 199 passed, 0 failed, 1 ignored.
  • cargo clippy (default & diagnostics): 0 warnings; cargo xtask policy: 184 files ok.
  • Merge-tree: clean vs 13f91ca, #2187, #2767 (semantically mutually exclusive with #2767); conflicts with #2679 in resource.rs.

@fuzeofficlal Fixed in c1fcd74, on both points:

  1. TYPELESS formats take their description's uses instead of the support report's (a typeless format names no view format itself, so the report is false-negative by construction) — the sRGB de-promoted targets keep theirs, and only the render target use is stripped at creation now, for a typed format the device refuses it on (the B4G4R4A4 of #2725). The unordered access use is no longer stripped at all: a creation the device refuses comes back a clean E_INVALIDARG (probed on hardware), and what actually removed the device in #2725 was the view.

  2. So the removal's real spot is guarded where it happens: fits now requires every typed unordered access view to name a format the device stores — own format and formats without a description included, which the old typed_store guard only covered for cross-family casts. A UAV over B5G5R5A1/B4G4R4A4 reads null and drops its writes; a cast to a UAV-capable format (your R32_UINT case over B8G8R8X8) keeps working.

New tests: the sanitized description of 86/115/87 agrees with the device on the render-target use and keeps the unordered one; typeless 27/90/92 and a sRGB promotion keep all uses; typed_store agrees with the device's report. Probed your exact sequences on hardware (RTX 5070, driver 616.87): typeless formats report rt=false/uav=false as you measured, and plain CreateCommittedResource with ALLOW_UNORDERED_ACCESS + B8G8R8X8 returns E_INVALIDARG without device removal. Clippy clean (default and diagnostics), the 2 remaining failures are the pre-existing heap-cap baselines on this machine. Thanks again for the catch.

AI-assisted (Mistral Vibe).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174273479 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7174273479). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T20:51:05Z. --- > Reviewed and tested `05d444c4` (merged cleanly onto `main` `13f91ca`) on Windows 11 (RTX 5090 + WARP). > > ### Blocking bug confirmed on both RTX 5090 and WARP: `format_uses` strips RT and UAV flags from all `TYPELESS` and `sRGB + UNORDERED` textures > In `crates/victory-gpu/src/resource.rs:1131-1150`, `host_desc` first promotes `sRGB + UNORDERED` formats (`29/91/93`) to `TYPELESS` (`27/90/92`) and then queries `format_uses(d.format)` via `CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)`. > > In D3D12, `D3D12_FEATURE_FORMAT_SUPPORT` reports **`RENDER_TARGET = false` and `TYPED_UNORDERED_ACCESS_VIEW = false` for every `TYPELESS` format** (views on a typeless resource supply the typed format, not the resource format itself). Probed directly on this branch on both RTX 5090 and WARP: > > * `format_uses(27 / R8G8B8A8_TYPELESS)` -> `rt = false, uav = false` > * `format_uses(90 / B8G8R8A8_TYPELESS)` -> `rt = false, uav = false` > * `format_uses(92 / B8G8R8X8_TYPELESS)` -> `rt = false, uav = false` > * Consequently, `host_desc` returns `fmt = 27, flags = 0x0` for both `R8G8B8A8_UNORM_SRGB (29) + RENDER_TARGET | UNORDERED` and title-created `R8G8B8A8_TYPELESS (27) + RENDER_TARGET | UNORDERED`, stripping **both** `ALLOW_RENDER_TARGET` and `ALLOW_UNORDERED_ACCESS`. > * Similarly, for `B8G8R8X8_UNORM (88) + RENDER_TARGET | UNORDERED`, `format_uses(88)` strips `ALLOW_UNORDERED_ACCESS` even when a castable `R32_UINT (42)` UAV is valid on the resource. > > Skipping `TYPELESS` formats in `format_uses` (or probing a representative typed format in the family) and preserving `UNORDERED` for formats castable to UAV-capable formats would avoid stripping legitimate RT/UAV flags. > > ### Verification & merge compatibility > * **RTX 5090 (`--features diagnostics`)**: `resource::tests` **18/18 passed**; full `--test-threads=1` **197 passed, 2 failed** (only the 2 pre-existing RTX 5090 >1M heap-cap baselines). > * **WARP (`VICTORY_D3D12_WARP=1`, `--features diagnostics --test-threads=1`)**: **199 passed, 0 failed, 1 ignored**. > * `cargo clippy` (default & `diagnostics`): **0 warnings**; `cargo xtask policy`: **184 files ok**. > * Merge-tree: clean vs `13f91ca`, `#2187`, `#2767` (semantically mutually exclusive with `#2767`); conflicts with `#2679` in `resource.rs`. @fuzeofficlal Fixed in c1fcd74, on both points: 1. TYPELESS formats take their description's uses instead of the support report's (a typeless format names no view format itself, so the report is false-negative by construction) — the sRGB de-promoted targets keep theirs, and only the render target use is stripped at creation now, for a typed format the device refuses it on (the B4G4R4A4 of #2725). The unordered access use is no longer stripped at all: a creation the device refuses comes back a clean `E_INVALIDARG` (probed on hardware), and what actually removed the device in #2725 was the view. 2. So the removal's real spot is guarded where it happens: `fits` now requires every typed unordered access view to name a format the device stores — own format and formats without a description included, which the old `typed_store` guard only covered for cross-family casts. A UAV over B5G5R5A1/B4G4R4A4 reads null and drops its writes; a cast to a UAV-capable format (your R32_UINT case over B8G8R8X8) keeps working. New tests: the sanitized description of 86/115/87 agrees with the device on the render-target use and keeps the unordered one; typeless 27/90/92 and a sRGB promotion keep all uses; `typed_store` agrees with the device's report. Probed your exact sequences on hardware (RTX 5070, driver 616.87): typeless formats report rt=false/uav=false as you measured, and plain `CreateCommittedResource` with `ALLOW_UNORDERED_ACCESS` + B8G8R8X8 returns E_INVALIDARG without device removal. Clippy clean (default and diagnostics), the 2 remaining failures are the pre-existing heap-cap baselines on this machine. Thanks again for the catch. AI-assisted (Mistral Vibe).
kais7654 commented 2026-11-25 21:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T20:52:26Z.


Tightens the right seam: fits() now refuses any unordered view naming a format the device can't store - including the default view case (view==0 on a typed unstorable resource), which the old cast-only guard missed. Complements the creation-side work (making RTV/DSV fallible and skipping untaken uses keeps a dropped view from silently becoming device removal). Layers well with #2442's flag-drop: even where the flag survives, a bad view reads null instead of removing the device.

@kotekompotek Thanks — the seam mattered: the creation side alone would have left a hole either way (keep the flag and the description's own view removes the device; drop the flag and every cast view dies with it), so the guard had to sit on the view. The default-view case (view==0 on a typed unstorable resource) was exactly the one that stayed open until this pass. Layering with #2442's flag-drop is the story of the whole fix: whatever survives the creation ends readable or bounded, never a removal.

AI-assisted (Mistral Vibe).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174304678 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7174304678). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T20:52:26Z. --- > Tightens the right seam: fits() now refuses any unordered view naming a format the device can't store - including the default view case (view==0 on a typed unstorable resource), which the old cast-only guard missed. Complements the creation-side work (making RTV/DSV fallible and skipping untaken uses keeps a dropped view from silently becoming device removal). Layers well with #2442's flag-drop: even where the flag survives, a bad view reads null instead of removing the device. @kotekompotek Thanks — the seam mattered: the creation side alone would have left a hole either way (keep the flag and the description's own view removes the device; drop the flag and every cast view dies with it), so the guard had to sit on the view. The default-view case (view==0 on a typed unstorable resource) was exactly the one that stayed open until this pass. Layering with #2442's flag-drop is the story of the whole fix: whatever survives the creation ends readable or bounded, never a removal. AI-assisted (Mistral Vibe).
fuzeofficlal commented 2026-11-25 22:04:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T21:31:24Z.


Re-verified updated c1fcd742 on Windows 11 (RTX 5090 + WARP, --features diagnostics):

  • The previous TYPELESS (27/90/92) and sRGB + UNORDERED flag-stripping issue is completely resolved: host_desc no longer strips UNORDERED at resource creation, format_takes_render_target preserves all typeless families, and descriptor::host::fits() now blocks unsupported typed-store UAVs on both default (view == 0) and explicit same-/cross-family views without device removal.
  • cargo xtask policy: 184 files ok; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default & --features diagnostics): 0 warnings.
  • RTX 5090 (--features diagnostics, --test-threads=1): 198 passed, 2 failed (only the 2 pre-existing RTX 5090 >1M heap-limit tests dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views), 1 ignored; both new tests pass.
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics, --test-threads=1): 200 passed, 0 failed, 1 ignored.
  • Clean git merge-tree against origin/main 13f91ca (note: overlaps #2679 in resource.rs and descriptor/host.rs).

Non-blocking observations:

  • If format_takes_render_target is first called before host() is available (!reported), true is cached permanently in KNOWN.
  • The Host::rtv/Host::dsv None skip paths do not yet have dedicated unit tests.

Looks solid and ready from my side!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175189601 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7175189601). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T21:31:24Z. --- Re-verified updated `c1fcd742` on Windows 11 (RTX 5090 + WARP, `--features diagnostics`): - The previous `TYPELESS` (`27/90/92`) and `sRGB + UNORDERED` flag-stripping issue is completely resolved: `host_desc` no longer strips `UNORDERED` at resource creation, `format_takes_render_target` preserves all typeless families, and `descriptor::host::fits()` now blocks unsupported typed-store UAVs on both default (`view == 0`) and explicit same-/cross-family views without device removal. - `cargo xtask policy`: 184 files ok; `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default & `--features diagnostics`): 0 warnings. - RTX 5090 (`--features diagnostics`, `--test-threads=1`): 198 passed, 2 failed (only the 2 pre-existing RTX 5090 >1M heap-limit tests `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`), 1 ignored; both new tests pass. - WARP (`VICTORY_D3D12_WARP=1`, `--features diagnostics`, `--test-threads=1`): 200 passed, 0 failed, 1 ignored. - Clean `git merge-tree` against `origin/main` `13f91ca` (note: overlaps #2679 in `resource.rs` and `descriptor/host.rs`). Non-blocking observations: - If `format_takes_render_target` is first called before `host()` is available (`!reported`), `true` is cached permanently in `KNOWN`. - The `Host::rtv`/`Host::dsv` `None` skip paths do not yet have dedicated unit tests. Looks solid and ready from my side!
artor410 commented 2026-11-25 22:04:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-25T21:53:18Z.


Tested on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main 13f91ca. Merged into main cleanly (725d6f4).

  • cargo test -p victory-gpu (main: 193 passed, 2 failed: the known heap-cap pair dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views). With this PR: 195 passed, same 2 failed. New an_unordered_view_names_a_format_the_device_stores and a_target_of_a_format_the_device_refuses_the_use_of_is_made_without_it pass.
  • Probe (temporary test, not committed): 256x256 texture via create_placed with the UAV and/or RT flag, then descriptor::host::make_view(View::Unordered(..)) and Host::rtv(texture, None), then GetDeviceRemovedReason, one process per case. On main: UAV view of 86 or 115 crashes the test process (0xc0000005 inside the driver); RTV of 115 removes the device (0x887A0001); 115 with RT|UAV gets no host texture. CheckFeatureSupport here: 86 RT yes, typed UAV no; 115 RT no, typed UAV no.
  • With this PR: every case safe. 115 loses the RT flag (RTV call no longer removes the device); UAV flag kept on 86/115 but make_view returns no view; 115 with RT|UAV now gets a texture.

Covers both formats and both uses, but by dropping them: draws to a 115 target and UAV writes to 86/115 are lost. #2767 makes the same cases work as R8G8B8A8.

(Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175666510 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7175666510). Originally posted by [artor410](https://github.com/artor410) on 2026-11-25T21:53:18Z. --- Tested on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main 13f91ca. Merged into main cleanly (725d6f4). - `cargo test -p victory-gpu` (main: 193 passed, 2 failed: the known heap-cap pair `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`). With this PR: 195 passed, same 2 failed. New `an_unordered_view_names_a_format_the_device_stores` and `a_target_of_a_format_the_device_refuses_the_use_of_is_made_without_it` pass. - Probe (temporary test, not committed): 256x256 texture via `create_placed` with the UAV and/or RT flag, then `descriptor::host::make_view(View::Unordered(..))` and `Host::rtv(texture, None)`, then `GetDeviceRemovedReason`, one process per case. On main: UAV view of 86 or 115 crashes the test process (0xc0000005 inside the driver); RTV of 115 removes the device (0x887A0001); 115 with RT|UAV gets no host texture. `CheckFeatureSupport` here: 86 RT yes, typed UAV no; 115 RT no, typed UAV no. - With this PR: every case safe. 115 loses the RT flag (RTV call no longer removes the device); UAV flag kept on 86/115 but `make_view` returns no view; 115 with RT|UAV now gets a texture. Covers both formats and both uses, but by dropping them: draws to a 115 target and UAV writes to 86/115 are lost. #2767 makes the same cases work as R8G8B8A8. (Claude Code, Claude Opus 5.5.)
Marvisak commented 2026-11-26 00:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:22:55Z.


Automated triage for the maintainers.

The current head strips the render-target flag in resource::host_desc (via a new format_takes_render_target) for formats the device refuses it on, and makes Host::rtv/Host::dsv return None so draw.rs set_targets and list.rs clear_rtv/clear_dsv skip such targets. A few things before this is mergeable:

  • CI (check) is failing on this head; please look at the job log and fix it.
  • The fits/typed_store guard for unordered views described in the thread is already in main (descriptor/host.rs fits, from #2462); this PR only adds a test for it, so the description should be updated to match what the diff does.
  • format_takes_render_target caches true permanently when host() is not yet available on its first call; it should not record an answer it did not get.
  • This drops draws and clears to a B4G4R4A4 target, while #2767 makes the same cases work by widening to R8G8B8A8_UNORM. Please say how the two relate (complementary or one instead of the other) so a maintainer can choose; the rtv/dsv None paths also have no test.

Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177482289 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7177482289). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:22:55Z. --- <!-- victory-triage v1 head=924ffcfe31c977f6428f5edceb8d991b654605c4 verdict=needs-work at=2026-11-25T23:22:46Z --> Automated triage for the maintainers. The current head strips the render-target flag in `resource::host_desc` (via a new `format_takes_render_target`) for formats the device refuses it on, and makes `Host::rtv`/`Host::dsv` return `None` so `draw.rs` `set_targets` and `list.rs` `clear_rtv`/`clear_dsv` skip such targets. A few things before this is mergeable: - CI (`check`) is failing on this head; please look at the job log and fix it. - The `fits`/`typed_store` guard for unordered views described in the thread is already in `main` (`descriptor/host.rs` `fits`, from #2462); this PR only adds a test for it, so the description should be updated to match what the diff does. - `format_takes_render_target` caches `true` permanently when `host()` is not yet available on its first call; it should not record an answer it did not get. - This drops draws and clears to a B4G4R4A4 target, while #2767 makes the same cases work by widening to R8G8B8A8_UNORM. Please say how the two relate (complementary or one instead of the other) so a maintainer can choose; the `rtv`/`dsv` `None` paths also have no test. --- _Generated by [Claude Code](https://claude.ai/code)_
zed6000 commented 2026-11-26 13:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-26T13:01:24Z.


Merged onto current main 63bcca4 (git merges it without a conflict), victory-gpu's tests don't compile: E0308 mismatched types. This PR makes Host::dsv and Host::rtv return Option<D3D12_CPU_DESCRIPTOR_HANDLE>, and two tests that landed on main since use the old form:

  • crates/victory-gpu/src/pipeline/depth_bounds_test.rs (from #158): let dsv = host.dsv(&depth, None);
  • crates/victory-gpu/src/queue.rs, a test's ClearRenderTargetView(host.rtv(&primary.texture, None), …)

With .expect("a depth buffer takes a depth view") and .expect("a render target takes a target view") on those two calls, it compiles, and cargo test -p victory-gpu --lib --locked -- --test-threads=1 passes on an RX 7900 XTX (233 passed, 0 failed). Tested as part of a run of the GPU tests of open PRs on AMD hardware.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192769072 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2773#issuecomment-7192769072). Originally posted by [zed6000](https://github.com/zed6000) on 2026-11-26T13:01:24Z. --- Merged onto current `main` `63bcca4` (git merges it without a conflict), `victory-gpu`'s tests **don't compile**: `E0308 mismatched types`. This PR makes `Host::dsv` and `Host::rtv` return `Option<D3D12_CPU_DESCRIPTOR_HANDLE>`, and two tests that landed on `main` since use the old form: - `crates/victory-gpu/src/pipeline/depth_bounds_test.rs` (from #158): `let dsv = host.dsv(&depth, None);` - `crates/victory-gpu/src/queue.rs`, a test's `ClearRenderTargetView(host.rtv(&primary.texture, None), …)` With `.expect("a depth buffer takes a depth view")` and `.expect("a render target takes a target view")` on those two calls, it compiles, and `cargo test -p victory-gpu --lib --locked -- --test-threads=1` passes on an RX 7900 XTX (233 passed, 0 failed). Tested as part of a run of the GPU tests of open PRs on AMD hardware.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2773:upstream-pr/2773'
git switch 'upstream-pr/2773'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2773'
git switch 'upstream-pr/2773'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2773'
git switch 'upstream-pr/2773'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2773'
git switch 'main'
git merge --squash 'upstream-pr/2773'
git switch 'main'
git merge --ff-only 'upstream-pr/2773'
git switch 'main'
git merge 'upstream-pr/2773'
git push origin 'main'
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!2771
No description provided.