gpu: make DXR opacity TMin configurable #1855
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1862"
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 FAJIFBEFJHA on 2026-11-24T19:44:20Z.
Change
Refs #1011
Add an optional
--tmin <value>to the--dxr-opacityand--dxr-opacity-pipelineoperations ofoffscreen_checkso one build can sweep TMin on inline RayQuery and DispatchRays. Both operations print the effective value asdxr_opacity_tmin.The CLI accepts finite values in
[0, 0.5]and rejects invalid arguments with exit code2before D3D12 setup. The fixture's intersections lie at distances1through4in either direction, withTMax=8, so the independent reference table applies throughout the supported range. The default remains0.25. The four CTest invocations and the strict origin-relative distance checks keep their existing behavior.Verification
Tested
90d39cadb27c91d5d2096654f1a02117db615736based on813045b3c13f7bad20d8577557b621ee869ccbba.26300.9974, MSVC19.52.37029.0, Windows SDK10.0.26100.0, DXC1.8.2502.11, CMake/CTest4.3.1-msvc1and Python3.13.5.1002:7480, driver32.0.32029.2010) and in-box WARP (1414:008c, driver10.0.26100.9818). Both reported DXR Tier 1.1 and SM 6.5 in the fixture query. The D3D12 debug layer was enabled and reported zero errors and warnings on every DXR run.Both builds and both CLI self-tests passed. CTest reported 3 DXR PASS, 1 known DXR FAIL and 0 SKIP.
dxr_opacity_hardwarereproduced the 41 committed-distance mismatches at the default TMin, so CTest exited8. The DispatchRays hardware test and both WARP tests passed. All four matched their explicit--tmin 0.25counterparts. All 29 invalid invocations returned2before D3D12 setup, including the NaN example above. The documentation link check andgit diff --checkpassed.Run the sweep from the same checkout with the Debug executable:
Each cell gives the status and mismatch count per run. The three serial repetitions agreed (30 PASS, 6 FAIL, 0 SKIP). The CPU reference reported 126 rays, 94 hits, 42 shader commits, 32 misses and 36 first-hit rays on every run. WARP inline recorded the existing 11
warp_after_commitcases per run.I also repeated the Debug and Release builds, both CLI self-tests, the registered DXR tests, all 36 sweep runs, the 29 invalid invocations and the link check after a local test merge into upstream
fb8947f0. The upstream change touched a startup wrapper linked byoffscreen_check. The test merge produced treedf8578950f9761d41b35a84222ce058e31abcd83and matched the results above.Run the verification commands from that checkout. Pass the existing virtual environment's Python executable as
-DINTAKE_PYTHON:FILEPATH=<path>when configuring and use that same executable for the documentation link check.Evidence and follow-up
The six RX 7600 inline failures each reported
mismatches=41 committed_hit=41 committed_t_plus_tmin=41. At TMin0.25this reproduces the pre-change result on the same RX 7600. Pre-change observationThe first mismatch was ray 1. Its candidate-at-commit distance was
1, matching the reference, and its final distance was1.25at TMin0.25and1.5at TMin0.5. The zero case is a diagnostic control because an added zero leaves the distance unchanged. The fixture's existing synthetic control verifies that a fixed+0.25committed-distance error fails. Reproduction notesChecklist
AI-assisted (Codex and ChatGPT).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:49:48Z.
Review: COMMENTED
Review of
90d39cad(merge base813045b3;origin/mainis now5a6ad936, andgit merge-treemerges cleanly). Comment only, not an approval.Verdict
No P1 or P2 found. The argument parser rejects what it should, and the claim that the reference table holds across the supported range checks out on Linux. Two P3 notes. Clean-room: synthetic geometry and the existing fixture only.
What I ran on Linux
dxr_opacity_reference.his plain C++, so I built it withg++ 14.2(-std=c++20) and calledfirst_reference_mismatch(rays(t)):I also copied
parse_dxr_opacity_tminout ofoffscreen_check.cppunchanged into a harness (libstdc++, not the MSVC library the author used):0,-0,0.25,0.5,5e-1; rejected"",-0.1,0.51,0.50000001,1,nan,inf,1e999,1e-100,1e-50,0,25,0.25x,+0.25, a leading space and0x1p-2. 0 mismatches.isfinite(nan), noend != last(0.25x,0,25), noerrorcheck ("",1e999),>changed to>=(0.5), no negative check (-0.1), and the float-underflow guard (1e-100). Note thatnanpasses the range tests on its own, soisfiniteis doing real work, and the self-test does cover it.Other reading
check_dxr_opacity,rays(nearT),first_reference_mismatch(probes)) have no other callers:git grepfinds onlydxr_opacity.cpp,offscreen_check.cppand the header (the facing fixture has its own copy).--tminis accepted only for the two opacity ops (--dual-uav --tmin 0.25is a usage error in the self-test, and0.25default is kept for the four CTest entries).nearT, so it keeps failing the same way at any TMin.P3
run_dxr_opacitydecides pipeline versus inline by comparingargv[2]to the string--dxr-opacity-pipeline, not by which table entry ran. If an alias or a rename is added tokOperations, the two can disagree and a pipeline run silently becomes inline. Two thin wrappers (as before) would keep that in the table.dxr_opacity_tminis printed before the reference check, so a run that fails the reference still prints a value; useful, just note it is the requested value, not a measured one.Commands run (Linux, g++ 14.2, Python 3.14.8)
python -B tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 369 links.python -B tests/bidi_controls_check.py: Self-test passed. Checked 1320 tracked source, script and build/CI files: no bidirectional controls.git diff --check origin/main...HEAD: clean.Not run
offscreen_checkitself, the--self-test, CTest and every D3D12/DXR run (no Windows, MSVC or DXC here). The RX 7600 and WARP tables in the description are the author's results; I did not reproduce them. The parser was checked with libstdc++, whosefrom_charscan differ from MSVC on out-of-range text; the in-tree self-test is what pins the MSVC behaviour.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:08:36Z.
Review: COMMENTED
Reviewed head
397caf1fe29a1a7209595c6fc662c8d5207cb0a7in a clean Linux worktree. (The earlier review comment on this PR was for an older commit.)git diff --check origin/main...HEAD: clean (rc 0)python -B tests/docs_links_check.py: rc 0python -B tests/bidi_controls_check.py: rc 0No Python test is touched. The tests are C++ and Windows-only, so I could not build or run them here. This is source analysis. Win2025 results are still needed.
Findings: 0 P1, 0 P2.
What I checked:
parse_dxr_opacity_tmin:from_charsmust consume the whole string, so0.25x,0,25and the empty string are refused. It parses as double and bounds-checks before rounding, so0.50000001is refused. Non-finite values and1e999are refused. A value that rounds to 0.0f without being zero (for example1e-100) is refused.-0is normalized to +0.0f.--tmin. A dangling--tmin, a repeated--tminand other flags are usage errors.run_dxr_opacity_fixturecalls.value()only aftervalidate_dxr_opacity_argshas passed.[0, 0.5]stays strictly below the nearest hit at distance 1, so the hand-derived table still holds.first_reference_mismatch(probes)andevaluatenow use the ray's ownnearT, and the same value goes into the GPU ray buffer.check_dxr_opacityanddxr_opacity::raysisoffscreen_check.cpp, which the PR updates. The header is self-contained (#pragma once, all inline or constexpr), so including it inoffscreen_check.cppshould not cause duplicate definitions.<adapter> <operation> --tmin <value>), and the wording is neutral.Observation, not a defect: on a conforming driver, any TMin in
[0, 0.5]gives identical hits. So the plumbing from the CLI value to the GPU ray buffer shows up only through thecommitted_t_plus_tmindiagnostic on the affected hardware. The self-test does cover the parsing and bounds.Suggested Win2025 run:
ctest --preset dev --no-tests=error -R '^(offscreen_capability_table_self_test|dxr_opacity_(pipeline_)?(hardware|warp))$' -V. Optionally alsooffscreen_check.exe warp --dxr-opacity --tmin 0and--tmin 0.5, and the pipeline variant.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by FAJIFBEFJHA on 2026-11-24T20:02:08Z.
@tedin7, following up on your review.
Thanks for the review. In
397caf1f, eachkOperationsentry now selects its own thin wrapper for inline RayQuery or DispatchRays. Both wrappers share the existing TMin parser and fixture call.Debug and Release builds and CLI self-tests passed. The four DXR CTest results and all 36 sweep runs matched
90d39cad, including the known RX 7600 inline failures at positive TMin.Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:06:32Z.
Ran the CLI on this machine
At the PR head, Windows 11 build 26300.9974, in-box WARP 10.0.26100.9818:
--tmindxr_opacity_tmin=0.250dxr_opacity_tmin=00.25dxr_opacity_tmin=0.250.5dxr_opacity_tmin=0.50.5000001-1naninf-0dxr_opacity_tmin=0--tminwith no valueSo the range is enforced at both ends, the default is unchanged,
isfiniterejectsnan/infbefore D3D12 setup, and thetwo boundaries are accepted rather than off-by-one.
-0parsing as0and being accepted is correct (it is in range).Correction on my own first attempt: I first ran
offscreen_check --dxr-opacity --tmin 0.5and got exit 2 for every value,including the legal ones. That is the parser requiring
argc == 5withargv[3] == "--tmin", i.e.<mode>first — myinvocation was wrong, not the patch. Anyone repeating this should copy the form from
CMakeLists.txtline 1517.Two small things
--tminis only accepted after the operation name.offscreen_check warp --tmin 0.5 --dxr-opacitypresumably fails theargv[3]check and exits 2 with the same code as an out-of-range value. That is fine, but the usage error and the rangeerror share exit code 2 and (from what I can see) the same path, so a caller scripting a sweep cannot tell "I put the flag in
the wrong place" from "0.6 is not allowed". If the message distinguishes them on stderr, ignore this note.
[0, 0.5]because of the fixture's distances (1..4, TMax=8), not because of anything the CLIenforces. That reasoning is in the description and is the right place for it; it might also belong as a comment next to
the range check, since the next person to widen the range will look there.
Verdict
Reviewed. The feature does what the description says on WARP, the boundaries and the invalid inputs behave, and the default
is untouched. No objections.
Notes