shader: name gfx10 register codes in gfx1013_graphics_wqm.inl #3903

Manually merged
github merged 1 commit from github-bot/gh-3901 into gh-pr/3901/base 2026-12-02 23:53:06 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-02 23:38 UTC · original
Leyukaka:quality-item2-s2-wqm → main · +53 −37 · 1 files · 1 commits · merged 2026-12-02 23:51 UTC

Problem

src/gfx1013_graphics_wqm.inl still writes scalar registers as bare numbers: 126/127 for EXEC, 106/107 for VCC, 105 for the last general SGPR, 256 for the first VGPR operand and 128 for the SCC slot of the scalar state. #3832 added src/gfx1013_registers.h to keep the register code, operand and translator slot meanings apart, and converted gfx1013_compute_native.cpp.

Change

This is the second slice. No behaviour change.

  • 8b70c6773 uses the constants from gfx1013_registers.h in src/gfx1013_graphics_wqm.inl (+53/-37, one file). The substitution is textual and the values and types are unchanged.
  • The numeric WQM lowering's write(128) becomes reg::scc_slot: it is the SCC slot of the scalar state, not operand 128 (the constant 0).
  • Left numeric:
    • 104, the bound for an aligned 64-bit register pair. The header has no constant for it, and #3832 left it as is too.
    • 512 +, the key offset of the saved-coverage tags in graphics_registers. It is a translator map key, not a register code or an operand, and gfx1013_direct_graphics.inl uses the same offset.
    • 0x1890, an export target mask, along with branch opcodes and IR text. None of them are register codes.
  • No build change. The file is compiled inside gfx1013_compute_native.cpp, which already includes the header, and it is already a native shader revision input.

Validation

Built on Windows with MSVC, head 8b70c6773 on main c42b7ce3f.

  • native_graphics_wqm_ir, native_pixel_alpha_kill_controls, native_pixel_cmpx_discard_warp, native_pixel_compare_mask_ir, native_pixel_saveexec_masks_controls, native_pixel_cmpx_scalar_tail_controls, native_translator_corpus_dxil and native_translator_corpus_ir pass.
  • Translator corpus (tests/translator_corpus_hash.py): the TSV built from main c42b7ce3f and the TSV built from this branch have the same SHA-256, so they are byte-identical. The corpus is a general regression check; the WQM paths are covered by the targeted tests above.
  • Each replaced site was also read a second time against the header to confirm the same value and type.

Other open PRs

#3849 (draft) also edits gfx1013_graphics_wqm.inl, but only adds a block at the head of the file, above the lines changed here, so there is no overlap. If this lands first and a rebase is needed, I am glad to help.

**@⁠Leyukaka** on GitHub · 2026-12-02 23:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3901) `Leyukaka:quality-item2-s2-wqm` → `main` · +53 −37 · 1 files · 1 commits · merged 2026-12-02 23:51 UTC ## Problem `src/gfx1013_graphics_wqm.inl` still writes scalar registers as bare numbers: 126/127 for EXEC, 106/107 for VCC, 105 for the last general SGPR, 256 for the first VGPR operand and 128 for the SCC slot of the scalar state. #3832 added `src/gfx1013_registers.h` to keep the register code, operand and translator slot meanings apart, and converted `gfx1013_compute_native.cpp`. ## Change This is the second slice. No behaviour change. - `8b70c6773` uses the constants from `gfx1013_registers.h` in `src/gfx1013_graphics_wqm.inl` (+53/-37, one file). The substitution is textual and the values and types are unchanged. - The numeric WQM lowering's `write(128)` becomes `reg::scc_slot`: it is the SCC slot of the scalar state, not operand 128 (the constant 0). - Left numeric: - `104`, the bound for an aligned 64-bit register pair. The header has no constant for it, and #3832 left it as is too. - `512 +`, the key offset of the saved-coverage tags in `graphics_registers`. It is a translator map key, not a register code or an operand, and `gfx1013_direct_graphics.inl` uses the same offset. - `0x1890`, an export target mask, along with branch opcodes and IR text. None of them are register codes. - No build change. The file is compiled inside `gfx1013_compute_native.cpp`, which already includes the header, and it is already a native shader revision input. ## Validation Built on Windows with MSVC, head `8b70c6773` on `main` `c42b7ce3f`. - `native_graphics_wqm_ir`, `native_pixel_alpha_kill_controls`, `native_pixel_cmpx_discard_warp`, `native_pixel_compare_mask_ir`, `native_pixel_saveexec_masks_controls`, `native_pixel_cmpx_scalar_tail_controls`, `native_translator_corpus_dxil` and `native_translator_corpus_ir` pass. - Translator corpus (`tests/translator_corpus_hash.py`): the TSV built from `main` `c42b7ce3f` and the TSV built from this branch have the same SHA-256, so they are byte-identical. The corpus is a general regression check; the WQM paths are covered by the targeted tests above. - Each replaced site was also read a second time against the header to confirm the same value and type. ## Other open PRs #3849 (draft) also edits `gfx1013_graphics_wqm.inl`, but only adds a block at the head of the file, above the lines changed here, so there is no overlap. If this lands first and a rebase is needed, I am glad to help.
Replace the magic register numbers in src/gfx1013_graphics_wqm.inl with
the constants from src/gfx1013_registers.h: EXEC (126/127), VCC
(106/107), the last general SGPR (105), the VGPR operand base (256) and
the internal SCC slot written by the numeric WQM lowering (128). The
substitution is textual and the values are unchanged, so the translator
output is byte-identical. The aligned-pair bound 104, the 512 offset of
the saved-coverage tags, export target masks, branch opcodes and IR text
are left as they are. The file is already a native shader revision
input and is compiled inside gfx1013_compute_native.cpp, which includes
the header, so no build change is needed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 23:39:40 +00:00
github-bot changed target branch from main to gh-pr/3901/base 2026-12-02 23:53:00 +00:00
github manually merged commit 8b70c6773f into gh-pr/3901/base 2026-12-02 23:53:06 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 23:50 UTC · original · approved these changes

Reviewed 8b70c677. I checked all seven referenced register constants against gfx1013_registers.h. Substituting their original numeric spellings leaves the same WQM source after whitespace normalization, including the original wave64 alignment bound. The trial merge with main 1c4601ff is clean. At this head the Windows, Linux Python and gfx1013 fixture checks are green.

**@⁠R0Y00** on GitHub · 2026-12-02 23:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3901#pullrequestreview-6161162811) · **approved these changes** Reviewed `8b70c677`. I checked all seven referenced register constants against `gfx1013_registers.h`. Substituting their original numeric spellings leaves the same WQM source after whitespace normalization, including the original wave64 alignment bound. The trial merge with `main` `1c4601ff` is clean. At this head the Windows, Linux Python and gfx1013 fixture checks are green.
This discussion has been locked. Commenting is limited to contributors.
No description provided.