xshader: add ds_write_b16_d16_hi and buffer_store_format_xy/xyz #161

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

@⁠GDAgent on GitHub · 2026-11-22 16:49 UTC · original
GDAgent:port/xshader-ds-b16-hi-and-store-format-xy-xyz → main · +43 −6 · 5 files · 1 commits · closed without merging

Library / area: tombox-xshader (rdna2/mnem.rs, hlsl.rs, tests/exec_mem/ds.rs, tests/exec.rs)

Exports changed (exports.txt rows): none

Source of the behaviour: AMD RDNA2 ISA specification (DS instruction table, MUBUF opcode table). Ported from drycheetah84/TomBox 1d5dbc1 and brcly/TomBox commits (MIT OR Apache-2.0); credit line added to THIRD_PARTY/CREDITS. The ISA table in open #152 also lists ds_write_b16_d16_hi; this change adds the decoder entry for it.

Changes:

  • Decode and translate ds_write_b16_d16_hi (DS 0xa1): stores DATA[31:16] through the existing atomic sub-word LDS write path (the ds_write_b16 read-modify-write loop), with the source shifted right by 16.
  • Decode buffer_store_format_xy (MUBUF 0x05) and buffer_store_format_xyz (MUBUF 0x06); they lower through the existing typed-buffer store emitter.

Tests:

  • ds_lds_compute: ds_write_b16_d16_hi at both halfword offsets of a dword, checked against the neighbouring halfword.
  • buffer_mubuf: buffer_store_format_xy and buffer_store_format_xyz, checking the written dwords and that the untouched neighbours keep their values.
  • cargo test --release -p tombox-xshader --test exec -- ds_lds_compute buffer_mubuf (D3D12 execution on hardware): 2 passed.
  • cargo test --release -p tombox-xshader --lib --test opcodes --test synthetic: 116 passed, 0 failed, 2 ignored.
  • The full exec suite has 3 failures that also occur on plain main: scalar_smem_loads, exec_mem::mtbuf::mtbuf_d16_store_formats, vop::basic::vop2_basic. Nothing extra fails with this change.
  • Native Windows 11; not run under Proton. Not verified in a title.
  • Related, not fixed here: #105 (typed-buffer integer formats).
**@⁠GDAgent** on GitHub · 2026-11-22 16:49 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/161) `GDAgent:port/xshader-ds-b16-hi-and-store-format-xy-xyz` → `main` · +43 −6 · 5 files · 1 commits · closed without merging **Library / area:** tombox-xshader (`rdna2/mnem.rs`, `hlsl.rs`, `tests/exec_mem/ds.rs`, `tests/exec.rs`) **Exports changed (exports.txt rows):** none **Source of the behaviour:** AMD RDNA2 ISA specification (DS instruction table, MUBUF opcode table). Ported from drycheetah84/TomBox `1d5dbc1` and brcly/TomBox commits (MIT OR Apache-2.0); credit line added to `THIRD_PARTY/CREDITS`. The ISA table in open #152 also lists `ds_write_b16_d16_hi`; this change adds the decoder entry for it. Changes: - Decode and translate `ds_write_b16_d16_hi` (DS `0xa1`): stores `DATA[31:16]` through the existing atomic sub-word LDS write path (the `ds_write_b16` read-modify-write loop), with the source shifted right by 16. - Decode `buffer_store_format_xy` (MUBUF `0x05`) and `buffer_store_format_xyz` (MUBUF `0x06`); they lower through the existing typed-buffer store emitter. Tests: - `ds_lds_compute`: `ds_write_b16_d16_hi` at both halfword offsets of a dword, checked against the neighbouring halfword. - `buffer_mubuf`: `buffer_store_format_xy` and `buffer_store_format_xyz`, checking the written dwords and that the untouched neighbours keep their values. - `cargo test --release -p tombox-xshader --test exec -- ds_lds_compute buffer_mubuf` (D3D12 execution on hardware): 2 passed. - `cargo test --release -p tombox-xshader --lib --test opcodes --test synthetic`: 116 passed, 0 failed, 2 ignored. - The full exec suite has 3 failures that also occur on plain `main`: `scalar_smem_loads`, `exec_mem::mtbuf::mtbuf_d16_store_formats`, `vop::basic::vop2_basic`. Nothing extra fails with this change. - Native Windows 11; not run under Proton. Not verified in a title. - Related, not fixed here: #105 (typed-buffer integer formats).
- Decode and translate ds_write_b16_d16_hi (DS 0xa1), storing DATA[31:16]
  through the atomic sub-word LDS write path.
- Decode buffer_store_format_xy (MUBUF 0x05) and buffer_store_format_xyz
  (MUBUF 0x06), which use the existing typed-buffer store emitter.
- Add D3D12 execution tests for ds_write_b16_d16_hi at both halfword
  offsets and for buffer_store_format_xy/xyz.

Ported from drycheetah84/TomBox 1d5dbc1 and brcly/TomBox commits
(MIT OR Apache-2.0).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:12:15 +00:00
github-bot closed this pull request 2026-11-26 06:12:15 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 17:10 UTC · original

Applied in f9fd22f (merged in 43d17b0) with your authorship kept, thanks.

**@⁠omonkeyz** on GitHub · 2026-11-22 17:10 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/161#issuecomment-7082632053) Applied in f9fd22f (merged in 43d17b0) with your authorship kept, thanks.

Pull request closed

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