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

Closed
opened 2026-11-24 09:24:00 +00:00 by DTsordas · 2 comments
DTsordas commented 2026-11-24 09:24:00 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by DTsordas on 2026-11-24T09:24:00Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6578627854 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/946). Originally posted by [DTsordas](https://github.com/DTsordas) on 2026-11-24T09:24:00Z. --- `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.
emirduran707 commented 2026-11-24 10:04:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T09:58:10Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7128133410 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/946#issuecomment-7128133410). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T09:58:10Z. --- 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).
ivall commented 2026-11-24 11:06:03 +00:00 (Migrated from github.com)
Author
Contributor

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


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

<!-- greyfinch-sync:ivall/xcl:comment:7129620980 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/946#issuecomment-7129620980). Originally posted by [ivall](https://github.com/ivall) on 2026-11-24T11:04:29Z. --- Fixed by #990 (a610eb5): 134 (1_5_5_5) is B5G5R5A1, 135 has no DXGI format, and `gfx10_format` gives 134.
Sign in to join this conversation.
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#940
No description provided.