startup: lower v_pk_min/max_i16 and v_pk_min/max_u16 in gfx2hlsl #3044

Manually merged
github merged 1 commit from github-bot/gh-3044 into gh-pr/3044/base 2026-11-27 11:54:15 +00:00 AGit
Owner

@⁠R0D4X on GitHub · 2026-11-27 10:43 UTC · original
R0D4X:feat/gfx2hlsl-v-pk-minmax-i16-u16 → main · +358 −0 · 4 files · 1 commits · merged 2026-11-27 11:48 UTC

What this changes

  • Lowers gfx1013 VOP3P v_pk_max_i16 (0x07), v_pk_min_i16 (0x08), v_pk_max_u16 (0x0c), and v_pk_min_u16 (0x0d) in tools/startup/gfx2hlsl.py via Stage.packed_half(..., select_bits=True).
  • Supports op_sel and op_sel_hi lane selection, low16_only_v tracking when only low halves are read, and EXEC masking, while refusing clamp, neg_lo, neg_hi, bad op_sel, lane masks, and invalid operands.

Tests added

  • tests/startup_gfx2hlsl_v_pk_minmax_i16_u16_check.py: synthetic VOP3P decode via G.decode() (including reserved src2 rejection), 768-case grid evaluated directly against the emitted HLSL across all 4 ops and 3 op_sel/op_sel_hi modes, EXEC masking, low16_only_v accept/refusal, Stage refusals, unlowered controls, and FXC ps_5_1 + DXC ps_6_0 offscreen readback draws with negative controls.
  • Registered in tests/cmake/startup_gfx2hlsl_v_pk_minmax_i16_u16.cmake and tests/checks/python-linux/startup_gfx2hlsl_v_pk_minmax_i16_u16.txt.

Verification

Commit: 7b95d5da on Windows 11 x64 (10.0.26300.9974), MSVC 19.44.35230, Windows SDK 10.0.26100.0, FXC + DXC 1.9.2602.17, D3D12 debug layer enabled (debug_errors=0 debug_warnings=0):

  • ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_v_pk_minmax_i16_u16|^startup_tools_lint$': 4/4 passed, 0 skipped
    • WARP (Microsoft Basic Render Driver, 1414:008c, driver 10.0.26100.9818): pass
    • Hardware (NVIDIA GeForce RTX 5080, 10de:2c02, driver 32.0.16.2124): pass
  • ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_v_pk_minmax_i16_u16': 3/3 passed, 0 skipped
  • Repo/neighbor checks (docs_links_check.py, bidi_controls_check.py, startup_gfx2hlsl_handler_arity_check.py, startup_gfx2hlsl_pk_minmax_check.py, git diff --check): all passed.

Scope: Covers synthetic v_pk_min/max_i16 and v_pk_min/max_u16 fixtures in the offline gfx2hlsl translator and offscreen D3D12 draw harness; does not establish full-title startup or runtime execution.

**@⁠R0D4X** on GitHub · 2026-11-27 10:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3044) `R0D4X:feat/gfx2hlsl-v-pk-minmax-i16-u16` → `main` · +358 −0 · 4 files · 1 commits · merged 2026-11-27 11:48 UTC ## What this changes - Lowers gfx1013 VOP3P `v_pk_max_i16` (`0x07`), `v_pk_min_i16` (`0x08`), `v_pk_max_u16` (`0x0c`), and `v_pk_min_u16` (`0x0d`) in `tools/startup/gfx2hlsl.py` via `Stage.packed_half(..., select_bits=True)`. - Supports `op_sel` and `op_sel_hi` lane selection, `low16_only_v` tracking when only low halves are read, and `EXEC` masking, while refusing `clamp`, `neg_lo`, `neg_hi`, bad `op_sel`, lane masks, and invalid operands. ## Tests added - `tests/startup_gfx2hlsl_v_pk_minmax_i16_u16_check.py`: synthetic VOP3P decode via `G.decode()` (including reserved `src2` rejection), 768-case grid evaluated directly against the emitted HLSL across all 4 ops and 3 `op_sel`/`op_sel_hi` modes, `EXEC` masking, `low16_only_v` accept/refusal, `Stage` refusals, unlowered controls, and FXC `ps_5_1` + DXC `ps_6_0` offscreen readback draws with negative controls. - Registered in `tests/cmake/startup_gfx2hlsl_v_pk_minmax_i16_u16.cmake` and `tests/checks/python-linux/startup_gfx2hlsl_v_pk_minmax_i16_u16.txt`. ## Verification Commit: `7b95d5da` on Windows 11 x64 (`10.0.26300.9974`), MSVC `19.44.35230`, Windows SDK `10.0.26100.0`, FXC + DXC `1.9.2602.17`, D3D12 debug layer enabled (`debug_errors=0 debug_warnings=0`): - `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_v_pk_minmax_i16_u16|^startup_tools_lint$'`: 4/4 passed, 0 skipped - WARP (`Microsoft Basic Render Driver`, `1414:008c`, driver `10.0.26100.9818`): pass - Hardware (`NVIDIA GeForce RTX 5080`, `10de:2c02`, driver `32.0.16.2124`): pass - `ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_v_pk_minmax_i16_u16'`: 3/3 passed, 0 skipped - Repo/neighbor checks (`docs_links_check.py`, `bidi_controls_check.py`, `startup_gfx2hlsl_handler_arity_check.py`, `startup_gfx2hlsl_pk_minmax_check.py`, `git diff --check`): all passed. *Scope:* Covers synthetic `v_pk_min/max_i16` and `v_pk_min/max_u16` fixtures in the offline `gfx2hlsl` translator and offscreen D3D12 draw harness; does not establish full-title startup or runtime execution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:50:21 +00:00
github-bot changed target branch from main to gh-pr/3044/base 2026-11-27 11:54:14 +00:00
github manually merged commit 7b95d5dad6 into gh-pr/3044/base 2026-11-27 11:54:15 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 11:46 UTC · original · approved these changes

Reviewed 7b95d5da in integration tree 1226e548 on main 1c879506 with the preceding packed-integer PRs in the tested merge order where applicable. python -B tests/startup_gfx2hlsl_v_pk_minmax_i16_u16_check.py passed. Its draw <dxc> <offscreen_check> <warp|hardware> <fxc> invocation passed on WARP and RTX with both Debug and Release /O2 renderers, reusing builds of the unchanged renderer sources. Both signed and unsigned packed halves matched, including selected halves, masked execution, and mutation checks. Windows 11 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, D3D12 debug layer enabled. Hosted Windows, Linux Python and gfx1013 checks passed.

**@⁠R0Y00** on GitHub · 2026-11-27 11:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3044#pullrequestreview-6087650724) · **approved these changes** Reviewed `7b95d5da` in integration tree `1226e548` on `main` `1c879506` with the preceding packed-integer PRs in the tested merge order where applicable. `python -B tests/startup_gfx2hlsl_v_pk_minmax_i16_u16_check.py` passed. Its `draw <dxc> <offscreen_check> <warp|hardware> <fxc>` invocation passed on WARP and RTX with both Debug and Release /O2 renderers, reusing builds of the unchanged renderer sources. Both signed and unsigned packed halves matched, including selected halves, masked execution, and mutation checks. Windows 11 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, D3D12 debug layer enabled. Hosted Windows, Linux Python and gfx1013 checks passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.