tombox-xshader tests: pin the scratch-segment refusals #262

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

@⁠azerioxfr on GitHub · 2026-11-23 08:24 UTC · original
azerioxfr:xshader-pin-scratch-refusals → main · +28 −0 · 1 files · 1 commits · closed without merging

Library / area: tombox-xshader tests, FLAT scratch segment (hlsl/global.rs emit_global, hlsl.rs code-section load path)

Exports changed (exports.txt rows): none

Source of the behaviour: the translator's own refusals. Scratch (thread-private) memory has no binding in the one-lane-per-thread model, so FLAT accesses with SEG=1 are refused. No translator change.

One topic, +28: one test in tests/synthetic.rs.

What was missing

Neither scratch-memory load unsupported nor {m}: scratch-segment access unsupported was named by any test.

The test

scratch_segment_flat_loads_and_stores_are_refused, using hand-built FLAT words in compute shaders:

program expected result
flat_load_dword, SEG=2 (global) translates to tb_gload( ok
flat_load_dword, SEG=1 (scratch) scratch-memory load unsupported ok
flat_store_dword, SEG=2 translates to tb_gstore( ok
flat_store_dword, SEG=1 flat_store_dword: scratch-segment access unsupported ok
mutation: each scratch guard (if ins.aux.mask == 1) set to if false the matching assertion fails fails

The global forms translating shows that the segment is what is refused, not the opcode. cargo test --locked --release -p tombox-xshader --test synthetic: 25 passed (x86_64-pc-windows-gnu).

  • tests pass
  • 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 08:24 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/262) `azerioxfr:xshader-pin-scratch-refusals` → `main` · +28 −0 · 1 files · 1 commits · closed without merging **Library / area:** tombox-xshader tests, FLAT scratch segment (`hlsl/global.rs` `emit_global`, `hlsl.rs` code-section load path) **Exports changed (exports.txt rows):** none **Source of the behaviour:** the translator's own refusals. Scratch (thread-private) memory has no binding in the one-lane-per-thread model, so FLAT accesses with SEG=1 are refused. No translator change. One topic, +28: one test in `tests/synthetic.rs`. ### What was missing Neither `scratch-memory load unsupported` nor `{m}: scratch-segment access unsupported` was named by any test. ### The test `scratch_segment_flat_loads_and_stores_are_refused`, using hand-built FLAT words in compute shaders: | program | expected | result | |---|---|---| | `flat_load_dword`, SEG=2 (global) | translates to `tb_gload(` | ok | | `flat_load_dword`, SEG=1 (scratch) | `scratch-memory load unsupported` | ok | | `flat_store_dword`, SEG=2 | translates to `tb_gstore(` | ok | | `flat_store_dword`, SEG=1 | `flat_store_dword: scratch-segment access unsupported` | ok | | mutation: each scratch guard (`if ins.aux.mask == 1`) set to `if false` | the matching assertion fails | fails | The global forms translating shows that the segment is what is refused, not the opcode. `cargo test --locked --release -p tombox-xshader --test synthetic`: 25 passed (`x86_64-pc-windows-gnu`). - [x] tests pass - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
`emit_global` refuses a FLAT access in the scratch segment, and the
code-section load path refuses a scratch load separately
(src/hlsl/global.rs: "{m}: scratch-segment access unsupported";
src/hlsl.rs: "scratch-memory load unsupported"). No test exercised
either message, so the refusals could be dropped or reworded unnoticed.

Add hand-built FLAT words for seg=1 and seg=2 with a scratch load
(flat_load_dword) and a scratch store (flat_store_dword), in
tests/synthetic.rs. The seg=2 form of each still translates (tb_gload /
tb_gstore), so the test shows the segment is what is refused, not the
opcode.

Mutation: changing each `if ins.aux.mask == 1` guard to `if false` made
the test fail on the load (different message from the PC check) and,
with only the global.rs guard still mutated, on the store (translated
instead of refused). Both sources restored byte-for-byte.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:16:23 +00:00
github-bot closed this pull request 2026-11-26 06:16:23 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:20 UTC · original

Closing as superseded: #284 lowers scratch-segment loads and stores, so these refusal pins would fail once it lands. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:20 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/262#issuecomment-7102389393) Closing as superseded: #284 lowers scratch-segment loads and stores, so these refusal pins would fail once it lands. Thanks.

Pull request closed

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