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

Merged
RemingtonWilcox merged 1 commit from upstream-pr/210 into main 2026-11-23 21:24:02 +00:00
RemingtonWilcox commented 2026-11-23 21:04:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RemingtonWilcox on 2026-11-23T21:04:52Z.


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

<!-- greyfinch-sync:ivall/xcl:issue:6568807566 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/210). Originally posted by [RemingtonWilcox](https://github.com/RemingtonWilcox) on 2026-11-23T21:04:52Z. --- 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)
upstream-sync closed this pull request 2026-11-24 06:57:40 +00:00
ethandepstein-del commented 2026-11-24 07:04:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-23T21:11:39Z.


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)

<!-- greyfinch-sync:ivall/xcl:comment:7114131263 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/210#issuecomment-7114131263). Originally posted by [ethandepstein-del](https://github.com/ethandepstein-del) on 2026-11-23T21:11:39Z. --- 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)*
Kalmarv commented 2026-11-24 07:04:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-23T21:17:54Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7114271061 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/210#issuecomment-7114271061). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-23T21:17:54Z. --- 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
ivall commented 2026-11-24 07:04:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T21:24:17Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7114415040 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/210#issuecomment-7114415040). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T21:24:17Z. --- 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).
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!207
No description provided.