Skip to content

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

Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/inherit-promoted-attachment-format
Open

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/inherit-promoted-attachment-format

Conversation

@andrewpozdnakov7-jpg

@andrewpozdnakov7-jpg andrewpozdnakov7-jpg commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted with Codex. Synthetic textures on WARP.

@kotekompotek

Copy link
Copy Markdown

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

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

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 13f91ca, 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.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026

Copy link
Copy Markdown
Owner

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

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants