ProjectScarlett: lower the irradiance shadow ray walks to native ray queries #302
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/302"
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 brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-27T06:55:32Z.
Summary
ProjectScarlett traces rays in its own compute programs. The console compiler inlines each
RayQueryas a loop over raw console BVH nodes: an LDS stack, flat loads of nodes andimage_bvh64_intersect_ray. xshader refuses these programs ("raw BVH node intersection requires traversal translation"). This PR lowers the two irradiance-cache shadow programs to native DXR ray queries, the same wayradiance_probehandles Frosty. Only the walk is replaced; the code around it stays guest ISA.Commits:
CS_IrradianceCache_ShadowTrace: it read its UAV at slot 6 as SRV t333 ("buffer_store_format to a non-UAV table").t<i>is the title's i-th acceleration structure ordered by (space, register).src/tests/device/compute_scene.rs.hlsl/scarlett_rays.rs).tb_scarlett_ray_query. Its operands are the world ray the walk copies before it starts (theimage_bvh64_intersect_rayorigin, direction and extent). Its result is the register the guest code tests after the loop.CS_IrradianceCache_ShadowTrace(near scene) andCS_IrradianceCache_ShadowTrace_WithFar(near scene, then on a miss the far scene from the near sphere's exit).tools/check_scarlett_rays.py,tools/reference/scarlett/rays_guest.cpp).Known gaps:
CS_RaytraceShadows_Mixedis recorded without a root signature, so it can't be replayed on its own. Its lowering is left for a follow-up.Verified on Lanes
python tuxbox.py checkpassed on this branchNot run in full: the GPU suite's present lanes open windows on the desktop I'm working on. I ran its code steps and the new check:
scarlett_raystests.compute_acceleration_structure_is_a_table_srv, which fails without the fix.The new behaviour needs the title's recorded shader requests, so it is a standalone check like
check_frosty_inline219.py, not a Lanes scenario.GPU, driver and backend:
check_scarlett_rays.py. AMD: RX 9060 XT, RADV (Mesa 26.1.8), Proton Experimental.Checks
No evidence JSON changes.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T07:36:29Z.
AMD run of this branch (
2c2cec6), since the PR asks for one on a card with the full suite:python tuxbox.py checkpassed, 135 gates.tools/check_scarlett_rays.pyon the same card, from our own recorded ProjectScarlett requests: both programs passed, 0 mismatches (failed=0forCS_IrradianceCache_ShadowTraceand_WithFar).Measured evidence for commit 1 from two probe runs in ProjectScarlett's story intro on the 5090:
CS_IrradianceCache_ShadowTrace_WithFar. That's the program's ownu52, not the title root's SRVt333.Overlap note: we had a reader change that also accepted shape-4 raw SRVs. Over the 4,631 recorded compute requests that carry a root, your kind-16 rule confirms all 60 of ours, so I've dropped it. A separate case, a compute root SRV after the tables (52 requests,
[table, table, table, SRV, constants]roots), isn't covered here. I'll open that separately once it's checked on both cards; it stacks on this PR.Also relevant to "In game, these dispatches still need native scenes": on the 5090, 43 of the retail
XboxBvhBuilder.dll's 52 compute kernels fail to compile today. They're standard DXIL callingxbox.*intrinsics (s_load_dword_with_cache,global_load_dword*_with_cache,LaneSwizzle,Med3_F32, …), which dxil-spirv can't define, plus 5 that useinsertvalue, which its reader rejects. So they run as stand-ins, and in our probe runs no TLAS start address was ever written.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T09:30:31Z.
Heads-up: after #303 merged, this branch conflicts with main in
with_reflected_table(runtime/d3d12/src/commands/compute_bindings.rs). #303 added aheap_readsargument there and this PR addsscene. Keeping both resolved it in our local rebase;recording.rs's callers then pass both in that order, andpython tuxbox.py check --no-gpupasses on the result. The NVIDIA run I mentioned is running now; I'll post it when it's done.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T09:51:42Z.
NVIDIA result, for the record now that this is merged:
tools/check_scarlett_rays.pyon an RTX 5090 (10de:2b85, driver 620.70.10, GE-Proton11-14), from our recorded ProjectScarlett requests: both programsfailed=0(CS_IrradianceCache_ShadowTraceand_WithFar).