startup: remove the unread SAMPLER_CLAMP table from gfx2hlsl #1842

Merged
winne42 merged 1 commit from upstream-pr/1849 into main 2026-11-24 19:48:00 +00:00
winne42 commented 2026-11-24 19:32:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by winne42 on 2026-11-24T19:32:34Z.


Change

Removes SAMPLER_CLAMP from tools/startup/gfx2hlsl.py. Nothing reads it. Refs #1764.

  • It was added with the startup stand-ins (e658fe24) and has never had a reader. After this change, git grep SAMPLER_CLAMP finds nothing.
  • The table that actually applies the clamp modes is decode_sampler() in src/startup_stubs/translated_sampler_bindings.h:26. It has the same eight entries. The translator writes the inline sampler words to the manifest unchanged, as smp/smpc lines (gfx2hlsl.py, manifest writer). The runtime decodes AddressU/V/W from WORD0 bits 2:0, 5:3 and 8:6 through its own modes[8].
  • So editing the Python copy had no effect, as #1764 shows. It only pointed readers at the wrong table. Any future change to clamp-mode mapping belongs in decode_sampler().

No behaviour change. No docs mention the table.

Verification

Commit f5ca2686 on bbadc76d (origin/main). Linux, Python 3.14.8, pefile==2024.8.26, iced-x86==1.21.0.

I ran all 53 checks in the AGENTS.md pure-Python list:

for t in <each tests/*.py in the AGENTS.md pure-Python list>; do ./out/pe-env/bin/python -B "$t"; done

Result: 53 passed, 0 failed. These include the five checks named in #1764: startup_translator_check, startup_inline_sampler_check, startup_sampler_heap_check, startup_flat_param_check and startup_gfx2hlsl_capture_check.

Not run: the Windows ctest targets, including startup_translated_sampler_bindings_check, which calls decode_sampler() (it does not check the address modes). I had no Windows/MSVC environment. This change does not touch C++.

Evidence and follow-up

No new fixture. The change is a deletion, so a negative control does not apply.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture. (No new fixture.)
  • I updated README/docs when a capability or build requirement changed. (No change.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6589779421 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1849). Originally posted by [winne42](https://github.com/winne42) on 2026-11-24T19:32:34Z. --- ## Change Removes `SAMPLER_CLAMP` from `tools/startup/gfx2hlsl.py`. Nothing reads it. Refs #1764. - It was added with the startup stand-ins (`e658fe24`) and has never had a reader. After this change, `git grep SAMPLER_CLAMP` finds nothing. - The table that actually applies the clamp modes is `decode_sampler()` in `src/startup_stubs/translated_sampler_bindings.h:26`. It has the same eight entries. The translator writes the inline sampler words to the manifest unchanged, as `smp`/`smpc` lines (`gfx2hlsl.py`, manifest writer). The runtime decodes `AddressU/V/W` from `WORD0` bits 2:0, 5:3 and 8:6 through its own `modes[8]`. - So editing the Python copy had no effect, as #1764 shows. It only pointed readers at the wrong table. Any future change to clamp-mode mapping belongs in `decode_sampler()`. No behaviour change. No docs mention the table. ## Verification Commit `f5ca2686` on `bbadc76d` (`origin/main`). Linux, Python 3.14.8, `pefile==2024.8.26`, `iced-x86==1.21.0`. I ran all 53 checks in the AGENTS.md pure-Python list: ```bash for t in <each tests/*.py in the AGENTS.md pure-Python list>; do ./out/pe-env/bin/python -B "$t"; done ``` Result: 53 passed, 0 failed. These include the five checks named in #1764: `startup_translator_check`, `startup_inline_sampler_check`, `startup_sampler_heap_check`, `startup_flat_param_check` and `startup_gfx2hlsl_capture_check`. Not run: the Windows ctest targets, including `startup_translated_sampler_bindings_check`, which calls `decode_sampler()` (it does not check the address modes). I had no Windows/MSVC environment. This change does not touch C++. ## Evidence and follow-up No new fixture. The change is a deletion, so a negative control does not apply. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. (No new fixture.) - [x] I updated README/docs when a capability or build requirement changed. (No change.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 20:01:00 +00:00
tedin7 commented 2026-11-24 20:01:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:36:51Z.

Review: COMMENTED


Peer review of head f5ca26865db1259a8da89f135a3233e09d938d37.

Result: no P1/P2 defects found in the local verification.

The change deletes the module-level SAMPLER_CLAMP dictionary (3 lines) from tools/startup/gfx2hlsl.py.

  • git grep -n -i SAMPLER_CLAMP on this head finds nothing in the whole repository (tools, tests, docs, workflows, CMake), and on origin/main the only hit is the definition at tools/startup/gfx2hlsl.py:138. No other module reads it by attribute or by string.
  • Importing the module from this tree works, and hasattr(gfx2hlsl, 'SAMPLER_CLAMP') is false, as intended.
  • The inline-sampler lowering does not use the table; its address-mode handling is covered by tests/startup_inline_sampler_check.py (below).

Win2025 (coordinator run, Windows Server 2025 build 26100, MSVC 14.44, auto-selected targets): ctest -R '^startup_translator$' passed 1/1 in Debug dev (0.17 s) and in Release /O2 (0.19 s); the Windows Python check tests/startup_translator_check.py also exited 0.

Linux checks run locally in a clean worktree at this head:

  • git diff --check origin/main...HEAD: clean
  • tests/bidi_controls_check.py: passed (1324 files)
  • tests/startup_translator_check.py: 0 failed
  • tests/startup_inline_sampler_check.py: passed (clamp and wrap fold to the expected sampler words; the unsupported descriptor operand is still refused)
  • tests/docs_links_check.py was not run: the PR changes no Markdown.

No mutation was run: the PR only removes an unreferenced constant, and the grep above is the evidence that nothing depends on it.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046050012 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1849#pullrequestreview-6046050012). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:36:51Z. **Review:** COMMENTED --- Peer review of head `f5ca26865db1259a8da89f135a3233e09d938d37`. **Result: no P1/P2 defects found in the local verification.** The change deletes the module-level `SAMPLER_CLAMP` dictionary (3 lines) from `tools/startup/gfx2hlsl.py`. - `git grep -n -i SAMPLER_CLAMP` on this head finds nothing in the whole repository (tools, tests, docs, workflows, CMake), and on `origin/main` the only hit is the definition at `tools/startup/gfx2hlsl.py:138`. No other module reads it by attribute or by string. - Importing the module from this tree works, and `hasattr(gfx2hlsl, 'SAMPLER_CLAMP')` is false, as intended. - The inline-sampler lowering does not use the table; its address-mode handling is covered by `tests/startup_inline_sampler_check.py` (below). Win2025 (coordinator run, Windows Server 2025 build 26100, MSVC 14.44, auto-selected targets): `ctest -R '^startup_translator$'` passed 1/1 in Debug `dev` (0.17 s) and in Release `/O2` (0.19 s); the Windows Python check `tests/startup_translator_check.py` also exited 0. Linux checks run locally in a clean worktree at this head: - `git diff --check origin/main...HEAD`: clean - `tests/bidi_controls_check.py`: passed (1324 files) - `tests/startup_translator_check.py`: 0 failed - `tests/startup_inline_sampler_check.py`: passed (clamp and wrap fold to the expected sampler words; the unsupported descriptor operand is still refused) - `tests/docs_links_check.py` was not run: the PR changes no Markdown. No mutation was run: the PR only removes an unreferenced constant, and the grep above is the evidence that nothing depends on it. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1842
No description provided.