gpu: check the desktop sampler contract for CreateSamplerX #1114
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1121"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-24T01:21:42Z.
Change
Adds
startup_sampler_x, a source-built fixture for theCreateSamplerXdesktop sampler contract row in #874. Refs #874, #870.It checks only the desktop side: the
D3D12_SAMPLER_DESCfields a translated sampler must reproduce. It doesn't implementCreateSamplerXor map a console descriptor to a desktop one. The public XCL notes listCreateSamplerXas console device slot #61 with a 0x6C-byte descriptor, but give no field layout, so none is assumed here. The shim and its exports are unchanged.A
cs_6_0shader makes oneSampleLevelcall per dispatch through a one-sampler descriptor table. It reads an 8×8R32_FLOATtexture with four mips, where each texel holds the unique value2 + 64·mip + 8·y + x.startup_sampler_x_swapped_*writes A and B into each other's descriptor slots and must read back exactly the other sampler's rows.FAIL_REGULAR_EXPRESSIONcatches a swapped run that did not actually swap.R32_FLOATdoes not report shader sampling with mips.Overlap: #1091 adds a static sampler inside a root signature. This PR uses only descriptor-table samplers and touches none of its files.
Verification
Tested on base
78a6b31eplus this commit (662b77fd); the branch merges cleanly with currentmain(32f63f9e). Environment: Windows 11 build 26300.9974, MSVC 19.44.35230.Both adapters returned the same values:
66,68,68,74,74,76,139,1392,9,2,1,1,1,38,382.5,6,6.5,34,98The swapped run returned the A and B rows in reverse order, with C unchanged. No capability skips.
Mutations. Each was a one-line local edit to
desktop_sampler(), not committed. Each failed on both adapters:desc.MinLOD = 0.0fdesc.AddressV = s.udesc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINTThe neighbouring tests also pass:
offscreen_capability_table_self_test,offscreen_invalid_operation_warp,descriptor_heap_paging_*anddescriptor_window_*. 14 of 14 tests passed in Debug.tests/docs_links_check.pyandtests/bidi_controls_check.pypass.Not run: the D3D12 debug layer is not available on this machine, so debug-layer validation was not checked. A retest with Graphics Tools or
OFFSCREEN_AGILITY_620_DIRwould cover it.Evidence and follow-up
SampleLevel, because it supplies no derivatives.CreateSamplerX" indocs/experiments.md.Checklist
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:02:53Z.
Review: COMMENTED
Reviewed at
e672bd10cbdcd63cbbd12b812df76e9470aa6ee1(diff +tests/startup_sampler_x.cpp,tests/startup_sampler_x.hlsl,tests/offscreen_check.cpp,docs/experiments.md).check_probe_coverage()self-check cleanly verifies that every non-defaultAddressU/AddressV/MinLOD/MaxLODfield and linear-vs-point result is separated by the probes, and negative wrapping inaddress()(WRAP/MIRROR) plus the swapped-slot control (FAIL_REGULAR_EXPRESSION) look solid.docs/experiments.mdis updated with the exact commands, measured/unmeasured fields, and stays title-neutral.python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py,python3 -B tests/gpu_report_format_check.py,python3 -B tests/xgameruntime_table_check.py— all passed.startup_sampler_x_*execution were not run locally on this Linux host and rely on CI (currently pending on this head).Imported from R0Y00/Xbox2Windows. Originally posted by Toons29 on 2026-11-24T01:37:46Z.
Tested
662b77fdon an AMD Radeon RX 9070 (RDNA 4,1002:7550), driver32.0.32029.2010, Windows 11 build 26300,devpreset, debug layer unavailable: pass, as a third vendor next to WARP and RTXAll four pass (
startup_sampler_x_hardware,_swapped_hardware,_warp,_swapped_warp), with no skips, and each reportsmismatches=0 of 21.10.0.26100.981866,68,68,74,74,76,139,1392,9,2,1,1,1,38,382.5,6,6.5,34,98In the swapped runs, tables 0 and 1 trade places on both adapters, and table 2 is unchanged. The linear row comes out exactly the same on AMD and WARP, so the 0.01 tolerance isn't used here.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T01:46:40Z.
Independent verification on three backends, including an Intel Xe2 adapter
Reviewed
662b77fd(your head, based on78a6b31e; GitHub reports the PR mergeable against currentmain).Independent reviewer, not the author — I did not touch the branch, and I report only what I ran.
Environment: Windows 11 build 26300.9974, x64, Core Ultra 9 285H; MSVC 14.44.35207, Windows SDK 10.0.26100,
DXC 1.8.2502.11, CMake+Ninja from the VS component, Python 3.12.10. Debug layer enabled in every run and the fixture
printed zero debug warnings and errors.
startup_sampler_x_swapped_warp_swapped_warpHardware runs used
XBOX2WINDOWS_ADAPTER=NVIDIAand=Intel; WARP runs take the in-box adapter. Bothswappedvariants passed on every adapter, so the AddressU/AddressV/MinLOD separation controls you built trip as intended
rather than merely not being exercised.
Regression on the same build, because the change touches
tests/offscreen_check.cppandtests/desktop_gpu.h:Fixture provenance, as a reviewer has to check: the diff is
CMakeLists.txt,docs/experiments.md,tests/desktop_gpu.h,tests/offscreen_check.cpp,tests/startup_sampler_x.cpp,tests/startup_sampler_x.hlsl—source only, no game data, dumps or distribution links, and the texture contents are computed in
texel_value.One caveat worth recording, not a defect in this change
startup_sampler_x.cppsays "Point probes use integer LODs, so nearest-mip rounding is not exercised", and the Arcrun confirms it: on this adapter a
MinLODclamp rounds down where the RTX and WARP round to the nearest mip(
1.5625reads mip 1 on the Arc, mip 2 on the other two; 19-clamp table in#809). Your probe LODs land on exact values after the clamp, so
both rules agree and the fixture is immune.
If a later case adds a fractional LOD under a
MinLODclamp, the reference'smip = static_cast<UINT>(lod)would thendisagree with this adapter, and the case would fail for a reason that has nothing to do with the sampler contract this
fixture is measuring. Deriving the expected mip from one measured probe, or keeping fractional-LOD cases out of this
fixture, keeps that from looking like a
CreateSamplerXregression later.Verdict
Verified, no objection from me. The desktop-side scope is stated honestly in your description (no console descriptor
layout assumed, no shim change), the fixture is deterministic on all three adapters here, and the negative controls
hold.
Happy to re-run on the same machine after a rebase; the only thing I could not check is the console side, which this
change does not claim to implement.