gpu: CreateSamplerX sampler contract check and toolchain paths #1180

Closed
github-bot wants to merge 2 commits from gh-pr/1180/head into gh-pr/1180/base
Owner

@⁠KelboLive on GitHub · 2026-11-24 02:42 UTC · original
KelboLive:gpu/startup-sampler-x → main · +433 −3 · 7 files · 2 commits · closed without merging

gpu: add startup_sampler_x fixture for CreateSamplerX sampler contract (#874)

Source-built fixture that checks the desktop D3D12_SAMPLER_DESC fields
a translated sampler must reproduce. The console descriptor layout is not
established here.

What this tests

A cs_6_0 shader runs one SampleLevel per dispatch on an 8x8 R32_FLOAT
texture with four mips and unique texel values. Two point samplers
(WRAP/MIRROR with LOD 1–2, CLAMP/BORDER with LOD 0) and one
MIN_MAG_MIP_LINEAR sampler are compared against a CPU reference. A
pre-dispatch check requires the probes to separate every non-default
field. The swapped control writes the two point samplers into each
other's slots and must read back the other sampler's rows.

Evidence

ctest --preset dev --no-tests=error -R '^startup_sampler_x_' -V

Passes 4/4 in Debug and Release on WARP and an RTX adapter. Dropping
MinLOD, copying AddressU into AddressV, and forcing the linear filter
to point each fail on both adapters.

build: add MSVC include and lib paths to CMake presets

Ensures MSVC headers and libraries are resolvable by the presets.

Refs: #874

**@⁠KelboLive** on GitHub · 2026-11-24 02:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1180) `KelboLive:gpu/startup-sampler-x` → `main` · +433 −3 · 7 files · 2 commits · closed without merging ## gpu: add startup_sampler_x fixture for CreateSamplerX sampler contract (#874) Source-built fixture that checks the desktop D3D12_SAMPLER_DESC fields a translated sampler must reproduce. The console descriptor layout is not established here. ### What this tests A cs_6_0 shader runs one SampleLevel per dispatch on an 8x8 R32_FLOAT texture with four mips and unique texel values. Two point samplers (WRAP/MIRROR with LOD 1–2, CLAMP/BORDER with LOD 0) and one MIN_MAG_MIP_LINEAR sampler are compared against a CPU reference. A pre-dispatch check requires the probes to separate every non-default field. The swapped control writes the two point samplers into each other's slots and must read back the other sampler's rows. ### Evidence ``` ctest --preset dev --no-tests=error -R '^startup_sampler_x_' -V ``` Passes 4/4 in Debug and Release on WARP and an RTX adapter. Dropping MinLOD, copying AddressU into AddressV, and forcing the linear filter to point each fail on both adapters. ## build: add MSVC include and lib paths to CMake presets Ensures MSVC headers and libraries are resolvable by the presets. Refs: #874
Add startup_sampler_x, a source-built fixture for the CreateSamplerX row
of #874. It checks only the desktop D3D12_SAMPLER_DESC fields a
translated sampler must reproduce; the console descriptor layout is not
established here.

A cs_6_0 shader runs one SampleLevel per dispatch on an 8x8 R32_FLOAT
texture with four mips and unique texel values. Two point samplers
(WRAP/MIRROR with LOD 1-2, CLAMP/BORDER with LOD 0) and one
MIN_MAG_MIP_LINEAR sampler are compared against a CPU reference. A
pre-dispatch check requires the probes to separate every non-default
field. The swapped control writes the two point samplers into each
other's slots and must read back the other sampler's rows.

ctest --preset dev --no-tests=error -R '^startup_sampler_x_' -V
passes 4/4 in Debug and Release on an RTX 4090 (32.0.16.1088) and WARP
(10.0.26100.9818), Windows 11 build 26300.9974, debug layer unavailable.
Dropping MinLOD, copying AddressU into AddressV, and forcing the linear
filter to point each fail on both adapters.

Refs #874

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:46:42 +00:00
github-bot closed this pull request 2026-11-26 22:46:42 +00:00
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 10:22 UTC · original

The fixture part already landed, and the only new hunk hard-codes one machine's toolchain

Independent reviewer, not the author. I did not touch the branch. Reviewed bfcf5f28.

1. The fixture is a duplicate of what is already on main

tests/startup_sampler_x.cpp and tests/startup_sampler_x.hlsl on this branch are byte-identical to the versions
on main — I compared the two blobs directly (353 lines each, equal). The same is true of every startup_sampler_x
line in CMakeLists.txt (11 lines on both, identical), and docs/experiments.md on main already contains the
startup_sampler_x text twice, exactly as here.

That landed through #1121, which was merged after this branch was cut: the merge-base is 78a6b31e and the branch is
762 commits behind main. After a rebase this PR's diff should be empty for those six files.

For the record, the merged fixture is sound on hardware — I ran it on three backends while reviewing #1121:
startup_sampler_x and startup_sampler_x_swapped pass on the NVIDIA RTX 5080 Laptop (32.0.15.8142), the Intel Arc
140T (32.0.101.8132) and in-box WARP (10.0.26100.9818), with the swapped controls tripping as intended. So the content
is fine; it is simply already in main.

2. CMakePresets.json bakes absolute paths from one installation

The remaining hunk sets, for both dev and release:

CMAKE_CXX_COMPILER        = C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/...
CMAKE_CXX_FLAGS           = /I"...VC/Tools/MSVC/14.44.35207/include" /I"...Windows Kits/10/Include/10.0.26100.0/..."
CMAKE_EXE_LINKER_FLAGS    = /LIBPATH:"...VC/Tools/MSVC/14.44.35207/lib/x64" /LIBPATH:"...Lib/10.0.26100.0/..."

Those paths only exist on a machine with that exact Visual Studio 2022 Community install and that exact MSVC
version. The Windows CI job, a BuildTools or Enterprise install, or a later MSVC would all fail to configure. The
presets currently work because .\tools\dev.ps1 puts the toolchain on PATH and cmake --preset dev takes cl from
there; naming an absolute compiler and passing raw /I and /LIBPATH flags also bypasses the CMake toolchain logic
that normally supplies them.

If the underlying problem is that a plain cmake --preset dev cannot find cl on your machine, the portable fixes are
to run it from the developer prompt (tools/dev.ps1) as the README says, or to document that requirement — not to
commit one install's paths. That deserves its own small PR if you want it.

3. Verdict

Not mergeable as it stands: the fixture half duplicates main, and the presets half would break other machines and CI.
Concretely:

  • rebase on main and drop the six duplicated files;
  • drop the CMakePresets.json CMAKE_CXX_COMPILER, CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS entries;
  • if you still need a toolchain-location fix, send it separately and describe the failure it solves.

Happy to re-run the fixture on the same three adapters from a rebased branch if that is useful — it takes a minute.

**@⁠ChazY11** on GitHub · 2026-11-24 10:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1180#issuecomment-7128683626) ## The fixture part already landed, and the only new hunk hard-codes one machine's toolchain Independent reviewer, not the author. I did not touch the branch. Reviewed `bfcf5f28`. ### 1. The fixture is a duplicate of what is already on main `tests/startup_sampler_x.cpp` and `tests/startup_sampler_x.hlsl` on this branch are **byte-identical** to the versions on `main` — I compared the two blobs directly (353 lines each, equal). The same is true of every `startup_sampler_x` line in `CMakeLists.txt` (11 lines on both, identical), and `docs/experiments.md` on main already contains the `startup_sampler_x` text twice, exactly as here. That landed through #1121, which was merged after this branch was cut: the merge-base is `78a6b31e` and the branch is 762 commits behind `main`. After a rebase this PR's diff should be empty for those six files. For the record, the merged fixture is sound on hardware — I ran it on three backends while reviewing #1121: `startup_sampler_x` and `startup_sampler_x_swapped` pass on the NVIDIA RTX 5080 Laptop (32.0.15.8142), the Intel Arc 140T (32.0.101.8132) and in-box WARP (10.0.26100.9818), with the swapped controls tripping as intended. So the content is fine; it is simply already in `main`. ### 2. `CMakePresets.json` bakes absolute paths from one installation The remaining hunk sets, for both `dev` and `release`: ```text CMAKE_CXX_COMPILER = C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/... CMAKE_CXX_FLAGS = /I"...VC/Tools/MSVC/14.44.35207/include" /I"...Windows Kits/10/Include/10.0.26100.0/..." CMAKE_EXE_LINKER_FLAGS = /LIBPATH:"...VC/Tools/MSVC/14.44.35207/lib/x64" /LIBPATH:"...Lib/10.0.26100.0/..." ``` Those paths only exist on a machine with that exact **Visual Studio 2022 Community** install and that exact MSVC version. The Windows CI job, a BuildTools or Enterprise install, or a later MSVC would all fail to configure. The presets currently work because `.\tools\dev.ps1` puts the toolchain on `PATH` and `cmake --preset dev` takes `cl` from there; naming an absolute compiler and passing raw `/I` and `/LIBPATH` flags also bypasses the CMake toolchain logic that normally supplies them. If the underlying problem is that a plain `cmake --preset dev` cannot find `cl` on your machine, the portable fixes are to run it from the developer prompt (`tools/dev.ps1`) as the README says, or to document that requirement — not to commit one install's paths. That deserves its own small PR if you want it. ### 3. Verdict Not mergeable as it stands: the fixture half duplicates `main`, and the presets half would break other machines and CI. Concretely: - rebase on `main` and drop the six duplicated files; - drop the `CMakePresets.json` `CMAKE_CXX_COMPILER`, `CMAKE_CXX_FLAGS` and `CMAKE_EXE_LINKER_FLAGS` entries; - if you still need a toolchain-location fix, send it separately and describe the failure it solves. Happy to re-run the fixture on the same three adapters from a rebased branch if that is useful — it takes a minute.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 10:36 UTC · original

Thanks for contributing the sampler fixture. #1121 already brought both fixture files into main, and I verified that their contents match this head. The remaining preset change pins compiler, include and link paths to one Visual Studio installation. I'm closing this duplicate so the sampler work stays with #1121. A portable build-path fix can be reviewed separately if the developer-shell setup still reproduces the failure.

**@⁠R0Y00** on GitHub · 2026-11-24 10:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1180#issuecomment-7128997597) Thanks for contributing the sampler fixture. #1121 already brought both fixture files into main, and I verified that their contents match this head. The remaining preset change pins compiler, include and link paths to one Visual Studio installation. I'm closing this duplicate so the sampler work stays with #1121. A portable build-path fix can be reviewed separately if the developer-shell setup still reproduces the failure.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:51 UTC · original · reviewed

Review of bfcf5f28b3a59423abda6bc3e387e413c137570d (Linux):

  • tests/startup_sampler_x.cpp and startup_sampler_x.hlsl: clean cs_6_0 sampler contract fixture with check_probe_coverage() verifying probe separation and a swapped-slot negative control (startup_sampler_x_swapped_*).
  • CMakePresets.json: hardcoding local VS 2022 Community (14.44.35207) and Windows SDK (10.0.26100.0) include/lib/compiler paths will break builds on other VS editions, toolset versions, or SDK installs (and tools/dev.ps1 already sets up the environment). Consider keeping the presets portable.
  • Linux checks run and passed: docs_links_check.py (246 links), bidi_controls_check.py (930 files), gpu_report_format_check.py (10 tests), xgameruntime_table_check.py, and JSON validation of CMakePresets.json.
  • Note: no CI checks are reported on this branch yet, and Windows MSVC/DXC/WARP/hardware execution was not run here.
**@⁠tedin7** on GitHub · 2026-11-24 02:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1180#pullrequestreview-6032952731) · **reviewed** Review of `bfcf5f28b3a59423abda6bc3e387e413c137570d` (Linux): - `tests/startup_sampler_x.cpp` and `startup_sampler_x.hlsl`: clean `cs_6_0` sampler contract fixture with `check_probe_coverage()` verifying probe separation and a swapped-slot negative control (`startup_sampler_x_swapped_*`). - `CMakePresets.json`: hardcoding local VS 2022 Community (`14.44.35207`) and Windows SDK (`10.0.26100.0`) include/lib/compiler paths will break builds on other VS editions, toolset versions, or SDK installs (and `tools/dev.ps1` already sets up the environment). Consider keeping the presets portable. - Linux checks run and passed: `docs_links_check.py` (246 links), `bidi_controls_check.py` (930 files), `gpu_report_format_check.py` (10 tests), `xgameruntime_table_check.py`, and JSON validation of `CMakePresets.json`. - Note: no CI checks are reported on this branch yet, and Windows MSVC/DXC/WARP/hardware execution was not run here.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.