shader: lower unsigned 16-bit pair vertex fetches (BUF_FMT_16_16_UINT) #2313

Manually merged
github merged 1 commit from gh-pr/2313/head into gh-pr/2313/base 2026-11-27 00:14:55 +00:00
Owner

@⁠denn0x on GitHub · 2026-11-25 11:56 UTC · original
denn0x:startup/tbuffer-16-16-uint → main · +10 −1 · 3 files · 1 commits · merged 2026-11-25 12:15 UTC

What

tbuffer_load_format_* with gfx10 format 27 was refused as an unknown buffer format in tools/startup/gfx2hlsl.py. LLVM 15 defines the format as BUF_DATA_FORMAT_16_16 with BUF_NUM_FORMAT_UINT (ufmt).

It now reads two unsigned 16-bit fields through ldu(), the low half into X. Z = 0 and W = 1, like the other integer rows. Only the tbuffer table row is added. The DXGI stream-layout mapping is unchanged.

Test

tests/startup_vertex_fetch_formats_check.py gains the format and three mutated translations:

  • a normalized low half;
  • the high half read from the low half;
  • a missing W read as 1.0.

The format uses stride 6 and offset 2, so half of the 16 elements cross a dword.

python -B tests/startup_vertex_fetch_formats_check.py controls
vertex fetch format controls passed
python -B tests/startup_vertex_fetch_formats_check.py <dxc> out/build/<dir>/offscreen_check.exe warp
warp: 14 buffer formats, 16 vertices each, every wrong reference and 15 mutations fail
python -B tests/startup_vertex_fetch_formats_check.py <dxc> out/build/<dir>/offscreen_check.exe hardware
hardware: 14 buffer formats, 16 vertices each, every wrong reference and 15 mutations fail

These are the commands behind startup_vertex_fetch_formats_(controls|warp|hardware).

On main, controls fails with gfx2hlsl.Unsupported: buffer format BUF_FMT_16_16_UINT.

Environment

  • Hardware: AMD Radeon RX 9070 XT, driver 32.0.32015.7029, the first adapter in high-performance order.
  • Software: WARP, Windows 10.0.26300.9974, DXC 1.8.2502.11 (Windows SDK 10.0.26100). The SDK debug layers are installed.
  • Build: all builds (Ninja Release, MSVC Build Tools 18).
  • Skips: none.

Other checks: startup_stream_fetch_check.py, startup_gfx2hlsl_tbuffer_16f_check.py and docs_links_check.py pass.

docs/experiments.md lists the new format and the device result.

Refs #2023 (item G)

**@⁠denn0x** on GitHub · 2026-11-25 11:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2313) `denn0x:startup/tbuffer-16-16-uint` → `main` · +10 −1 · 3 files · 1 commits · merged 2026-11-25 12:15 UTC ## What `tbuffer_load_format_*` with gfx10 format 27 was refused as an unknown buffer format in `tools/startup/gfx2hlsl.py`. LLVM 15 defines the format as `BUF_DATA_FORMAT_16_16` with `BUF_NUM_FORMAT_UINT` ([ufmt](https://releases.llvm.org/15.0.0/docs/AMDGPUModifierSyntax.html#ufmt)). It now reads two unsigned 16-bit fields through `ldu()`, the low half into X. Z = 0 and W = 1, like the other integer rows. Only the tbuffer table row is added. The DXGI stream-layout mapping is unchanged. ## Test `tests/startup_vertex_fetch_formats_check.py` gains the format and three mutated translations: - a normalized low half; - the high half read from the low half; - a missing W read as 1.0. The format uses stride 6 and offset 2, so half of the 16 elements cross a dword. ``` python -B tests/startup_vertex_fetch_formats_check.py controls vertex fetch format controls passed python -B tests/startup_vertex_fetch_formats_check.py <dxc> out/build/<dir>/offscreen_check.exe warp warp: 14 buffer formats, 16 vertices each, every wrong reference and 15 mutations fail python -B tests/startup_vertex_fetch_formats_check.py <dxc> out/build/<dir>/offscreen_check.exe hardware hardware: 14 buffer formats, 16 vertices each, every wrong reference and 15 mutations fail ``` These are the commands behind `startup_vertex_fetch_formats_(controls|warp|hardware)`. On `main`, `controls` fails with `gfx2hlsl.Unsupported: buffer format BUF_FMT_16_16_UINT`. **Environment** - **Hardware:** AMD Radeon RX 9070 XT, driver 32.0.32015.7029, the first adapter in high-performance order. - **Software:** WARP, Windows 10.0.26300.9974, DXC 1.8.2502.11 (Windows SDK 10.0.26100). The SDK debug layers are installed. - **Build:** `all` builds (Ninja Release, MSVC Build Tools 18). - **Skips:** none. **Other checks:** `startup_stream_fetch_check.py`, `startup_gfx2hlsl_tbuffer_16f_check.py` and `docs_links_check.py` pass. `docs/experiments.md` lists the new format and the device result. Refs #2023 (item G)
tbuffer_load_format_* with gfx10 format 27 (LLVM 15: BUF_DATA_FORMAT_16_16
with BUF_NUM_FORMAT_UINT) reads two unsigned 16-bit fields, the low half
into X, with Z = 0 and W = 1 like the other integer rows. It was refused
as an unknown buffer format.

Test: startup_vertex_fetch_formats_check.py gains the format (stride 6,
offset 2, so half of the elements cross a dword) and three mutations:
a normalized low half, the high half from the low half, and a missing W
read as 1.0. WARP and hardware readbacks match the byte reference and
every mutation fails.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:14:54 +00:00
github manually merged commit 34ff4a6b1d into gh-pr/2313/base 2026-11-27 00:14:55 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 12:00 UTC · original · reviewed

Review of head 34ff4a6b1de4f5f45b1ba7032d5a2063dcc5156b (comment only, no approval).

Result: P1=0, P2=0. One nit.

What I checked

  • Format 27 = BUF_FMT_16_16_UINT matches the gfx10 unified table: 23 UNORM, 24 SNORM, 27 UINT, 29 FLOAT. The sibling rows already in FETCH_FORMATS and the test table agree with that numbering.
  • tools/startup/gfx2hlsl.py:138: ldu() then w & 65535u (X), w >> 16 (Y), 0u, 1u. Right for unsigned 16-bit pairs. W=1 as an integer matches 8_UINT and 8_8_8_8_UINT. The w >> 16 is a logical shift because w is uint, so no sign issue.
  • Stride 6 / offset 2 in the test puts half of the 16 elements across a dword, so the ldu() path is exercised.
  • Only the tbuffer table is touched. The FETCH_DXGI mapping is unchanged, and the PR says so.
  • Title and body are neutral. Docs sentence and the format list are updated.

Commands run locally (worktree at the head SHA)

  • python3 -B tests/startup_vertex_fetch_formats_check.py controls -> vertex fetch format controls passed
  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 447 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls.
  • git diff --check origin/main...HEAD -> clean
  • gh pr checks: Linux Python checks pass. Windows build/test and gfx1013 fixtures were still pending when I looked.

Mutation on the new logic

  • I swapped the X and Y expressions of the new row (['w >> 16', 'w & 65535u', ...]). controls did not fail on this. It only checks that the mutation anchors still exist in the generated source, so the swap is only caught by the GPU readback run (warp / hardware). The PR reports those as passing. Once the Windows jobs finish, they are the real evidence for this change.
  • Changing the row so the "normalized low half" anchor no longer appears makes controls fail with AssertionError: ('BUF_FMT_16_16_UINT', 'normalized low half'). So the three new mutation entries are tied to the row text, which is fine.
  • Worktree restored with git checkout -- ..

Not run: I did not run the Windows WARP job. The change is one table row, and the PR's own Windows CI covers it. Please wait for those jobs to go green before merging.

Nit

  • The docs paragraph says the check ran on an RX 9070 XT. That is useful, but CI will only show WARP. Fine to keep.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 12:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2313#pullrequestreview-6057206428) · **reviewed** Review of head `34ff4a6b1de4f5f45b1ba7032d5a2063dcc5156b` (comment only, no approval). **Result: P1=0, P2=0.** One nit. **What I checked** - Format 27 = `BUF_FMT_16_16_UINT` matches the gfx10 unified table: 23 UNORM, 24 SNORM, 27 UINT, 29 FLOAT. The sibling rows already in `FETCH_FORMATS` and the test table agree with that numbering. - `tools/startup/gfx2hlsl.py:138`: `ldu()` then `w & 65535u` (X), `w >> 16` (Y), `0u`, `1u`. Right for unsigned 16-bit pairs. W=1 as an integer matches `8_UINT` and `8_8_8_8_UINT`. The `w >> 16` is a logical shift because `w` is uint, so no sign issue. - Stride 6 / offset 2 in the test puts half of the 16 elements across a dword, so the `ldu()` path is exercised. - Only the tbuffer table is touched. The `FETCH_DXGI` mapping is unchanged, and the PR says so. - Title and body are neutral. Docs sentence and the format list are updated. **Commands run locally (worktree at the head SHA)** - `python3 -B tests/startup_vertex_fetch_formats_check.py controls` -> `vertex fetch format controls passed` - `python3 tests/docs_links_check.py` -> `Checked 18 Markdown files and 447 links.` - `python3 tests/bidi_controls_check.py` -> `no bidirectional controls.` - `git diff --check origin/main...HEAD` -> clean - `gh pr checks`: Linux Python checks pass. Windows build/test and gfx1013 fixtures were still pending when I looked. **Mutation on the new logic** - I swapped the X and Y expressions of the new row (`['w >> 16', 'w & 65535u', ...]`). `controls` did not fail on this. It only checks that the mutation anchors still exist in the generated source, so the swap is only caught by the GPU readback run (`warp` / `hardware`). The PR reports those as passing. Once the Windows jobs finish, they are the real evidence for this change. - Changing the row so the "normalized low half" anchor no longer appears makes `controls` fail with `AssertionError: ('BUF_FMT_16_16_UINT', 'normalized low half')`. So the three new mutation entries are tied to the row text, which is fine. - Worktree restored with `git checkout -- .`. **Not run:** I did not run the Windows WARP job. The change is one table row, and the PR's own Windows CI covers it. Please wait for those jobs to go green before merging. **Nit** - The docs paragraph says the check ran on an RX 9070 XT. That is useful, but CI will only show WARP. Fine to keep. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.