D3D12.X: format queries about the console's own formats (116–120) ask about their PC formats #210

Manually merged
github merged 1 commit from gh-pr/210/head into gh-pr/210/base 2026-11-26 04:15:22 +00:00
Owner

@⁠RemingtonWilcox on GitHub · 2026-11-23 21:04 UTC · original
console-depth-format-queries → main · +194 −4 · 3 files · 1 commits · merged 2026-11-23 21:24 UTC

A retail title asks CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) about DXGI_FORMAT_D16_UNORM_S8_UINT (118). The PC has no such format, the answer was "unsupported", and the title stopped on its assertion (+0x14a6390, after the allocation-info assert at +0x344196 had been patched around; #159, #173).

  • CheckFeatureSupport: FORMAT_SUPPORT, MULTISAMPLE_QUALITY_LEVELS, FORMAT_INFO and PLACED_RESOURCE_SUPPORT_INFO about 116–120 ask the PC about device_x::pc_view_format's format (D24_UNORM_S8_UINT for D16S8, R24_UNORM_X8 / X24_G8 for its views, R16G16B16A16_FLOAT for the 7e3/6e4 floats). The caller's format field is put back.
  • XG: R10G10B10_7E3_A2_FLOAT / _6E4_A2_FLOAT (116 / 117) are 32 bits per pixel. Their allocation info is now the console's size, not the PC's half-float one. They stay out of CPU→GPU texture sync, because the PC resource holds them as half floats.

Tests (no game data): the format swap; on the GPU, FORMAT_SUPPORT / MULTISAMPLE_QUALITY_LEVELS / FORMAT_INFO for 118 (and FORMAT_SUPPORT for 116–120) succeed with the PC format's support and keep the caller's format; D16S8's XG planes (HTILE, 2-byte depth, 1-byte stencil); sane allocation sizes for 116–120.

Not yet checked against the console's xg_xs.dll for 116/117 (XCL_SAMPLE_XG). Not yet run with the title.

Full cargo test --workspace on an RTX 3090 (driver 616.92): 577 passed, 0 failed, 39 ignored.

🤖 Generated with Claude Code

**@⁠RemingtonWilcox** on GitHub · 2026-11-23 21:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/210) `console-depth-format-queries` → `main` · +194 −4 · 3 files · 1 commits · merged 2026-11-23 21:24 UTC A retail title asks `CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)` about DXGI_FORMAT_D16_UNORM_S8_UINT (118). The PC has no such format, the answer was "unsupported", and the title stopped on its assertion (`+0x14a6390`, after the allocation-info assert at `+0x344196` had been patched around; #159, #173). - `CheckFeatureSupport`: FORMAT_SUPPORT, MULTISAMPLE_QUALITY_LEVELS, FORMAT_INFO and PLACED_RESOURCE_SUPPORT_INFO about 116–120 ask the PC about `device_x::pc_view_format`'s format (D24_UNORM_S8_UINT for D16S8, R24_UNORM_X8 / X24_G8 for its views, R16G16B16A16_FLOAT for the 7e3/6e4 floats). The caller's format field is put back. - XG: R10G10B10_7E3_A2_FLOAT / _6E4_A2_FLOAT (116 / 117) are 32 bits per pixel. Their allocation info is now the console's size, not the PC's half-float one. They stay out of CPU→GPU texture sync, because the PC resource holds them as half floats. Tests (no game data): the format swap; on the GPU, FORMAT_SUPPORT / MULTISAMPLE_QUALITY_LEVELS / FORMAT_INFO for 118 (and FORMAT_SUPPORT for 116–120) succeed with the PC format's support and keep the caller's format; D16S8's XG planes (HTILE, 2-byte depth, 1-byte stencil); sane allocation sizes for 116–120. Not yet checked against the console's `xg_xs.dll` for 116/117 (`XCL_SAMPLE_XG`). Not yet run with the title. Full `cargo test --workspace` on an RTX 3090 (driver 616.92): 577 passed, 0 failed, 39 ignored. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A retail title asks CheckFeatureSupport(FORMAT_SUPPORT) about D16_UNORM_S8_UINT (118); the
PC has no such format, called it unsupported, and the title stopped on its assertion
(+0x14a6390; #159, #173). FORMAT_SUPPORT, MULTISAMPLE_QUALITY_LEVELS, FORMAT_INFO and
PLACED_RESOURCE_SUPPORT_INFO about 116 – 120 now ask about `pc_view_format`'s format, and
the caller's format field is put back.

XG: R10G10B10_7E3_A2_FLOAT / _6E4_A2_FLOAT (116 / 117) are 32 bits a pixel – allocation info
is the console's size, not the PC's half-float one; they stay out of CPU texture sync (the
PC resource holds half floats).

Tests: the swap; on the GPU, the queries for 118 (and FORMAT_SUPPORT for 116 – 120) succeed
and keep the caller's format; D16S8's XG planes; sane allocation sizes for 116 – 120.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:15:20 +00:00
github manually merged commit 31635bd10f into gh-pr/210/base 2026-11-26 04:15:22 +00:00
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-23 21:11 UTC · original

Independent static code audit of 31635bd10 (code inspection only — cargo test not run on macOS; no game files):

Summary: Looks solid

  • CheckFeatureSupport format translation (real.rs:89-118): All four gated features (FORMAT_SUPPORT, MULTISAMPLE_QUALITY_LEVELS, FORMAT_INFO, PLACED_RESOURCE_SUPPORT_INFO) have DXGI_FORMAT Format at byte offset 0. Swapping to device_x::pc_view_format before check_feature_support_pc works cleanly across both the direct call and the console-struct-size retry path, and the caller's original console format is restored unconditionally even on failing HRESULTs.
  • XG layout & texture sync guard (xg.rs:118, title_textures.rs:79-83): Adding 116 | 117 => (2, 1) matches 32-bit R10G10B10A2 layout, and rejecting 116 | 117 in title_textures::register prevents 32-bit console texels from being uploaded raw into 64-bit PC R16G16B16A16_FLOAT resources.
  • Minor merge note: #211 also edits title_textures.rs:78-82; keeping this PR's 116 | 117 guard above #211's small_target check ensures small 116/117 render targets stay excluded from CPU texture sync.

(AI-assisted)

**@⁠mastrr9** on GitHub · 2026-11-23 21:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/210#issuecomment-7114131263) Independent static code audit of `31635bd10` (code inspection only — `cargo test` not run on macOS; no game files): ### Summary: Looks solid - **`CheckFeatureSupport` format translation (`real.rs:89-118`):** All four gated features (`FORMAT_SUPPORT`, `MULTISAMPLE_QUALITY_LEVELS`, `FORMAT_INFO`, `PLACED_RESOURCE_SUPPORT_INFO`) have `DXGI_FORMAT Format` at byte offset `0`. Swapping to `device_x::pc_view_format` before `check_feature_support_pc` works cleanly across both the direct call and the console-struct-size retry path, and the caller's original console format is restored unconditionally even on failing `HRESULT`s. - **XG layout & texture sync guard (`xg.rs:118`, `title_textures.rs:79-83`):** Adding `116 | 117 => (2, 1)` matches 32-bit `R10G10B10A2` layout, and rejecting `116 | 117` in `title_textures::register` prevents 32-bit console texels from being uploaded raw into 64-bit PC `R16G16B16A16_FLOAT` resources. - **Minor merge note:** #211 also edits `title_textures.rs:78-82`; keeping this PR's `116 | 117` guard *above* #211's `small_target` check ensures small 116/117 render targets stay excluded from CPU texture sync. *(AI-assisted)*
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 21:17 UTC · original

I tested 31635bd merged onto main 6da33fa.

It doesn't merge cleanly. real.rs conflicts because main (#193's srv_tests) and this PR both add a test module at the end of the file. Keeping both resolves it. I tested that local merge, f2b8ffa.

Every query the PR rewrites gives the same answer as asking about the PC format directly. A test-only probe, not part of the PR, compared two calls for each of 116–120:

  • the query about the console format, through check_feature_support_x;
  • the same query about its pc_view_format format, sent straight to the PC device.

The queries covered were:

  • FORMAT_SUPPORT;
  • FORMAT_INFO;
  • MULTISAMPLE_QUALITY_LEVELS at ×1, 2, 4, 8 and 16, with and without the tiled-resource flag;
  • PLACED_RESOURCE_SUPPORT_INFO for a 2D texture on the default, upload and readback heaps.
queries same HRESULT and data caller's format field afterwards
116, 117 → R16G16B16A16_FLOAT 2 × 15 30 116 / 117
118 → D24_UNORM_S8_UINT 15 15 118
119 → R24_UNORM_X8_TYPELESS 15 15 119
120 → X24_TYPELESS_G8_UINT 15 15 120
  • The gap, confirmed on this driver: asked about any of 116–120 as is, FORMAT_SUPPORT returns E_FAIL (0x80004005) with no support bits.
  • Through the console structure-size retry: FORMAT_SUPPORT of 118 with a 16-byte structure gives D24S8's answer (Support1 0x3110b0), and the console's extra 4 bytes are zeroed, as the doc comment says.

Tested

  • Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 26200, Rust 1.99.0 MSVC, debug.
  • Merge f2b8ffa (31635bd onto 6da33fa).
  • CPU tests:
    • console_formats_are_asked_as_the_pcs, d16s8_is_planar_depth_and_stencil, console_floats_are_32_bits and main's a_cube_view_becomes_the_cube_array_of_one_cube: 4/4 pass.
    • the other hle::xg:: and title_textures tests: 3/3 and 3/3 pass.
  • GPU: gpu_console_depth_formats_are_supported and gpu_console_format_allocation_info_is_sane 2/2 pass; the probe agreed on 75 of 75 queries.

Not tested

  • the title;
  • 116/117 sizes against the console's xg_xs.dll;
  • an AMD or Intel GPU;
  • the full workspace suite;
  • the PR head on its own base, 38b05b7 (I tested only the merge).

AI use: Claude Code, Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-23 21:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/210#issuecomment-7114271061) I tested `31635bd` merged onto `main` `6da33fa`. **It doesn't merge cleanly.** `real.rs` conflicts because `main` (#193's `srv_tests`) and this PR both add a test module at the end of the file. Keeping both resolves it. I tested that local merge, `f2b8ffa`. **Every query the PR rewrites gives the same answer as asking about the PC format directly.** A test-only probe, not part of the PR, compared two calls for each of 116–120: - the query about the console format, through `check_feature_support_x`; - the same query about its `pc_view_format` format, sent straight to the PC device. The queries covered were: - FORMAT_SUPPORT; - FORMAT_INFO; - MULTISAMPLE_QUALITY_LEVELS at ×1, 2, 4, 8 and 16, with and without the tiled-resource flag; - PLACED_RESOURCE_SUPPORT_INFO for a 2D texture on the default, upload and readback heaps. | | queries | same HRESULT and data | caller's format field afterwards | |---|---:|---:|---| | 116, 117 → R16G16B16A16_FLOAT | 2 × 15 | 30 | 116 / 117 | | 118 → D24_UNORM_S8_UINT | 15 | 15 | 118 | | 119 → R24_UNORM_X8_TYPELESS | 15 | 15 | 119 | | 120 → X24_TYPELESS_G8_UINT | 15 | 15 | 120 | - **The gap, confirmed on this driver:** asked about any of 116–120 as is, FORMAT_SUPPORT returns `E_FAIL` (0x80004005) with no support bits. - **Through the console structure-size retry:** FORMAT_SUPPORT of 118 with a 16-byte structure gives D24S8's answer (Support1 `0x3110b0`), and the console's extra 4 bytes are zeroed, as the doc comment says. ### Tested - Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 26200, Rust 1.99.0 MSVC, debug. - Merge `f2b8ffa` (`31635bd` onto `6da33fa`). - CPU tests: - `console_formats_are_asked_as_the_pcs`, `d16s8_is_planar_depth_and_stencil`, `console_floats_are_32_bits` and `main`'s `a_cube_view_becomes_the_cube_array_of_one_cube`: 4/4 pass. - the other `hle::xg::` and `title_textures` tests: 3/3 and 3/3 pass. - GPU: `gpu_console_depth_formats_are_supported` and `gpu_console_format_allocation_info_is_sane` 2/2 pass; the probe agreed on 75 of 75 queries. ### Not tested - the title; - 116/117 sizes against the console's `xg_xs.dll`; - an AMD or Intel GPU; - the full workspace suite; - the PR head on its own base, `38b05b7` (I tested only the merge). AI use: Claude Code, Claude Opus 5.5
Author
Owner

@⁠ivall on GitHub · 2026-11-23 21:24 UTC · original

Merged (main d4f17ca). Checked on an RX 9070 (RDNA4) with 11 PRs merged together on main af20b4b: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 605 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed; and the retail game still reaches its first menu at 30 fps (720 draws per 2 s). The merge conflicted with #211 in title_textures::register (your 116 / 117 refusal is kept before #211's small-target check) and with #149's test module in real.rs (both kept).

**@⁠ivall** on GitHub · 2026-11-23 21:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/210#issuecomment-7114415040) Merged (main d4f17ca). Checked on an RX 9070 (RDNA4) with 11 PRs merged together on main af20b4b: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 605 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed; and the retail game still reaches its first menu at 30 fps (720 draws per 2 s). The merge conflicted with #211 in `title_textures::register` (your 116 / 117 refusal is kept before #211's small-target check) and with #149's test module in `real.rs` (both kept).
This discussion has been locked. Commenting is limited to contributors.
No description provided.