fix(shader): intersect BVH triangle types 2 and 3 and return triangle ids and misses as RDNA2 does #24128
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24128"
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 boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-11-20T07:04:22Z.
What
image_bvh_intersect_rayandimage_bvh64_intersect_raywere ported from AMD's GPURT software fallback (9bb94163ea,bf635fae68) and had not been compared with hardware. The gfx1036 hardware oracle shows three ways its triangle node test differs, all fixed inEmitImageBvhIntersectRay:The
t / denominatorof a hit and the hit/miss decision are unchanged.Debt: a new entry records the rule, and that hits are f32 Möller–Trumbore whose last bits differ from the hardware's. A zero or NaN denominator and the PS5's gfx1013 are not measured.
Measurement:
tools/hw-oracleon gfx1036 (AMD Windows driver 32.0.21045.16010), with the BVH in the oracle's buffer.agc_oracle_runnerrunning the same code on an NVIDIA GeForce RTX 5080 (610.74) and the gfx1036 iGPU through Vulkan.mainAfter the fix, all 32 rows (types 0 to 3, both return modes, seed 5, id 0x09060000) agree with hardware on hit or miss, the id, the infinity's sign and which barycentric is returned. The float bits match exactly on the 4 triangle-id misses. On the others they are within a few ULP: the denominator 0x413decd1 vs 0x413decd6, for example.
Tested
Windows 11 Pro 10.0.26200, MinGW Release build.
ctest --test-dir build -R '^agc_driver_bvh|^ray_tracing_miss$' -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, onmainand on this branch. The GPUs were an NVIDIA GeForce RTX 5080 (610.74) and an AMD Radeon(TM) Graphics iGPU (gfx1036, 32.0.21045.16010).mainNVIDIAmainAMDInsert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requestedVUID-ray_tracing_missopens no Vulkan device, hence one layer insert for two tests.agc_driver_bvh64_intersect_raychanges:image_bvh64_intersect_rayandimage_bvh_intersect_ray, with and without A16) and both addressing modes.Negative check: with
main'sSpirvImageEmitter.cpp, the test fails on both GPUs withimage_bvh64_intersect_ray, address in the node pointer, triangle ids: thread 3 dword 2 is 11256099, expected 11256100.tools/pr_overlap.pycould not compareSpirvImageEmitter.cppwith 15 PRs that conflict withmain. None of their diffs touchesEmitImageBvhIntersectRay. Not tested on a PS5.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T07:26:31Z.
Review: APPROVED
Reviewed — looks good
The reviewed change is consistent with its stated goal; no blocking defects were identified in the changed files.
What I ran
ff9463e8bb223ab2cd140d22137409476844d655usingrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/execution/Bvh64IntersectRay.cpp,core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp, anddocs/dev/debt/changes/fix-bvh-triangle-types.md.To get this to a good state
Nothing is required.