tombox-xshader: decode and translate ds_read_b96, ds_read_b128, ds_wr… #240

Closed
github-bot wants to merge 1 commit from gh-pr/240/head into gh-pr/240/base
Owner

@⁠azerioxfr on GitHub · 2026-11-23 06:44 UTC · original
azerioxfr:xshader-ds-b96-b128 → main · +25 −2 · 3 files · 1 commits · closed without merging

Library / area: tombox-xshader, wide LDS accesses (hlsl/ds_ext.rs split_wide_lds)

Exports changed (exports.txt rows): none

Source of the behaviour: opcodes from tests/isa_table/gfx1013.txt (DS 0xde, 0xdf, 0xfe, 0xff). Semantics from the RDNA2 ISA: consecutive dwords at addr + offset, like ds_read_b64 / ds_write_b64.

One topic, +25 / -2: 1 line in rdna2/mnem.rs, 9 in hlsl/ds_ext.rs, 15 lines of test.

What was missing

tests/isa_table.rs lists these four under "ds: gfx1013 opcodes not named by the decoder", so a compute or geometry shader that moves 3 or 4 dwords through LDS in one instruction failed translation.

The change

opcode split into
ds_write_b96 (0xde) / ds_write_b128 (0xdf) ds_write_b32 of data0..data0+2 / +3 at offset, +4, +8 (+12)
ds_read_b96 (0xfe) / ds_read_b128 (0xff) ds_read_b32 into vdst..vdst+2 / +3 at the same offsets; a part whose vdst is the address register is read last (the existing rule)

Unaligned b96 / b128 addresses depend on the LDS alignment mode, so they are not claimed. The tests use 16-byte aligned addresses.

Tests

ds_lds_b64_compute gains, for both widths, a write then a read through the neighbouring lane at offsets 0, 0x10 and 0x400, with vdst 10 and with vdst 15 (the read's own address register):

run (WARP, --release, DXC 1.9.2609) result
exec_mem::ds::ds_lds_b64_compute 10 mnemonics verified, 0 failing, 45 cases
mutation: b128 split reuses +8 for the 4th dword 8 verified, 2 failing
--test isa_table / --test opcodes 3 / 26 passed

Run on x86_64-pc-windows-gnu (no MSVC linker here). These are data moves only, with no floating point.

  • cargo test -p tombox-xshader --test exec -- --exact exec_mem::ds::ds_lds_b64_compute passes
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note
**@⁠azerioxfr** on GitHub · 2026-11-23 06:44 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/240) `azerioxfr:xshader-ds-b96-b128` → `main` · +25 −2 · 3 files · 1 commits · closed without merging **Library / area:** tombox-xshader, wide LDS accesses (`hlsl/ds_ext.rs` `split_wide_lds`) **Exports changed (exports.txt rows):** none **Source of the behaviour:** opcodes from `tests/isa_table/gfx1013.txt` (DS 0xde, 0xdf, 0xfe, 0xff). Semantics from the RDNA2 ISA: consecutive dwords at `addr + offset`, like `ds_read_b64` / `ds_write_b64`. One topic, +25 / -2: 1 line in `rdna2/mnem.rs`, 9 in `hlsl/ds_ext.rs`, 15 lines of test. ### What was missing `tests/isa_table.rs` lists these four under "ds: gfx1013 opcodes not named by the decoder", so a compute or geometry shader that moves 3 or 4 dwords through LDS in one instruction failed translation. ### The change | opcode | split into | |---|---| | `ds_write_b96` (0xde) / `ds_write_b128` (0xdf) | `ds_write_b32` of data0..data0+2 / +3 at offset, +4, +8 (+12) | | `ds_read_b96` (0xfe) / `ds_read_b128` (0xff) | `ds_read_b32` into vdst..vdst+2 / +3 at the same offsets; a part whose vdst is the address register is read last (the existing rule) | Unaligned b96 / b128 addresses depend on the LDS alignment mode, so they are not claimed. The tests use 16-byte aligned addresses. ### Tests `ds_lds_b64_compute` gains, for both widths, a write then a read through the neighbouring lane at offsets 0, 0x10 and 0x400, with vdst 10 and with vdst 15 (the read's own address register): | run (WARP, `--release`, DXC 1.9.2609) | result | |---|---| | `exec_mem::ds::ds_lds_b64_compute` | **10 mnemonics verified, 0 failing, 45 cases** | | mutation: b128 split reuses `+8` for the 4th dword | 8 verified, 2 failing | | `--test isa_table` / `--test opcodes` | 3 / 26 passed | Run on `x86_64-pc-windows-gnu` (no MSVC linker here). These are data moves only, with no floating point. - [x] `cargo test -p tombox-xshader --test exec -- --exact exec_mem::ds::ds_lds_b64_compute` passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
DS opcodes 0xde, 0xdf, 0xfe and 0xff were not decoded (the isa_table
test lists them under "ds: gfx1013 opcodes not named by the decoder").
They now decode and go through split_wide_lds like the 64-bit forms:
- ds_write_b96 / ds_write_b128: data0..data0+2 / data0+3 written as
  consecutive dwords at addr + offset, +4, +8 (+12);
- ds_read_b96 / ds_read_b128: the same dwords into vdst..vdst+2 / +3,
  with the existing rule that a part whose vdst is the address
  register is read last.
Unaligned b96/b128 addresses depend on the LDS alignment mode and are
not covered; the tests use 16-byte aligned addresses.

Tests: ds_lds_b64_compute gains write/read round trips through the
neighbouring lane for both widths at offsets 0, 0x10 and 0x400, with
vdst 10 and with vdst 15 (= the read's address register): 10
mnemonics verified, 0 failing, 45 cases on WARP. A b128 split that
reuses offset +8 for the fourth dword fails both b128 ops.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:15:19 +00:00
github-bot closed this pull request 2026-11-26 06:15:19 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 14:08 UTC · original

Applied locally on main with your authorship kept (cherry-picked, 00052ef); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 14:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/240#issuecomment-7103543566) Applied locally on main with your authorship kept (cherry-picked, 00052ef); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:08 UTC · original

Applied on main in 00052ef (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/240#issuecomment-7163359552) Applied on main in 00052ef (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.