shader: use named register codes in gfx1013_compute_clear.cpp #3915

Manually merged
github merged 1 commit from github-bot/gh-3913 into gh-pr/3913/base 2026-12-03 07:19:52 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-03 07:03 UTC · original
Leyukaka:quality-item2-s5-compute-clear → main · +9 −6 · 1 files · 1 commits · merged 2026-12-03 07:15 UTC

Problem

src/gfx1013_compute_clear.cpp still writes registers and operands as bare numbers: 128 for the SGPR count and for the constant 0 operand, and 256 for the first VGPR operand. #3832 added src/gfx1013_registers.h to keep the register code, operand and translator slot meanings apart. #3903, #3907 and #3912 converted gfx1013_graphics_wqm.inl, gfx1013_sampled_pixel.cpp and gfx1013_vertex_id.cpp.

Change

This is the fifth slice. No behaviour change.

  • ea94df004 uses the constants from gfx1013_registers.h in src/gfx1013_compute_clear.cpp (+9/-6, one file). The substitution is textual and the values and types are unchanged, so the replayed clear and the refusals are unchanged.
  • Sites converted:
    • reg::sgpr_count for 128 as the size of the scalar state array (std::array<Value,128>) and as the source<128 bound that makes the v_mbcnt_lo source a scalar register.
    • operand::zero for 128 as the constant 0 source of s_mov_b32 (three uses).
    • operand::vgpr_base for 256 as the first VGPR operand in the v_mbcnt_hi source check and its index.
  • The file includes the header. Unlike the files in #3907 and #3912, it needs no namespace alias: replay_group_clear is defined as x2w::replay_group_clear, so gfx1013:: resolves inside x2w.
  • Two require expressions that became longer than the file's existing lines are wrapped. Their operands and evaluation order are unchanged.
  • Left numeric:
    • 102, the guest SGPR bound this replay accepts. It is not a register code, and the header has no constant for it.
    • 256 as the VGPR state size (std::array<Value,256>) and dst<255. These are counts, not operand codes.
    • (operands&0xfffc01ff)==193, a match on a whole masked VOP3 operand word, not a single operand field.
    • decode masks and opcodes.
  • The five mutation anchors (string(REPLACE ...) in tests/cmake/gfx1013_compute_clear.cmake) 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 ea94df004 on main 8a2f84d1b. The targeted set passed:

  • gfx1013_compute_clear_all and the gfx1013_compute_clear_* cases, which cover the accepted clears and the refusals.
  • The five mutation controls among them (*_mut, WILL_FAIL) still fail as expected, so the anchors still apply.
  • native_translator_corpus_dxil and native_translator_corpus_ir.

Translator corpus: the TSV built from main 8a2f84d1b 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_compute_clear.cpp. The gfx1013_direct_*.inl frontends are still edited by many open PRs, so they will follow once that work lands.

**@⁠Leyukaka** on GitHub · 2026-12-03 07:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3913) `Leyukaka:quality-item2-s5-compute-clear` → `main` · +9 −6 · 1 files · 1 commits · merged 2026-12-03 07:15 UTC ## Problem `src/gfx1013_compute_clear.cpp` still writes registers and operands as bare numbers: 128 for the SGPR count and for the constant 0 operand, and 256 for the first VGPR operand. #3832 added `src/gfx1013_registers.h` to keep the register code, operand and translator slot meanings apart. #3903, #3907 and #3912 converted `gfx1013_graphics_wqm.inl`, `gfx1013_sampled_pixel.cpp` and `gfx1013_vertex_id.cpp`. ## Change This is the fifth slice. No behaviour change. - `ea94df004` uses the constants from `gfx1013_registers.h` in `src/gfx1013_compute_clear.cpp` (+9/-6, one file). The substitution is textual and the values and types are unchanged, so the replayed clear and the refusals are unchanged. - Sites converted: - `reg::sgpr_count` for 128 as the size of the scalar state array (`std::array<Value,128>`) and as the `source<128` bound that makes the `v_mbcnt_lo` source a scalar register. - `operand::zero` for 128 as the constant 0 source of `s_mov_b32` (three uses). - `operand::vgpr_base` for 256 as the first VGPR operand in the `v_mbcnt_hi` source check and its index. - The file includes the header. Unlike the files in #3907 and #3912, it needs no namespace alias: `replay_group_clear` is defined as `x2w::replay_group_clear`, so `gfx1013::` resolves inside `x2w`. - Two `require` expressions that became longer than the file's existing lines are wrapped. Their operands and evaluation order are unchanged. - Left numeric: - `102`, the guest SGPR bound this replay accepts. It is not a register code, and the header has no constant for it. - `256` as the VGPR state size (`std::array<Value,256>`) and `dst<255`. These are counts, not operand codes. - `(operands&0xfffc01ff)==193`, a match on a whole masked VOP3 operand word, not a single operand field. - decode masks and opcodes. - The five mutation anchors (`string(REPLACE ...)` in `tests/cmake/gfx1013_compute_clear.cmake`) 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 `ea94df004` on `main` `8a2f84d1b`. The targeted set passed: - `gfx1013_compute_clear_all` and the `gfx1013_compute_clear_*` cases, which cover the accepted clears and the refusals. - The five mutation controls among them (`*_mut`, `WILL_FAIL`) still fail as expected, so the anchors still apply. - `native_translator_corpus_dxil` and `native_translator_corpus_ir`. Translator corpus: the TSV built from `main` `8a2f84d1b` 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_compute_clear.cpp`. The `gfx1013_direct_*.inl` frontends are still edited by many open PRs, so they will follow once that work lands.
Replace the magic register and operand numbers in
src/gfx1013_compute_clear.cpp with the constants from
src/gfx1013_registers.h: the SGPR count (128, the scalar state size and
the register operand bound of v_mbcnt_lo), the constant 0 source of
s_mov_b32 (128) and the VGPR operand base (256). The file now includes
the header; replay_group_clear is defined as x2w::replay_group_clear, so
gfx1013:: resolves without an alias. The substitution is textual and
the values and types are unchanged, so the replayed clear is identical.
Left as they are: the 102-SGPR guest bound, the VGPR file size 256,
dst < 255, the encoded VOP3 operand word 193, decode masks and opcodes.
The five mutation anchors are on lines this change does not touch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 07:08:22 +00:00
Author
Owner

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

Independently reviewed ea94df00. The symbols resolve to the original operand values and preserve the scalar and vector bounds, short-circuit checks, and vector index. On Windows 11 with MSVC Debug, built all six gfx1013_compute_clear targets and ran ctest --preset dev --no-tests=error -j 1 -R '^gfx1013_compute_clear_': 44/44 passed, including all five mutation targets. This source-built replay fixture does not require a GPU.

**@⁠R0Y00** on GitHub · 2026-12-03 07:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3913#pullrequestreview-6165169387) · **approved these changes** Independently reviewed ea94df00. The symbols resolve to the original operand values and preserve the scalar and vector bounds, short-circuit checks, and vector index. On Windows 11 with MSVC Debug, built all six gfx1013_compute_clear targets and ran ctest --preset dev --no-tests=error -j 1 -R '^gfx1013_compute_clear_': 44/44 passed, including all five mutation targets. This source-built replay fixture does not require a GPU.
github-bot changed target branch from main to gh-pr/3913/base 2026-12-03 07:19:51 +00:00
github manually merged commit ea94df0049 into gh-pr/3913/base 2026-12-03 07:19:52 +00:00
github-bot referenced this pull request from a commit 2026-12-03 15:01:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.