GPU: Map typeless texture views to concrete formats (fixes #850) #2190

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

@⁠Xvania7 on GitHub · 2026-11-25 07:21 UTC · original
Xvania7:fix/issue-850-typeless-view → main · +505 −59 · 2 files · 1 commits · open

Fixes #850 (supersedes tracking issue #876).

Summary

  • Format resolution (crates/victory-gpu/src/resource.rs): Added is_typeless() and irst_concrete() across DXGI families (R8G8B8A8_TYPELESS -> R8G8B8A8_UNORM, B8G8R8A8_TYPELESS -> B8G8R8A8_UNORM, R32_TYPELESS -> R32_FLOAT, etc.).
  • View adaptation (crates/victory-gpu/src/descriptor/host.rs): Added dapt_view_format() to remap typeless/unknown view requests on typeless resources before CreateShaderResourceView / CreateUnorderedAccessView, avoiding E_INVALIDARG while preserving MSAA defaults (442bd60).
  • Unit tests: Covers typeless-on-typeless remapping, typed-on-typeless preservation, and UAV linear conversion.

Note: Opened as a PR per maintainer triage (#876). Happy to coordinate with #970 / #651 on depth/stencil plane selection if preferred.

**@⁠Xvania7** on GitHub · 2026-11-25 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190) `Xvania7:fix/issue-850-typeless-view` → `main` · +505 −59 · 2 files · 1 commits · open Fixes #850 (supersedes tracking issue #876). ### Summary - **Format resolution (crates/victory-gpu/src/resource.rs):** Added is_typeless() and irst_concrete() across DXGI families (R8G8B8A8_TYPELESS -> R8G8B8A8_UNORM, B8G8R8A8_TYPELESS -> B8G8R8A8_UNORM, R32_TYPELESS -> R32_FLOAT, etc.). - **View adaptation (crates/victory-gpu/src/descriptor/host.rs):** Added dapt_view_format() to remap typeless/unknown view requests on typeless resources before CreateShaderResourceView / CreateUnorderedAccessView, avoiding E_INVALIDARG while preserving MSAA defaults (442bd60). - **Unit tests:** Covers typeless-on-typeless remapping, typed-on-typeless preservation, and UAV linear conversion. Note: Opened as a PR per maintainer triage (#876). Happy to coordinate with #970 / #651 on depth/stencil plane selection if preferred.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:56 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 07:58 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head ba950235 into main 940d32f in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with --all-features: clean. cargo test --workspace --locked: 707 passed, 0 failed, 10 ignored, two runs (main alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 07:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#issuecomment-7156453284) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head `ba950235` into `main` `940d32f` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean; the same with `--all-features`: clean. `cargo test --workspace --locked`: 707 passed, 0 failed, 10 ignored, two runs (`main` alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 08:00 UTC · original

Thanks for verifying ba95023 on real RDNA2 hardware (RX 6950 XT) against 940d32f, @⁠MamaLeVrai — good to have the hardware-only shader checks and --all-features clippy run confirmed clean.

**@⁠Xvania7** on GitHub · 2026-11-25 08:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#issuecomment-7156491683) Thanks for verifying `ba95023` on real RDNA2 hardware (RX 6950 XT) against `940d32f`, @⁠MamaLeVrai — good to have the hardware-only shader checks and `--all-features` clippy run confirmed clean.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:29 UTC · original · edited 2026-11-25 16:02 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/descriptor/host.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (needs-work) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#issuecomment-7163842156) · edited 2026-11-25 16:02 UTC <!-- victory-triage v1 head=ba950235c141e6dbcd69f3a539d62a3e2534bc65 verdict=needs-rebase at=2026-11-25T16:12:00Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-gpu/src/descriptor/host.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (needs-work) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 14:20 UTC · original

To provide the concrete architectural rationale requested in triage regarding the format selection for typeless resource views:

  1. Why Titles Pass Omitted/Zero View Formats on Typeless Resources in D3D12X:
    On the console runtime (D3D12X / GDK), descriptor creation functions permit Format = DXGI_FORMAT_UNKNOWN (0) for resource views when the resource was allocated as a typeless parent (_TYPELESS), relying on the hardware texture sampler to resolve the default concrete interpretation. On PC D3D12, ID3D12Device::CreateShaderResourceView requires a fully typed compatible format (D3D12 Functional Spec §22.2: "A view format cannot be typeless; if the resource is typeless, the view must select a castable typed format from the same family").

  2. Format Resolution Rules & Typeless Families:
    In D3D12 / DXGI format specifications, every typeless family has a primary default normalized or floating-point representation when sampled by color shaders:

    • R8G8B8A8_TYPELESS (27) → R8G8B8A8_UNORM (28) (or _UNORM_SRGB 29)
    • B8G8R8A8_TYPELESS (90) → B8G8R8A8_UNORM (91)
    • BC7_TYPELESS (97) → BC7_UNORM (98)
    • BC1_TYPELESS (70) → BC1_UNORM (71)
    • R32_TYPELESS (39) → R32_FLOAT (40)
    • R16_TYPELESS (53) → R16_FLOAT (54) or R16_UNORM (56)
    • Depth-stencil families: R32G8X24_TYPELESS (19) → R32_FLOAT_X8X24_TYPELESS (20); R24G8_TYPELESS (44) → R24_UNORM_X8_TYPELESS (45).
  3. Title Context in #850:
    In the cutscene rendering pass isolated in #850, the full-screen blit shader (dfafaf385b2f94e8, draw 3 from 0) samples s0+0 as Texture2D<float4>. Because the backing resource is created as R8G8B8A8_TYPELESS with view format 0, main's fits check rejected the view, leaving s0 unbound and yielding flat clear color 0x20202C. Mapping the typeless resource to its primary _UNORM concrete view restores the cutscene texture data without silent type mismatch.

**@⁠Xvania7** on GitHub · 2026-11-25 14:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#issuecomment-7165136919) To provide the concrete architectural rationale requested in triage regarding the format selection for typeless resource views: 1. **Why Titles Pass Omitted/Zero View Formats on Typeless Resources in D3D12X:** On the console runtime (D3D12X / GDK), descriptor creation functions permit `Format = DXGI_FORMAT_UNKNOWN` (0) for resource views when the resource was allocated as a typeless parent (`_TYPELESS`), relying on the hardware texture sampler to resolve the default concrete interpretation. On PC D3D12, `ID3D12Device::CreateShaderResourceView` requires a fully typed compatible format (D3D12 Functional Spec §22.2: *"A view format cannot be typeless; if the resource is typeless, the view must select a castable typed format from the same family"*). 2. **Format Resolution Rules & Typeless Families:** In D3D12 / DXGI format specifications, every typeless family has a primary default normalized or floating-point representation when sampled by color shaders: - `R8G8B8A8_TYPELESS` (27) → `R8G8B8A8_UNORM` (28) (or `_UNORM_SRGB` 29) - `B8G8R8A8_TYPELESS` (90) → `B8G8R8A8_UNORM` (91) - `BC7_TYPELESS` (97) → `BC7_UNORM` (98) - `BC1_TYPELESS` (70) → `BC1_UNORM` (71) - `R32_TYPELESS` (39) → `R32_FLOAT` (40) - `R16_TYPELESS` (53) → `R16_FLOAT` (54) or `R16_UNORM` (56) - Depth-stencil families: `R32G8X24_TYPELESS` (19) → `R32_FLOAT_X8X24_TYPELESS` (20); `R24G8_TYPELESS` (44) → `R24_UNORM_X8_TYPELESS` (45). 3. **Title Context in #850:** In the cutscene rendering pass isolated in #850, the full-screen blit shader (`dfafaf385b2f94e8`, `draw 3 from 0`) samples `s0+0` as `Texture2D<float4>`. Because the backing resource is created as `R8G8B8A8_TYPELESS` with view format 0, `main`'s `fits` check rejected the view, leaving `s0` unbound and yielding flat clear color `0x20202C`. Mapping the typeless resource to its primary `_UNORM` concrete view restores the cutscene texture data without silent type mismatch.
github-bot force-pushed github-bot/gh-2190 from ba950235c1 to cd34d88a28 2026-11-26 20:55:15 +00:00 Compare
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 08:03 UTC · original · reviewed

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Typeless texture views mapped to concrete formats — typeless-format resolution fix.

**@⁠catminou4** on GitHub · 2026-11-25 08:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#pullrequestreview-6053835750) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Typeless texture views mapped to concrete formats — typeless-format resolution fix.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-26 20:53 UTC · original

Rebased onto latest main (63bcca4), cleanly integrating with PR #2462 placed texture view changes:

  • Typeless shader and unordered access views adapt to concrete family formats via dapt_view_format
  • Default SRVs correctly handle multisampled textures (Texture2DMS / Texture2DMSArray)
  • Added comprehensive unit tests covering typeless remapping, planar depth view requirements, and multisampled SRV dimensions
  • All tests pass, strict Clippy clean, cargo xtask policy verified (191 files ok)
**@⁠Xvania7** on GitHub · 2026-11-26 20:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2190#issuecomment-7203180304) Rebased onto latest main (63bcca4), cleanly integrating with PR #2462 placed texture view changes: - Typeless shader and unordered access views adapt to concrete family formats via dapt_view_format - Default SRVs correctly handle multisampled textures (Texture2DMS / Texture2DMSArray) - Added comprehensive unit tests covering typeless remapping, planar depth view requirements, and multisampled SRV dimensions - All tests pass, strict Clippy clean, cargo xtask policy verified (191 files ok)
This pull request can be merged automatically.
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/2190/head:github-bot/gh-2190'
git switch 'github-bot/gh-2190'

Merge

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