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

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 19:58 UTC · original
andrewpozdnakov7-jpg:fix/inherit-promoted-attachment-format → main · +164 −1 · 2 files · 1 commits · open

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 19:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2763) `andrewpozdnakov7-jpg:fix/inherit-promoted-attachment-format` → `main` · +164 −1 · 2 files · 1 commits · open 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://git.gtahub.st/github/Marvisak--VIctory/issues/1633) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:41 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:04 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7173161486) 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.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 20:16 UTC · original

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.

**@⁠oni-swr** on GitHub · 2026-11-25 20:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7173420936) ## 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:20 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 23:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2763#issuecomment-7177423079) <!-- 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)_
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/2763/head:github-bot/gh-2763'
git switch 'github-bot/gh-2763'

Merge

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