GPU: inherit typed formats in explicit RTV and DSV descriptions #2761

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2763 into main
andrewpozdnakov7-jpg commented 2026-11-25 19:58:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T19:58:41Z.


An explicit RTV or DSV may set DXGI_FORMAT_UNKNOWN to inherit the resource format. VIctory forwarded UNKNOWN even when the guest resource was typed and its host texture was typeless. Fill in the guest format when recording the view. The requested dimension, slice, mip and depth flags are preserved. RTV specification · DSV specification

  • On 13f91ca, both regression tests encounter UNKNOWN before submission, where the attachment needs R8G8B8A8_UNORM_SRGB or D32_FLOAT.
  • On 6cdae0e, the guest clear and copy return blue [0, 0, 255, 255] from the unselected slice and sRGB red [137, 0, 0, 255] from the selected slice. Both promoted and ordinary typed sRGB targets pass. The depth descriptor keeps mip 1 and READ_ONLY_DEPTH while taking D32_FLOAT.
  • Six paired WARP runs for each test across both debug settings. The serial GPU suite passed 200 tests with one ignored in each setting. Strict GPU Clippy in both feature configurations and asset policy passed.

The combined tree 64cb4bf (this branch, #1406 at 822d637 and its offered default-RTV test f25c81d) passed 20 resource tests and the serial WARP suite with 203 passing and one ignored under each D3D12 debug setting.

Refs #1242

Coordination claim

Please retain the Git author on cherry-pick or rebase. If you fold the fix or tests into another commit, please add the following trailer.

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

AI-assisted with Codex. Synthetic textures on WARP.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6612602544 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T19:58:41Z. --- An explicit RTV or DSV may set DXGI_FORMAT_UNKNOWN to inherit the resource format. VIctory forwarded UNKNOWN even when the guest resource was typed and its host texture was typeless. Fill in the guest format when recording the view. The requested dimension, slice, mip and depth flags are preserved. [RTV specification](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_render_target_view_desc) · [DSV specification](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_depth_stencil_view_desc) - On 13f91ca, both regression tests encounter UNKNOWN before submission, where the attachment needs R8G8B8A8_UNORM_SRGB or D32_FLOAT. - On 6cdae0e, the guest clear and copy return blue [0, 0, 255, 255] from the unselected slice and sRGB red [137, 0, 0, 255] from the selected slice. Both promoted and ordinary typed sRGB targets pass. The depth descriptor keeps mip 1 and READ_ONLY_DEPTH while taking D32_FLOAT. - Six paired WARP runs for each test across both debug settings. The serial GPU suite passed 200 tests with one ignored in each setting. Strict GPU Clippy in both feature configurations and asset policy passed. The combined tree 64cb4bf (this branch, #1406 at 822d637 and its offered default-RTV test f25c81d) passed 20 resource tests and the serial WARP suite with 203 passing and one ignored under each D3D12 debug setting. Refs #1242 [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7172933986) Please retain the Git author on cherry-pick or rebase. If you fold the fix or tests into another commit, please add the following trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex. Synthetic textures on WARP.
kotekompotek commented 2026-11-25 20:06:27 +00:00 (Migrated from github.com)

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


Correct fix: DXGI_FORMAT_UNKNOWN must resolve to the guest's format before the view is recorded, since the host texture may be typeless (UNKNOWN would then be an invalid view). Naming 29 directly on a typeless-27 texture is legal - sRGB variants sit in the same typeless family - and preserves sRGB semantics rather than silently linearizing via 28. Test clears through both explicit and inherited views on both flag paths.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173161486 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7173161486). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T20:04:48Z. --- Correct fix: DXGI_FORMAT_UNKNOWN must resolve to the *guest's* format before the view is recorded, since the host texture may be typeless (UNKNOWN would then be an invalid view). Naming 29 directly on a typeless-27 texture is legal - sRGB variants sit in the same typeless family - and preserves sRGB semantics rather than silently linearizing via 28. Test clears through both explicit and inherited views on both flag paths.
oni-swr commented 2026-11-25 21:03:04 +00:00 (Migrated from github.com)

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


Independent WARP verification: PR head 6cdae0e

Environment: Windows 11, rustc/cargo 1.98.1, debug build, VICTORY_WARP=1 VICTORY_D3D12_WARP=1 (Microsoft WARP only, no physical GPU), Windows SDK 10.0.26100.0 dxil.dll 1.8.2502.11 on PATH. Tested the PR head itself (single commit directly on origin/main 13f91caee2, so identical to the merge tree). All commands cargo ... --locked.

Baseline on origin/main: test -p victory-gpu --lib: 195 passed, 0 failed, 1 ignored. --features diagnostics: 1 failure, memory::tests::a_submission_that_missed_leaves_the_copies_at_once (memory.rs:886), pre-existing and flaky on main (failed 3 of 4 repeated full runs, passes alone). clippy --all-targets --features diagnostics -D warnings: clean.

On this PR:

  • test -p victory-gpu --lib: 197 passed, 0 failed, 1 ignored (+2 new tests).
  • test -p victory-gpu --lib --features diagnostics: 200 passed, 0 failed, 1 ignored (the flaky baseline test happened to pass in this run).
  • clippy --locked -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.
  • Negative control: restored descriptor.rs from origin/main (production fix removed, tests kept): rtv_unknown_format_inherits_the_typed_resource_format fails (host format 27 = typeless, recorded format 0, expected 29), then restored the PR file. dsv_unknown_format_... is coverage only (no production change for DSV), so it has no negative control.

Review: create_rtv now resolves DXGI_FORMAT_UNKNOWN in an explicit description to the guest resource's format, only when a description was passed and the format word is 0. Behaviour for null descriptions is unchanged. I found no correctness problems. The test covers typeless (UAV-promoted) and non-promoted hosts and checks the cleared texels per array slice. Minor: if title_format returns None (null resource) it falls back to 0, same as before.

Not tested: a physical GPU, any retail title or game behavior, a release build, non-Windows targets.

AI disclosure: this verification was run by Claude Code (Claude Sonnet 5.5). No game files, dumps, shader names or retail hashes were used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173420936 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7173420936). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T20:16:11Z. --- ## Independent WARP verification: PR head `6cdae0e` **Environment:** Windows 11, rustc/cargo 1.98.1, debug build, `VICTORY_WARP=1 VICTORY_D3D12_WARP=1` (Microsoft WARP only, no physical GPU), Windows SDK 10.0.26100.0 `dxil.dll` 1.8.2502.11 on `PATH`. Tested the PR head itself (single commit directly on `origin/main` 13f91caee25f2fdf2c062be5f7a27f058e51cbca, so identical to the merge tree). All commands `cargo ... --locked`. **Baseline on origin/main:** `test -p victory-gpu --lib`: 195 passed, 0 failed, 1 ignored. `--features diagnostics`: 1 failure, `memory::tests::a_submission_that_missed_leaves_the_copies_at_once` (`memory.rs:886`), pre-existing and flaky on main (failed 3 of 4 repeated full runs, passes alone). `clippy --all-targets --features diagnostics -D warnings`: clean. **On this PR:** - `test -p victory-gpu --lib`: 197 passed, 0 failed, 1 ignored (+2 new tests). - `test -p victory-gpu --lib --features diagnostics`: 200 passed, 0 failed, 1 ignored (the flaky baseline test happened to pass in this run). - `clippy --locked -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. - **Negative control:** restored `descriptor.rs` from origin/main (production fix removed, tests kept): `rtv_unknown_format_inherits_the_typed_resource_format` fails (`host format 27` = typeless, recorded format 0, expected 29), then restored the PR file. `dsv_unknown_format_...` is coverage only (no production change for DSV), so it has no negative control. **Review:** `create_rtv` now resolves `DXGI_FORMAT_UNKNOWN` in an explicit description to the guest resource's format, only when a description was passed and the format word is 0. Behaviour for null descriptions is unchanged. I found no correctness problems. The test covers typeless (UAV-promoted) and non-promoted hosts and checks the cleared texels per array slice. Minor: if `title_format` returns `None` (null resource) it falls back to 0, same as before. **Not tested:** a physical GPU, any retail title or game behavior, a release build, non-Windows targets. AI disclosure: this verification was run by Claude Code (Claude Sonnet 5.5). No game files, dumps, shader names or retail hashes were used.
Marvisak commented 2026-11-26 00:03:24 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

In crates/victory-gpu/src/descriptor.rs (create_rtv, which create_dsv also goes through), an explicit view description with DXGI_FORMAT_UNKNOWN now gets the guest resource's format recorded, so RtvRecord::host_desc no longer hands UNKNOWN to the host when the host texture was made typeless (sRGB with unordered access, shader-read depth). This follows the documented D3D12 rule that UNKNOWN means the resource's format; I checked that nothing else reads the recorded format word as UNKNOWN, that null descriptions are unchanged, and that it complements rather than overlaps #1406 (null descriptions). The two tests in resource.rs cover the promoted and plain sRGB cases and the depth view's mip/flags. CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177423079 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7177423079). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:20:10Z. --- <!-- victory-triage v1 head=6cdae0ec0d66324429da792b6194a842fb2983f1 verdict=merge-candidate at=2026-11-25T23:20:03Z --> Automated triage for the maintainers. In `crates/victory-gpu/src/descriptor.rs` (`create_rtv`, which `create_dsv` also goes through), an explicit view description with `DXGI_FORMAT_UNKNOWN` now gets the guest resource's format recorded, so `RtvRecord::host_desc` no longer hands UNKNOWN to the host when the host texture was made typeless (sRGB with unordered access, shader-read depth). This follows the documented D3D12 rule that UNKNOWN means the resource's format; I checked that nothing else reads the recorded format word as UNKNOWN, that null descriptions are unchanged, and that it complements rather than overlaps #1406 (null descriptions). The two tests in `resource.rs` cover the promoted and plain sRGB cases and the depth view's mip/flags. CI (`check`) passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 01:03:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:30:38Z.

Review: COMMENTED


Verified head 6cdae0ec cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).

Code Review

  • Resolving explicit DXGI_FORMAT_UNKNOWN (words[0] == 0) in create_rtv (shared with create_dsv) via crate::resource::title_format(resource) cleanly inherits the guest typed format while preserving dimension, array/mip slices, and DSV flags, letting RtvRecord::host_desc() map through pc_format cleanly even when the host backing resource is typeless (sRGB or depth).

Local Verification (VICTORY_D3D12_DEBUG=1)

  • RTX 5090 & WARP (--features diagnostics): descriptor::tests + draw::tests + resource::tests: 47/47 passed on both adapters (including rtv_unknown_format_inherits_the_typed_resource_format and dsv_unknown_format_inherits_depth_and_keeps_its_subresource).
  • WARP (full victory-gpu --features diagnostics --lib): 248/248 passed (1 ignored).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) & cargo xtask policy (191 files ok): clean.

Looks clean and ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066925909 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763#pullrequestreview-6066925909). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:30:38Z. **Review:** COMMENTED --- Verified head `6cdae0ec` cleanly merged onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + `VICTORY_D3D12_DEBUG=1`). ### Code Review - Resolving explicit `DXGI_FORMAT_UNKNOWN` (`words[0] == 0`) in `create_rtv` (shared with `create_dsv`) via `crate::resource::title_format(resource)` cleanly inherits the guest typed format while preserving `dimension`, array/mip slices, and DSV flags, letting `RtvRecord::host_desc()` map through `pc_format` cleanly even when the host backing resource is typeless (sRGB or depth). ### Local Verification (`VICTORY_D3D12_DEBUG=1`) - **RTX 5090 & WARP (`--features diagnostics`)**: `descriptor::tests` + `draw::tests` + `resource::tests`: **47/47 passed** on both adapters (including `rtv_unknown_format_inherits_the_typed_resource_format` and `dsv_unknown_format_inherits_depth_and_keeps_its_subresource`). - **WARP (full `victory-gpu --features diagnostics --lib`)**: **248/248 passed** (1 ignored). - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) & `cargo xtask policy` (`191 files ok`): clean. Looks clean and ready to merge.
Dukestar69 commented 2026-11-26 05:03:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:10:01Z.

Review: APPROVED


Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-gpu --lib resource::tests: 20 passed, 0 failed (including new rtv_unknown_format_inherits_the_typed_resource_format and dsv_unknown_format_inherits_depth_and_keeps_its_subresource).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6068434745 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2763#pullrequestreview-6068434745). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T04:10:01Z. **Review:** APPROVED --- Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-gpu --lib resource::tests`: **20 passed, 0 failed** (including new `rtv_unknown_format_inherits_the_typed_resource_format` and `dsv_unknown_format_inherits_depth_and_keeps_its_subresource`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/2763:upstream-pr/2763'
git switch 'upstream-pr/2763'

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