Skip to content

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

Open
Xvania7 wants to merge 4 commits into
Marvisak:mainfrom
Xvania7:fix/issue-850-typeless-view
Open

Xvania7 wants to merge 4 commits into
Marvisak:mainfrom
Xvania7:fix/issue-850-typeless-view

Conversation

@Xvania7

@Xvania7 Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown

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
Xvania7 force-pushed the fix/issue-850-typeless-view branch from 442bd60 to ba95023 Compare November 25, 2026 07:42
@MamaLeVrai

Copy link
Copy Markdown

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.

@Xvania7

Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown
Author

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.

@catminou4 catminou4 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.

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.

clquwu added a commit to clquwu/leonida-ultimate that referenced this pull request Nov 25, 2026
…, D16S8/R16 UAV views, audit defects & Stage 2 device fixes

- Placed texture Map()/Unmap() return va_ directly with xmem page disarm (LEONIDA_LINEAR_MAP_FIRST=1 opt-out) and pre-draw per-frame xs_refresh_placed_textures on first direct ExecuteCommandLists after PresentX (ubiquitarianism/leonida@545e8d51, five-star-recomp@38a8436, GPL-3.0).
- Preserve xbox_d16s8 (118) view formats 118/119/120 in proxy SRV/DSV/placed-view paths; create depth16 UAV plane 0 as R16_TYPELESS and allow R16_UNORM (56) on R16_TYPELESS/118 depth UAVs.
- Fix cc4553c review defects: lock-held arena_release_locked + had_retired retry in arena_allocate_reclaiming; slot 127 depth fallback unconditional clear/castable sanitization; view-flag-agnostic slot 62 copy lookup + richer skip diagnostics.
- Force integer RT blendEnable=VK_FALSE (Marvisak/VIctory#2042, GPL-3.0); off-element placed structured buffer V# + PC RAW fallback (five-star-recomp@955a679, GPL-3.0); console typeless-on-typeless view fallback (Marvisak/VIctory#2190, GPL-3.0) + CBV ring tail zeroing (Marvisak/VIctory#1629, GPL-3.0); refuse MEM_MAPPED in create_host_buffer with LEONIDA_IMPORT_REMAPPABLE=1 opt-out (Neonbridge@838c433, GPL-3.0); AS SRV Location resolution (Marvisak/VIctory#2098, GPL-3.0); 3D R9G9B9E5 RT+UAV RGBA16F view format fix; true placed-texture upload totals telemetry + boot_bench parser.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

@Xvania7

Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown
Author

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 Cutscene picture missing while audio/subtitles render: elimination chain down to descriptor sampling (format, viewport, RTV, depth, upload all excluded) #850:
    In the cutscene rendering pass isolated in Cutscene picture missing while audio/subtitles render: elimination chain down to descriptor sampling (format, viewport, RTV, depth, upload all excluded) #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.

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.

Cutscene picture missing while audio/subtitles render: elimination chain down to descriptor sampling (format, viewport, RTV, depth, upload all excluded)

5 participants