gpu: CreateSamplerX sampler contract check and toolchain paths #1173

Closed
KelboLive wants to merge 2 commits from upstream-pr/1180 into main
KelboLive commented 2026-11-24 02:42:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-24T02:42:31Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6573415877 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1180). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-24T02:42:31Z. --- ## 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
tedin7 commented 2026-11-24 06:46:44 +00:00 (Migrated from github.com)

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

Review: COMMENTED


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032952731 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1180#pullrequestreview-6032952731). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:51:25Z. **Review:** COMMENTED --- 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.
upstream-sync closed this pull request 2026-11-24 11:02:32 +00:00
ChazY11 commented 2026-11-24 11:02:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T10:22:14Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128683626 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1180#issuecomment-7128683626). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T10:22:14Z. --- ## 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.
R0Y00 commented 2026-11-24 11:03:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:36:07Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128997597 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1180#issuecomment-7128997597). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T10:36:07Z. --- 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.

Pull request closed

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!1173
No description provided.