test: allow one 8-bit filter weight step in the linear sampler probes #2786
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2794"
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 tedin7 on 2026-11-26T09:56:33Z.
Part of #1723
What this unblocks:
startup_sampler_x_hardwareandstartup_sampler_x_swapped_hardwarestop failing on GPUs whose texture sampler quantises the LOD weight to a different, spec-legal step (reported on a GeForce GTX 1080 Ti in #2781).What changed
tests/startup_sampler_x.cppcompared linear-filter probes with a fixed 0.01 tolerance. On the GTX 1080 Ti, table 2 probe 3 (u = v = 0.0625, LOD 0.5) read 34.25 where the reference is exactly 34. The two mips differ by 64 there, so 34.25 is a mip weight of 129/256 instead of 128/256: one 1/256 step.The linear tolerance is now
0.01 + (1/256) * (2 * texel range of both 2x2 footprints + gap between the two bilinear results). Point sampling stays exact. The probe coverage check (probes must separate every address mode, LOD limit, sampler and the point filter) is unchanged.Why this is correct
Source: Microsoft DirectX-Specs, D3D11.3 functional spec, "Texture Filtering" (bilinear weights and mip weight need at least 8 fractional bits, so a one-step difference is legal). A wrong filter, wrong LOD clamp or a swapped table still moves the probes by far more than one step.
Verification
x86_64-w64-mingw32-g++ -std=c++20 -fsyntax-only tests/startup_sampler_x.cpp(with the generated shader header stubbed): no errors.startup_sampler_x_hardware,_warpandstartup_sampler_x_swapped_hardwarepass with the old tolerance on that GPU; the new tolerance only widens it.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:36:24Z.
Independent review of head
6ceb980ba(the sampler probe tolerance): PASS.Verification:
ctest -R '^startup_sampler_x': dev 4/4 and release 4/4 (startup_sampler_x_hardware,_warp,_swapped_hardware,_swapped_warp).bilinear(s, mip, p.u + 1.0f / texture_size, p.v)inreference()), all four tests fail on WARP with a value mismatch ("table 2 probe 0 ... expected 3.5, got 2.5"). So a real off-by-one texel still fails.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T10:36:36Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
6ceb980ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by Alexofbulgaria on 2026-11-27T16:43:08Z.
Native Windows hardware verification
Source-built Release at clean head
6ceb980ba65e9cee3ec2a7a5956f336397178829on Windows build26300.10075with MSVC19.44.35230and DXC1.9.2602.17.8086:56a0),32.0.101.917510de:1f14),32.0.15.812910.0.26100.1006810.0.26100.10068Ran each registered
startup_sampler_xandstartup_sampler_x_swappedcase three times per backend usingctest --test-dir <release-build> --no-tests=error -V -R '^startup_sampler_x(_swapped)?_(hardware|warp)$', with hardware and WARP selected in separate runs. Each run had 0 mismatches out of 21. The D3D12 debug layer reported zero errors and warnings throughout.The laptop read 34 at the probe where the GTX 1080 Ti reported 34.25. These results add native Arc and NVIDIA regression coverage for this head.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T18:24:53Z.
Review: APPROVED
Independently reviewed
6ceb980bintegrated overmain429f11d5(treed6733b68, clean merge).What I traced.
tolerance_for()uses the same LOD clamp asreference(), and point samplers stay exact. I also checked that the coverage gate is still meaningful under the wider tolerance. That gate compares linear references with point samples by exact==. For each linear probe, I measured the distance from the reference to the nearest point sample the gate tries (both neighbouring mips, ±1/16 in u and v):So a device that point-samples still fails the comparison, not just the gate.
What I ran. I built
offscreen_checkindevandrelease, then ranctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_sampler_x(_swapped)?_(hardware|warp)$'.4/4 passed in Debug and Release
/O2, with no skips. The hardware and WARP runs both read exactly2.5,6,6.5,34,98on table 2, with 0 mismatches of 21.Mutants. I applied each one to
reference()and ran it on WARP:f = 0.0f): this fails at the coverage gate with "Linear probe matches a point sample".tx = u * n - 0.25finbilinear()): this passes on this head, with 0 mismatches of 21 on both WARP and the RTX 5090.main429f11d5the same mutant fails withtable 2 probe 0 (u=0.125 v=0.0625 lod=0) expected 2.75, got 2.5(5 of 21).git diff --checkis clean.Non-blocking finding. The quarter-texel shift moves the five linear references by 0.25, 0.25, 0.25, 0.125 and 0.125. Each of those is inside its new tolerance (0.27–0.38), so table 2 no longer detects a sub-texel u error that
maincaught. This extends tedin7's note about the one-texel shift at probe 4 to every linear probe.I don't think the formula is wrong. The cause is that one legal mip-weight step across this texture's mip gap of 64 is worth 0.25, while one texel in u is worth only 1. That is why the GTX 1080 Ti reading in #2781 needs the wider window.
A follow-up could restore the sensitivity by changing the fixture rather than the tolerance. One untested direction:
mip gap / 256(today one texel in u is worth 1, one row is worth 8 and one mip is worth 64);This is not a reason to hold the PR. Tolerating the spec-legal step is the point of the change, and the remaining sensitivity is stated above.
Verdict: approve on
6ceb980b.Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP 10.0.26100.9818; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; debug layer on.
CI:
Build and test on Windowspasses on6ceb980b.This reply was AI-assisted.