shader: use named register codes in gfx1013_sampled_pixel.cpp #3907

Manually merged
github merged 2 commits from github-bot/gh-3905 into gh-pr/3905/base 2026-12-03 02:03:13 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-03 00:53 UTC · original
Leyukaka:quality-item2-s3-sampled-pixel → main · +14 −11 · 1 files · 2 commits · merged 2026-12-03 01:55 UTC

Problem

src/gfx1013_sampled_pixel.cpp still writes operands as bare numbers: 128, 192, 193 and 208 for the inline integer bounds, 255 for the literal, 256 for the first VGPR operand and 124 for M0. #3832 added src/gfx1013_registers.h to keep the register code, operand and translator slot meanings apart, and #3903 converted gfx1013_graphics_wqm.inl.

Change

This is the third slice. No behaviour change.

  • a206c48b9 uses the constants from gfx1013_registers.h in src/gfx1013_sampled_pixel.cpp (+14/-11, one file). The substitution is textual and the values and types are unchanged, so the emitted HLSL and the refusal text are unchanged.
  • The file is its own translation unit outside namespace x2w, so it includes the header and adds namespace gfx1013 = x2w::gfx1013; inside its anonymous namespace. The uses then read gfx1013::operand::... and gfx1013::reg::m0, as in the earlier slices.
  • Left numeric:
    • the float constant range 240..247 and its table index index-240. The header's float_last is 248 (1/(2*pi)), which this translator does not accept, so naming only the lower bound would leave the range half-converted.
    • 256 as the VGPR file size (the array size and the destination bound) and addr<255. These are counts, not operand codes.
    • the 256+addr / 257+addr coordinate pair, 192u-index, decode masks, opcodes and HLSL text.
  • The five mutation anchors in tests/cmake/gfx1013_sampled_pixel.cmake (the string(REPLACE ...) sources) target lines this change does not touch.
  • No build change. gfx1013_registers.h is header-only and already in src.

Validation

Built on Windows with MSVC, head a206c48b9 on main b6171650f. The targeted set passed 68/68:

  • gfx1013_sampled_pixel_all and the gfx1013_sampled_pixel_* cases, which pin the generated HLSL and the refusal reasons.
  • The five mutation controls among them (*_mut, WILL_FAIL) still fail as expected, so the anchors still apply.
  • native_sampled_replay, native_sampled_pixel_warp and native_indexed_pixel_texture_warp.
  • native_translator_corpus_dxil and native_translator_corpus_ir.

Translator corpus: the TSV built from main b6171650f and the TSV built from this branch have the same SHA-256, so they are byte-identical.

Each replaced site was also read a second time against the header to confirm the same value, type and meaning.

Other open PRs

No open PR edits gfx1013_sampled_pixel.cpp. The next files in the plan, the gfx1013_direct_*.inl frontends (graphics, compute, mesh), are each edited by 12 to 15 open PRs, so they will follow once that work lands.

**@⁠Leyukaka** on GitHub · 2026-12-03 00:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3905) `Leyukaka:quality-item2-s3-sampled-pixel` → `main` · +14 −11 · 1 files · 2 commits · merged 2026-12-03 01:55 UTC ## Problem `src/gfx1013_sampled_pixel.cpp` still writes operands as bare numbers: 128, 192, 193 and 208 for the inline integer bounds, 255 for the literal, 256 for the first VGPR operand and 124 for M0. #3832 added `src/gfx1013_registers.h` to keep the register code, operand and translator slot meanings apart, and #3903 converted `gfx1013_graphics_wqm.inl`. ## Change This is the third slice. No behaviour change. - `a206c48b9` uses the constants from `gfx1013_registers.h` in `src/gfx1013_sampled_pixel.cpp` (+14/-11, one file). The substitution is textual and the values and types are unchanged, so the emitted HLSL and the refusal text are unchanged. - The file is its own translation unit outside `namespace x2w`, so it includes the header and adds `namespace gfx1013 = x2w::gfx1013;` inside its anonymous namespace. The uses then read `gfx1013::operand::...` and `gfx1013::reg::m0`, as in the earlier slices. - Left numeric: - the float constant range `240..247` and its table index `index-240`. The header's `float_last` is 248 (1/(2*pi)), which this translator does not accept, so naming only the lower bound would leave the range half-converted. - `256` as the VGPR file size (the array size and the destination bound) and `addr<255`. These are counts, not operand codes. - the `256+addr` / `257+addr` coordinate pair, `192u-index`, decode masks, opcodes and HLSL text. - The five mutation anchors in `tests/cmake/gfx1013_sampled_pixel.cmake` (the `string(REPLACE ...)` sources) target lines this change does not touch. - No build change. `gfx1013_registers.h` is header-only and already in `src`. ## Validation Built on Windows with MSVC, head `a206c48b9` on `main` `b6171650f`. The targeted set passed 68/68: - `gfx1013_sampled_pixel_all` and the `gfx1013_sampled_pixel_*` cases, which pin the generated HLSL and the refusal reasons. - The five mutation controls among them (`*_mut`, `WILL_FAIL`) still fail as expected, so the anchors still apply. - `native_sampled_replay`, `native_sampled_pixel_warp` and `native_indexed_pixel_texture_warp`. - `native_translator_corpus_dxil` and `native_translator_corpus_ir`. Translator corpus: the TSV built from `main` `b6171650f` and the TSV built from this branch have the same SHA-256, so they are byte-identical. Each replaced site was also read a second time against the header to confirm the same value, type and meaning. ## Other open PRs No open PR edits `gfx1013_sampled_pixel.cpp`. The next files in the plan, the `gfx1013_direct_*.inl` frontends (graphics, compute, mesh), are each edited by 12 to 15 open PRs, so they will follow once that work lands.
Replace the magic register and operand numbers in
src/gfx1013_sampled_pixel.cpp with the constants from
src/gfx1013_registers.h: M0 (124), the inline integer bounds (128, 192,
193, 208), the literal operand (255) and the VGPR operand base (256).
The file now includes the header and aliases x2w::gfx1013 inside its
anonymous namespace. The substitution is textual and the values and
types are unchanged, so the generated HLSL and bindings are
byte-identical. Left as they are: the float constant range 240..247 and
its table index (the header's float_last is 248), 192u - index, the
VGPR file size 256 (array size and destination bound), addr < 255, the
256 + addr / 257 + addr coordinate pair, decode masks, opcodes and HLSL
text. The mutation anchors in tests/cmake/gfx1013_sampled_pixel.cmake
are untouched.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 00:56:32 +00:00
github-bot changed target branch from main to gh-pr/3905/base 2026-12-03 02:02:48 +00:00
github manually merged commit e9d9b96728 into gh-pr/3905/base 2026-12-03 02:03:13 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 01:54 UTC · original · approved these changes

Independently reviewed e9d9b967. Each named register/operand code matches the previous numeric boundary and the scalar, literal, and VGPR paths keep the old behavior. MSVC Debug ctest --preset dev --no-tests=error -j 1 -R '^(gfx1013_sampled_pixel_all|shader_compile_sampled_pixel_cli_check|native_sampled_pixel_(warp|hardware))$' passed 4/4 in two serial selections on Windows 11 build 26300, WARP and RTX 4060 Laptop (616.56). Changing the lower negative bound to exclusive survived the default tests. With the existing dead scalar move changed locally from selector 200 to the first negative selector 193, the head passed and the mutant refused at byte 60. Both local edits were reverted and the original unit suite passed again.

**@⁠R0Y00** on GitHub · 2026-12-03 01:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3905#pullrequestreview-6162366315) · **approved these changes** Independently reviewed e9d9b967. Each named register/operand code matches the previous numeric boundary and the scalar, literal, and VGPR paths keep the old behavior. MSVC Debug `ctest --preset dev --no-tests=error -j 1 -R '^(gfx1013_sampled_pixel_all|shader_compile_sampled_pixel_cli_check|native_sampled_pixel_(warp|hardware))$'` passed 4/4 in two serial selections on Windows 11 build 26300, WARP and RTX 4060 Laptop (616.56). Changing the lower negative bound to exclusive survived the default tests. With the existing dead scalar move changed locally from selector 200 to the first negative selector 193, the head passed and the mutant refused at byte 60. Both local edits were reverted and the original unit suite passed again.
This discussion has been locked. Commenting is limited to contributors.
No description provided.