d3d12_xs, tombox-xshader: console DXR runtime bring-up (draft, unfinished) #349
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/349"
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 omonkeyz/xbox-emulator. Originally posted by GDAgent on 2026-11-23T23:24:48Z.
Draft, not for merge as is. This is our console DXR bring-up, published so the work is not lost: we are wrapping up our work on this project. It is unfinished and partly the wrong design (see "What is wrong"). Everything below is honest status; please treat it as a starting point for whoever continues ray tracing, or close it.
Library / area:
d3d12_xs(newrt_x.rsruntime,rt_bvh.rsCPU BVH builder,global_bind.rsTbGlobal table, device and command-list slots),tombox-xshader(newstate_obj.rsdecoder,rt_cps.rsCPS translator, global-memory ABI).What it contains
DeserializeStateObjectXdecodes the console state-object blob (state_obj.rs), translates each RDNA2 CPS program (rt_cps.rs: continuation-passing raygen/hit/miss programs,s_setpc/s_swappccontinuation switch) to HLSL, compiles it to DXIL and creates PC compute PSOs; background compile with a per-program cache; metadata slots (export names, shader identifiers, RTS0 cbuffer sizes).BuildRaytracingAccelerationStructure(list slot 117 and the batched variant at 131), postbuild info (118/119),CopyRaytracingAccelerationStructureincluding mode 4 DESERIALIZE of console BVH blobs, AS state0x400000mapped to COMMON, AS registry, staging buffers released after fence completion.SetPipelineState1/DispatchRaysas a compute dispatch of the translated raygen program through the real PC list methods, keeping the title's compute state; TbGlobal windows for 64-bit GPU-VA global memory (an earlier version of what #336 proposes separately).TOMBOX_RAYTRACING_TIERand an OPTIONS5 patch (default reports tier 1.1);TOMBOX_RT_ASYNC.What was seen in a title (The Matrix Awakens, native Windows 11, not run under Proton, RX 6600 XT / RDNA2)
DeserializeStateObjectXper run; 4 programs each translated and created as PSOs; 0 PSO creation failures since the root-signature hook commits.CopyRaytracingAccelerationStructureDESERIALIZE with console BVH blobs (hundreds per run),BuildRaytracingAccelerationStructureBLAS/TLAS calls.DispatchRayswas never reached: every run stopped earlier (Nanite persistent-culling GPU hang, PSO build stalls, VRAM pressure; see the findings issue #350).What is wrong / missing
rt_bvh.rsbuilds BVH4 nodes on the CPU at record time from vertex data read through a CPU mapping of title memory (cpu_ptr_for_va). GPU-written or GPU-local vertices are not there at record time, so every BLAS in the title came out empty (leaves=0). A GPU-side builder (or the consoleXboxBvhBuilderkernels translated) is needed.image_bvh64_intersect_ray; the TLAS instance layout is untested.DispatchRaysis unverified; it should be opt-in before anything is merged.global_bind.rsduplicates and predates #336; rebase onto #336 if this continues.state_objtests return early withoutTOMBOX_TEST_STATEOBJ(a captured blob).Tests
tombox-xshader --lib -- state_obj rt_cps global_abi: 6 passed.tombox-xshader --test exec -- exec_mem::global exec_mem::bvh exec_mem::ds: 15 passed (WARP).d3d12_xs --lib -- rt_x:: rt_bvh:: global_bind::: all passed (30 with one dbcount test).d3d12_xs --lib(--test-threads=1): 691 passed, 5 failed: the known host failuresaliasmsaa,placed_offsetuneven views,title_shadowmigrate, the console-DLL fixture, anddbcount::translated_pixel_shaders_with_uavs_keep_their_source, which passes when run alone (order-dependent, also seen without this branch).tombox-xshadersuite was not rerun on this squash.All 16 original commits are squashed into one; comment lines were removed for the PR gate (0 problems).
Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:51:18Z.
Review notes for when this comes out of draft: please base it on #336 once that is reworked (the TbGlobal ring of 8 is overwritten at record time), store private data and names for real (or return the honest error) instead of S_OK without storing, compute shader stack sizes from the translated programs instead of a constant, and move the BLAS build to the GPU or to execution time so GPU-written geometry is seen. Splitting state objects, AS builds and DispatchRays into separate PRs would make review possible.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.