Compare DXR face culling with a CPU reference under mirrored instances #117
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/118"
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 Vonsek on 2026-11-21T16:31:37Z.
Change
Adds
dxr_facing_warpanddxr_facing_hardware, a differential check of triangle facing and face culling between a CPU reference and inline DXR queries. The existing DXR fixtures only trace withRAY_FLAG_NONE.One two-triangle BLAS is instanced seven times: plain,
TRIANGLE_FRONT_COUNTERCLOCKWISE,TRIANGLE_CULL_DISABLE, and mirrored on x, y or z with non-uniform scale. Each instance receives twelve rays covering both triangles, both directions along world z, andRAY_FLAG_NONE,RAY_FLAG_CULL_BACK_FACING_TRIANGLESandRAY_FLAG_CULL_FRONT_FACING_TRIANGLES. For each of the 84 rays the shader reports hit status,CommittedTriangleFrontFace, instance ID, primitive index and distance.ray_query.hlslanddxr_fixture::Raygain a per-ray flags word. Existing callers pass zero, which keeps their trace and output unchanged.Verification
At
17cf485(rebased on main with #99) on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100 (DXC): the first command passed 2/2 and the second 12/12.dxr_tier=12:dxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0dxr_tier=11:dxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0Both report
debug_layer=unavailable, so no debug-layer messages were checked.On Linux the header-only reference compiled with
g++ -std=c++17 -Wall -Wextra -pedanticand agreed with the hand-derived table on all 84 rays: 64 hits, 32 front facing, 20 culled.Evidence and follow-up
The fixture is synthetic and original to this repository (MIT). Expected values come from
tests/dxr_facing_reference.h, which moves each ray into object space, intersects every triangle in double precision and applies three rules from the DXR specification: clockwise from the ray origin in a left-handed frame is front facing, winding is evaluated in object space so a negative-determinant instance transform does not change facing, and both cull flags have no effect on a cull-disabled instance. The test first checks that reference against a hand-derived table of front and back letters. A world-space winding test would disagree on 48 of the 84 rays, all on the mirrored instances. Ray flags · Instance flagsStatus, facing, instance and primitive must match exactly. Hit distances of 2 or 3 may differ by 1e-5 relative. Rays cross triangle interiors inside the distance interval, so edge and endpoint rules are out of scope. The custom BVH shader has no facing rule and is not part of this comparison. The test skips below DXR tier 1.1 or Shader Model 6.5. The D3D12 debug layer was not available on the test machine.
Reproduction details are in docs/experiments.md. Follow-up another contributor can pick up: add
dxr-facingto the standalone GPU package runner, and run the test on AMD and Intel adapters.Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-21T16:49:19Z.
Second Windows run at
909d9b5, on a different OS and GPU generation: Windows 10 22H2 (19045.6466), VS Build Tools 17.14 (MSVC 14.44.35207), SDK 10.0.26100, debug layer unavailable.dxr_tier=12, SM 6.5):dxr_facing_hardwarepassed,dxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0, identical to the RTX 5080.dxr_query,dxr_update,bvh_hits,bvh_differentialandbvh_packedhardware also passed.dxr_tier=0, SM 6.2):dxr_facing_warpskipped, as diddxr_query_warp,dxr_update_warpandbvh_differential_warp. This exercises the below-tier-1.1 skip path, which your WARP (tier 1.1) could not reach.bvh_hits_warpandbvh_packed_warpfailed withE_INVALIDARGat pipeline creation. That is the Windows 10 WARP SM 6.2 issue fixed by #99, which this branch predates. It is not caused by this change.AI-assisted (Claude Code); run locally on the configuration above.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:04:30Z.
Thanks for the second run, and for covering the below-tier-1.1 skip path. I rebased the branch onto current main (now
17cf485), so it includes #99; on Windows 10 WARP,bvh_hits_warpandbvh_packed_warpshould now skip at SM 6.2 instead of failing at pipeline creation. No change to the commit itself.Re-run at
17cf485on Windows 11 26200.9974 (RTX 5080, driver 32.0.16.1692, and WARP tier 1.1): the 12-test DXR/BVH regex passed 12/12, withdxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0on both backends.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T17:16:08Z.
I am taking #116 first in the shared offscreen harness. Please sync after it lands and retain both the hardware/WARP facing comparisons and the capability skip.