tombox-xshader tests: pin the gather4 bias and dmask refusals #248

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

@⁠azerioxfr on GitHub · 2026-11-23 07:22 UTC · original
azerioxfr:xshader-pin-gather4-refusals → main · +33 −0 · 1 files · 1 commits · closed without merging

Library / area: tombox-xshader tests, MIMG gather4 (hlsl.rs emit_mimg)

Exports changed (exports.txt rows): none

Source of the behaviour: the translator's own refusals. HLSL Gather* has no LOD bias or clamp operand and returns one channel, so emit_mimg refuses gather4 with a bias / clamp modifier and with a multi-channel dmask. No translator change.

One topic, +33: one test in tests/exec_mem/mimg.rs.

What was missing

Neither refusal (gather4 with LOD bias or clamp unsupported, gather4 with dmask {m:#x} unsupported) was mentioned by any test.

The test

image_gather4_bias_and_dmask_refusals:

program expected result
image_gather4_b (0x45), dmask 0xf Err("gather4 with LOD bias or clamp unsupported") ok
image_gather4_b_cl (0x46), dmask 0xf same error ok
image_gather4_lz (0x47), dmask 0x3 Err("gather4 with dmask 0x3 unsupported") ok
image_gather4_lz, dmask 0x8 translates to .GatherAlpha( ok
mutation: modifier guard relaxed / dmask 3 accepted fails at the matching assertion fails

cargo test --locked --release -p tombox-xshader --test exec -- --exact exec_mem::mimg::image_gather4_bias_and_dmask_refusals: 1 passed (x86_64-pc-windows-gnu).

  • the test 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 07:22 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/248) `azerioxfr:xshader-pin-gather4-refusals` → `main` · +33 −0 · 1 files · 1 commits · closed without merging **Library / area:** tombox-xshader tests, MIMG gather4 (`hlsl.rs` `emit_mimg`) **Exports changed (exports.txt rows):** none **Source of the behaviour:** the translator's own refusals. HLSL `Gather*` has no LOD bias or clamp operand and returns one channel, so `emit_mimg` refuses gather4 with a bias / clamp modifier and with a multi-channel dmask. No translator change. One topic, +33: one test in `tests/exec_mem/mimg.rs`. ### What was missing Neither refusal (`gather4 with LOD bias or clamp unsupported`, `gather4 with dmask {m:#x} unsupported`) was mentioned by any test. ### The test `image_gather4_bias_and_dmask_refusals`: | program | expected | result | |---|---|---| | `image_gather4_b` (0x45), dmask 0xf | `Err("gather4 with LOD bias or clamp unsupported")` | ok | | `image_gather4_b_cl` (0x46), dmask 0xf | same error | ok | | `image_gather4_lz` (0x47), dmask 0x3 | `Err("gather4 with dmask 0x3 unsupported")` | ok | | `image_gather4_lz`, dmask 0x8 | translates to `.GatherAlpha(` | ok | | mutation: modifier guard relaxed / dmask 3 accepted | fails at the matching assertion | fails | `cargo test --locked --release -p tombox-xshader --test exec -- --exact exec_mem::mimg::image_gather4_bias_and_dmask_refusals`: 1 passed (`x86_64-pc-windows-gnu`). - [x] the test passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
hlsl.rs refuses a gather4 with a bias or clamp modifier and a gather4 whose dmask is not exactly one channel, but no test mentioned either message. The exec suite only covers image_gather4, image_gather4_cl, image_gather4_l, image_gather4_c and image_gather4_c_lz, so both branches were unpinned.

Adds image_gather4_bias_and_dmask_refusals: image_gather4_b (opcode 0x45) and image_gather4_b_cl (0x46) must return exactly 'gather4 with LOD bias or clamp unsupported'; image_gather4_lz with dmask 0x3 must return 'gather4 with dmask 0x3 unsupported'; image_gather4_lz with dmask 0x8 must still translate and emit GatherAlpha.

Mutation: relaxing the modifier guard (if false && !matches!(modi, 0 | 4 | 7)) makes the bias case translate and the test panic; accepting dmask 0x3 in the channel match makes the dmask case translate and the test panic. Both restored.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:15:45 +00:00
github-bot closed this pull request 2026-11-26 06:15:45 +00:00
Author
Owner

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

Applied locally on main with your authorship kept (cherry-picked, de4317e); 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/248#issuecomment-7103534911) Applied locally on main with your authorship kept (cherry-picked, de4317e); 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

@⁠kiwe147 on GitHub · 2026-11-23 19:15 UTC · original

Tested head b87f15b7c8, applied with git apply (whitespace ignored, the line endings of my checkout differ) on main f89e410, together with #242, #244 (one tree; the PRs touch different files). It applied without conflicts and built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1.

run result
tombox-xshader lib + opcodes, synthetic, mesh, linkage, mixed_table, ps_linkage, centroid, gcn_dims, amp, xshader_cli, isa_sweep 205 passed, 0 failed
the tests the PRs of this tree add, in the exec suite on WARP 2 passed, 0 failed
the same tests with TOMBOX_EXEC_HW=1 (RTX 3080) 2 passed, 0 failed

No new failure against main f89e410 in any of these. This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

**@⁠kiwe147** on GitHub · 2026-11-23 19:15 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/248#issuecomment-7111320141) Tested head `b87f15b7c8`, applied with `git apply` (whitespace ignored, the line endings of my checkout differ) on `main` `f89e410`, together with #242, #244 (one tree; the PRs touch different files). It applied without conflicts and built. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1. | run | result | |---|---| | `tombox-xshader` lib + `opcodes`, `synthetic`, `mesh`, `linkage`, `mixed_table`, `ps_linkage`, `centroid`, `gcn_dims`, `amp`, `xshader_cli`, `isa_sweep` | 205 passed, 0 failed | | the tests the PRs of this tree add, in the `exec` suite on WARP | 2 passed, 0 failed | | the same tests with `TOMBOX_EXEC_HW=1` (RTX 3080) | 2 passed, 0 failed | No new failure against `main` `f89e410` in any of these. This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code)
Author
Owner

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

Applied on main in de4317e (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/248#issuecomment-7163343768) Applied on main in de4317e (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.