Repository navigation
Conversation
|
Review (head d3af2c2, diff read, not a merge-check; draft, checks red):
Fine: the t-sign check is the same in all three forms (HLSL AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Follow-up review (head 5b6e35d, since d3af2c2, diff read, not a merge-check; draft, checks red):
New: none. Since AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…s origin The node test's triangle form (HLSL bvh_intersect and the direct-DXIL lowering) checked the barycentric signs against the denominator but not the sign of the distance: a triangle behind the ray's origin came back as a hit with a negative t / det. The hardware reports hits ahead of the origin only, and a trace program can rely on that: a shadow ray that starts on a surface would find the triangles behind its start as blockers. A hit now also needs t > 0 when det > 0 and t < 0 when det < 0, on both paths: a triangle the ray starts on (t = 0) is a miss too, as in the console's own CPU form of the leaf test, which misses t_num * sign(t_denom) <= 0 and returns (inf, 1, 0, 0). The CPU form of the node test (gpu::bvh::triangle_hit, which the GPU tests compare the translator against) had the same gap, so CPU and GPU agreed on the wrong answer and no test caught it; it gets the same check. No runtime path calls it (the CPU walk behind bvh_want follows child ids, not rays). Test: gpu_bvh_triangle_behind_the_origin_is_missed (a triangle ahead of the origin is hit at t = 5; pointing away from it, starting past it and starting on it miss; both windings). It fails before the change on the HLSL path and with XCL_DIRECT_DXIL=1. triangle_hit_misses_a_triangle_behind_the_origin is the same on the CPU; it fails before the change too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up review (head e62ee13, since 5b6e35d, diff read, not a merge-check; draft, checks red):
New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
@Foniass Thanks. Both points taken, head now
AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen. |
Part of #3011. The triangle form of
image_bvh_intersect_ray(the HLSLbvh_intersectand the direct-DXIL lowering) checked the barycentric signs against the determinant but not the sign of the distance: a triangle behind the ray's origin came back as a hit with a negative t·det / det. The hardware reports hits ahead of the origin only, and a trace program can rely on that: a shadow ray that starts on a surface then finds the triangles behind its start as blockers.A hit now also needs t > 0 when det > 0 and t < 0 when det < 0, on both paths: a ray that starts on the triangle (t = 0) misses it too, as the console's leaf test has it (a miss when t·det times the sign of det is not above 0). The CPU form of the node test (
gpu::bvh::triangle_hit), which the GPU tests compare the translator against, had the same gap, so the two agreed on the wrong answer and no test caught it; it gets the same check. No runtime path calls the CPU form (the CPU walk behindbvh_wantfollows child ids, not rays).Overlaps #3038 (the same three functions; its watertight form, behind a switch, leaves t's sign to the traversal): whichever lands second carries the check into the other form.
What is in it
Recompiler: image_bvh_intersect_ray misses a triangle behind the ray's origin:gpu/recomp/emit.rs(HLSL prelude),gpu/dxil/lower_image.rs,gpu/bvh.rs(triangle_hit); testsgpu_bvh_triangle_behind_the_origin_is_missed(gpu/recomp/tests.rs: rays ahead, pointing away, starting past and starting on the triangle, both windings) andtriangle_hit_misses_a_triangle_behind_the_origin(gpu/bvh.rs).The table of node-test cases with hand-stated answers (box and triangle nodes) that was a second commit here becomes a
Tests:PR of its own, as it tests code this PR does not change.The change alters the HLSL prelude and the DXIL lowering, so the translated programs that use
image_bvh_intersect_rayget new cache keys and are translated again once.Tested
e62ee138onmain1c8b5514, RTX 3090 VM (NVIDIA 621.24, Intel Core i7-10700T, Windows 11 build 26300.9974, Rust 1.99.1, debug), againstmain1c8b5514on the same machine:cargo test -p xcl --lib -- bvh --nocapture --test-threads=1: 28 passed, 0 failed.cargo test --workspace --no-fail-fast -- --test-threads=4: 2903 passed, 5 failed, 51 ignored (main: 2901 passed, 5 failed, 51 ignored; the 2 more are this PR's tests). The same 5 failures on both,main's own on this machine:title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3stream_recheck_*tests, e2etest_title_runs_and_game_folder_is_untouched. SKIPPED: 28 (22 no wave64, 2 no heap windows, 4 no debug layer). The run leaves out the 3uma_drivercoherent-window remake tests that kill the lib binary on this driver.d3af2c26(t ≥ 0, with the table of cases):cargo build --workspace: ok.cargo test -p xcl --lib -- bvh --test-threads=4: 30 passed, 0 failed, withXCL_DIRECT_DXIL=0(HLSL) and withXCL_DIRECT_DXIL=1.triangle_hitreverted),triangle_hit_misses_a_triangle_behind_the_originfails;gpu_bvh_triangle_behind_the_origin_is_missedfailed before the shader fix on both paths.cargo test --workspace --no-fail-fast -- --test-threads=4: 2913 passed, 0 failed, 51 ignored. SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 driver cache cannot be disabled).Regression run
scripts/smoke.ps1pair (mainand this head) on the RTX 5090.Not tested
AI use
🤖 Generated with Claude Code