D3D12.X: GFX10 image format 134 (1_5_5_5) is B5G5R5A1, not 135 (#946) #984

Merged
emirduran707 merged 1 commit from upstream-pr/990 into main 2026-11-24 11:03:44 +00:00
emirduran707 commented 2026-11-24 10:02:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T10:02:36Z.


gpu::desc::dxgi_format mapped GFX10 image format 135 to DXGI B5G5R5A1. In the GFX10 format enum (Mesa's src/amd/registers/gfx10-rsrc.json, GFX10_FORMAT), 134 is 1_5_5_5_UNORM and 135 is 5_5_5_1_UNORM. The names list the fields from the top bit down (gfx10_format_table.py reverses them into little-endian order), so 1_5_5_5 has x in bits 0–4 and w in bit 15, which is B5G5R5A1. 5_5_5_1 keeps its one-bit field in bit 0, which no DXGI format has. Fixes #946.

As it was:

  • a B5G5R5A1 T# (134) had no DXGI format, so image_d3d12 refused its view;
  • a 5_5_5_1 T# was read with B5G5R5A1's layout;
  • gfx10_format(DXGI_FORMAT_B5G5R5A1_UNORM) gave 135, the format XCL writes into the T#s of its own B5G5R5A1 views.

The tiling size class (133..=136, two bytes) is the same for both codes.

What is in it

  • crates/xcl/src/gpu/desc.rs: 134, not 135, maps to B5G5R5A1.
  • Test packed_formats_reorder_channels, extended: dxgi_format(134) is B5G5R5A1 with the BGRA order, dxgi_format(135) is None, and gfx10_format gives 134. It fails without the change (left: None).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.31044.16; Ryzen 5 5600, 32 GB; Windows 11 Pro 26300; rustc 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug for the suite, release for the runs.
  • cargo test --workspace -- --test-threads=4 at 87fae1f: 724 passed, 0 failed, 41 ignored; no SKIPPED lines.
  • The enum values were checked against Mesa's register database (GFX10_FORMAT: 133 5_6_5_UNORM, 134 1_5_5_5_UNORM, 135 5_5_5_1_UNORM, 136 4_4_4_4_UNORM).

Regression run

The gpu: line names a virtual display adapter of this machine (what #281 / #282 / #285 fix); XCL's log names backend 'real' – AMD Radeon RX 9060 XT (16188 MiB VRAM).

main:

xcl-smoke v1
commit: 9aec53df7004bd9018ef3df67532f85d66ee261c
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1570 (PresentX 1570)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16708 MB

PR:

xcl-smoke v1
commit: 87fae1fa9e1ff5da09445fb8de33d8cbf42033bb
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1589 (PresentX 1589)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17541 MB

Not tested

  • A title that samples a 1_5_5_5 texture: the retail title above does not show whether it uses this format. The run checks only that nothing else changed.
  • NVIDIA.

AI use

  • Claude Code with Claude Opus 5.5: checked the issue against Mesa's sources, and wrote the change, the test and this description. The runs above were made on my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6579290662 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/990). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T10:02:36Z. --- `gpu::desc::dxgi_format` mapped GFX10 image format 135 to DXGI B5G5R5A1. In the GFX10 format enum (Mesa's `src/amd/registers/gfx10-rsrc.json`, `GFX10_FORMAT`), 134 is `1_5_5_5_UNORM` and 135 is `5_5_5_1_UNORM`. The names list the fields from the top bit down (`gfx10_format_table.py` reverses them into little-endian order), so 1_5_5_5 has x in bits 0–4 and w in bit 15, which is B5G5R5A1. 5_5_5_1 keeps its one-bit field in bit 0, which no DXGI format has. Fixes #946. As it was: - a B5G5R5A1 T# (134) had no DXGI format, so `image_d3d12` refused its view; - a 5_5_5_1 T# was read with B5G5R5A1's layout; - `gfx10_format(DXGI_FORMAT_B5G5R5A1_UNORM)` gave 135, the format XCL writes into the T#s of its own B5G5R5A1 views. The tiling size class (`133..=136`, two bytes) is the same for both codes. **What is in it** - `crates/xcl/src/gpu/desc.rs`: 134, not 135, maps to B5G5R5A1. - Test `packed_formats_reorder_channels`, extended: `dxgi_format(134)` is B5G5R5A1 with the BGRA order, `dxgi_format(135)` is None, and `gfx10_format` gives 134. It fails without the change (`left: None`). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.31044.16; Ryzen 5 5600, 32 GB; Windows 11 Pro 26300; rustc 1.100.0 `x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug for the suite, release for the runs. - `cargo test --workspace -- --test-threads=4` at 87fae1f: 724 passed, 0 failed, 41 ignored; no `SKIPPED` lines. - The enum values were checked against Mesa's register database (`GFX10_FORMAT`: 133 `5_6_5_UNORM`, 134 `1_5_5_5_UNORM`, 135 `5_5_5_1_UNORM`, 136 `4_4_4_4_UNORM`). **Regression run** The `gpu:` line names a virtual display adapter of this machine (what #281 / #282 / #285 fix); XCL's log names `backend 'real' – AMD Radeon RX 9060 XT (16188 MiB VRAM)`. main: ``` xcl-smoke v1 commit: 9aec53df7004bd9018ef3df67532f85d66ee261c gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1570 (PresentX 1570) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16708 MB ``` PR: ``` xcl-smoke v1 commit: 87fae1fa9e1ff5da09445fb8de33d8cbf42033bb gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1589 (PresentX 1589) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17541 MB ``` **Not tested** - A title that samples a 1_5_5_5 texture: the retail title above does not show whether it uses this format. The run checks only that nothing else changed. - NVIDIA. **AI use** - Claude Code with Claude Opus 5.5: checked the issue against Mesa's sources, and wrote the change, the test and this description. The runs above were made on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 11:05:18 +00:00
fromthemoonx commented 2026-11-24 11:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-24T10:17:46Z.


NVIDIA run, since Not tested lists NVIDIA.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (32-lane waves), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools (D3D12 debug layer) installed; rustc 1.100.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug
  • Exact head 87fae1fa9e1ff5da09445fb8de33d8cbf42033bb (on its base 9aec53d), clean worktree: cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 724 passed, 0 failed, 41 ignored, the same total as yours. gpu::desc::tests::packed_formats_reorder_channels passed.
  • Fails without the change: with 134 => turned back into 135 => and the test kept, --exact gpu::desc::tests::packed_formats_reorder_channels fails at desc.rs:419 with left: None, right: Some((DXGI_FORMAT(86), [2, 1, 0, 3])).
  • gfx10_format is derived from dxgi_format ((0..=182).find(...)), and nothing else under gpu/ or hle/d3d12x/ hard-codes 135 for this format. So the one line also fixes the T#s XCL writes for its own B5G5R5A1 views.
  • Merged onto current main 6efdabc (no conflict): cargo test --workspace --no-fail-fast -- --test-threads=4: 727 passed, 0 failed, 41 ignored
  • cargo test -p xcl --lib gpu::desc on the merged tree, 10 runs: 10 of 10 passed (11 tests each)
  • D3D12 debug layer: the e2e test title's XCL_D3D12_DEBUG=1 run (test_title_draws_with_a_root_signature_under_the_debug_layer) logs the same set of debug-layer errors and warnings on the merged tree as on main. Nothing new.
  • SKIPPED (no wave64 on this adapter): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
  • XCL_SAMPLE_* not set

Not tested

  • A B5G5R5A1 texture sampled on this GPU through a translated shader: no test here creates one, and there's no retail title here.
  • Release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests on the machine above, including the check without the change, and wrote this report from the logs.
<!-- greyfinch-sync:ivall/xcl:comment:7128582307 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/990#issuecomment-7128582307). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-24T10:17:46Z. --- NVIDIA run, since **Not tested** lists NVIDIA. **Tested** - NVIDIA GeForce RTX 3060 12 GB (32-lane waves), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools (D3D12 debug layer) installed; rustc 1.100.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug - **Exact head `87fae1fa9e1ff5da09445fb8de33d8cbf42033bb`** (on its base `9aec53d`), clean worktree: `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **724 passed, 0 failed, 41 ignored**, the same total as yours. `gpu::desc::tests::packed_formats_reorder_channels` passed. - **Fails without the change:** with `134 =>` turned back into `135 =>` and the test kept, `--exact gpu::desc::tests::packed_formats_reorder_channels` fails at `desc.rs:419` with `left: None, right: Some((DXGI_FORMAT(86), [2, 1, 0, 3]))`. - `gfx10_format` is derived from `dxgi_format` (`(0..=182).find(...)`), and nothing else under `gpu/` or `hle/d3d12x/` hard-codes 135 for this format. So the one line also fixes the T#s XCL writes for its own B5G5R5A1 views. - **Merged onto current `main` `6efdabc`** (no conflict): `cargo test --workspace --no-fail-fast -- --test-threads=4`: **727 passed, 0 failed, 41 ignored** - `cargo test -p xcl --lib gpu::desc` on the merged tree, 10 runs: **10 of 10 passed** (11 tests each) - D3D12 debug layer: the e2e test title's `XCL_D3D12_DEBUG=1` run (`test_title_draws_with_a_root_signature_under_the_debug_layer`) logs the same set of debug-layer errors and warnings on the merged tree as on `main`. Nothing new. - SKIPPED (no wave64 on this adapter): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` - `XCL_SAMPLE_*` not set **Not tested** - A B5G5R5A1 texture sampled on this GPU through a translated shader: no test here creates one, and there's no retail title here. - Release build. **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests on the machine above, including the check without the change, and wrote this report from the logs.
dcastell1 commented 2026-11-24 11:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T10:21:56Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@02bfd1d (baseline 727 passed, 0 failed, 41 ignored on this box; the head of this PR is based on 9aec53d, which is why the base is stated):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
727 passed; 0 failed; 41 ignored   (exit 0)

Same count as the baseline — the format-134 (1_5_5_5) change is exercised by existing coverage and nothing regresses.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7128676799 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/990#issuecomment-7128676799). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T10:21:56Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@02bfd1d` (baseline **727 passed, 0 failed, 41 ignored** on this box; the head of this PR is based on `9aec53d`, which is why the base is stated): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 727 passed; 0 failed; 41 ignored (exit 0) ``` Same count as the baseline — the format-134 (1_5_5_5) change is exercised by existing coverage and nothing regresses. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
raylitebull commented 2026-11-24 11:05:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:39:54Z.


Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (Build and test + PR description). Minimal +7/-1 fix mapping GFX10 image format 134 (1_5_5_5) to B5G5R5A1 instead of 135 (#946). Recommend merging, @ivall.

<!-- greyfinch-sync:ivall/xcl:comment:7129081455 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/990#issuecomment-7129081455). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:39:54Z. --- Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (`Build and test` + `PR description`). Minimal `+7/-1` fix mapping GFX10 image format 134 (`1_5_5_5`) to `B5G5R5A1` instead of 135 (#946). Recommend merging, @ivall.
ivall commented 2026-11-24 11:06:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T11:04:29Z.


Merged in a610eb5 – thanks, and thanks to @fromthemoonx and @dcastell1 for the checks (the test fails with 135 again). Tested on the merged batch (#990, #1037, #951, #1016): cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored, no SKIPPED. Retail title, 90 s with scripted presses, against main before the batch the same way: exit 0, no crash, no device removal, 1500 frames, peak process commit 27.7 GB against 29.2 GB.

<!-- greyfinch-sync:ivall/xcl:comment:7129620598 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/990#issuecomment-7129620598). Originally posted by [ivall](https://github.com/ivall) on 2026-11-24T11:04:29Z. --- Merged in a610eb5 – thanks, and thanks to @fromthemoonx and @dcastell1 for the checks (the test fails with 135 again). **Tested** on the merged batch (#990, #1037, #951, #1016): `cargo test --workspace --no-fail-fast -- --test-threads=4`: 741 passed, 0 failed, 41 ignored, no SKIPPED. Retail title, 90 s with scripted presses, against `main` before the batch the same way: exit 0, no crash, no device removal, 1500 frames, peak process commit 27.7 GB against 29.2 GB.
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!984
No description provided.