desc: GFX10 format 135 is mapped to DXGI B5G5R5A1, which is 134 (1_5_5_5_UNORM) #946

Closed
opened 2026-11-26 04:37:54 +00:00 by github-bot · 2 comments
Owner

@⁠DTsordas on GitHub · 2026-11-24 09:24 UTC · original

gpu::desc::dxgi_format (crates/xcl/src/gpu/desc.rs:128) maps GFX10 IMG_FORMAT 135 to DXGI_FORMAT_B5G5R5A1_UNORM. In Mesa's register database (src/amd/registers/gfx10-rsrc.json, enum GFX10_FORMAT), 134 is 1_5_5_5_UNORM and 135 is 5_5_5_1_UNORM. src/amd/common/gfx10_format_table.py maps PIPE_FORMAT_B5G5R5A1_UNORM (5-bit x in bits 0–4, 1-bit w in bit 15) to 1_5_5_5, so B5G5R5A1 is 134. 135 keeps its 1-bit field in bit 0, which no DXGI format has. Every other entry of dxgi_format matches Mesa's enum.

Effect on main 077ce40:

  • dxgi_format(134) is None, so image_d3d12 refuses a B5G5R5A1 T#, and a 5_5_5_1 T# is read with B5G5R5A1's layout.
  • gfx10_format(DXGI_FORMAT_B5G5R5A1_UNORM) is 135, the format XCL writes into the T#s of its B5G5R5A1 views.

At runtime only gfx10_format reaches this table, and recompiled shaders classify both codes the same way (img_cls), so I don't expect a change a title can see.

I have a fix with a unit test that fails on main. The full suite passes with it on an RX 9060 XT (debug, cargo test --workspace -- --test-threads=4: 717 passed, 0 failed, 41 ignored, 0 SKIPPED). I'll open the PR once I have the smoke runs on a title.

AI use: found and written up with Claude Code (Claude Opus 5.5), checked against Mesa's source.

**@⁠DTsordas** on GitHub · 2026-11-24 09:24 UTC · [original](https://github.com/xcl-dev/xcl/issues/946) `gpu::desc::dxgi_format` (`crates/xcl/src/gpu/desc.rs:128`) maps GFX10 IMG_FORMAT 135 to `DXGI_FORMAT_B5G5R5A1_UNORM`. In Mesa's register database (`src/amd/registers/gfx10-rsrc.json`, enum `GFX10_FORMAT`), 134 is `1_5_5_5_UNORM` and 135 is `5_5_5_1_UNORM`. `src/amd/common/gfx10_format_table.py` maps `PIPE_FORMAT_B5G5R5A1_UNORM` (5-bit x in bits 0–4, 1-bit w in bit 15) to `1_5_5_5`, so B5G5R5A1 is 134. 135 keeps its 1-bit field in bit 0, which no DXGI format has. Every other entry of `dxgi_format` matches Mesa's enum. Effect on main `077ce40`: - `dxgi_format(134)` is None, so `image_d3d12` refuses a B5G5R5A1 T#, and a 5_5_5_1 T# is read with B5G5R5A1's layout. - `gfx10_format(DXGI_FORMAT_B5G5R5A1_UNORM)` is 135, the format XCL writes into the T#s of its B5G5R5A1 views. At runtime only `gfx10_format` reaches this table, and recompiled shaders classify both codes the same way (`img_cls`), so I don't expect a change a title can see. I have a fix with a unit test that fails on main. The full suite passes with it on an RX 9060 XT (debug, `cargo test --workspace -- --test-threads=4`: 717 passed, 0 failed, 41 ignored, 0 SKIPPED). I'll open the PR once I have the smoke runs on a title. **AI use:** found and written up with Claude Code (Claude Opus 5.5), checked against Mesa's source.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:54 +00:00
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-24 09:58 UTC · original

I confirmed this against Mesa's register database (134 1_5_5_5_UNORM, 135 5_5_5_1_UNORM; the names list the fields from the top bit down) and have the fix with a test (dxgi_format(134) is B5G5R5A1, 135 has none, gfx10_format gives 134). The PR follows once the suite and the regression run are done.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠emirduran707** on GitHub · 2026-11-24 09:58 UTC · [original](https://github.com/xcl-dev/xcl/issues/946#issuecomment-7128133410) I confirmed this against Mesa's register database (134 `1_5_5_5_UNORM`, 135 `5_5_5_1_UNORM`; the names list the fields from the top bit down) and have the fix with a test (`dxgi_format(134)` is B5G5R5A1, 135 has none, `gfx10_format` gives 134). The PR follows once the suite and the regression run are done. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

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

Fixed by #990 (a610eb5): 134 (1_5_5_5) is B5G5R5A1, 135 has no DXGI format, and gfx10_format gives 134.

**@⁠ivall** on GitHub · 2026-11-24 11:04 UTC · [original](https://github.com/xcl-dev/xcl/issues/946#issuecomment-7129620980) Fixed by #990 (a610eb5): 134 (1_5_5_5) is B5G5R5A1, 135 has no DXGI format, and `gfx10_format` gives 134.
This discussion has been locked. Commenting is limited to contributors.
No description provided.