Skip to content

Recompiler: bound a shadow traversal with native RayQuery - #2189

Open
rison1337 wants to merge 7 commits into
xcl-dev:mainfrom
rison1337:feat/shadow-rayquery-consumer
Open

rison1337 wants to merge 7 commits into
xcl-dev:mainfrom
rison1337:feat/shadow-rayquery-consumer

Conversation

@rison1337

Copy link
Copy Markdown

Stacked on #2085 and the preceding native-AS preparation branches. Immediate predecessor: feat/shadow-traversal-matcher (190885bb24ee). Only commit 24206a657b11 belongs to this PR; earlier commits are dependencies.

Connect one verified shadow traversal region to an opt-in native RayQuery upper bound for #1751. A compatible TLAS is bound directly at t0/space2. The original traversal still checks nearer intersections, including t=0, before the native endpoint is merged. No retail FPS benefit is established.

What is in it

  • Gate the HLSL rewrite to one known record and preserve the original path for unavailable/incompatible inputs.
  • Use a root SRV rather than descriptor-heap AS lookup; keep the opt-in translation out of legacy variant caches.
  • GPU differential coverage: four scenes × seven scenarios × 64 lanes, including zero-distance, strict TMax, masked EXEC, NaN and address mismatch. Counters record 640 hardware queries.

Tested

  • Ryzen 5 7500F, RTX 4060 8 GB, NVIDIA 615.78.08, CachyOS Linux, Rust 1.99.1; Windows x86_64-pc-windows-gnullvm cross-build, debug tests and release runtime. Executed under Proton Experimental, with DXC 1.9.2609.5 and the local vkd3d-proton compatibility build.
  • Complete library executable on this head, cross-built with cargo test --locked --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run, then run through the local Proton runner with --test-threads=4: 1104 passed, 2 failed, 26 ignored; 24 explicit SKIPPED messages. XCL_HOST_RAYQUERY=1; the private shader sample was available through XCL_SAMPLE_RAYQUERY. No title bytes are committed.
  • Fresh main (568e7db7729c), same runner and hardware: 1096 passed, 2 failed, 26 ignored; 24 explicit SKIPPED messages. Both fail the same existing depth-state negative check (gpu_depth_buffer_created_for_unordered_access_is_placed) and XMA voice check (xma2_source_voice_decodes_and_manages_lifetime). Skips include unavailable hardware wave64 and Windows Developer Mode.
  • Final stack 24206a657b11: cargo build --locked --target x86_64-pc-windows-gnullvm --workspace and cargo test --locked --target x86_64-pc-windows-gnullvm --workspace --no-run passed after adapting the four integration-test accesses to the shared-DXIL Arc API in Shaders: share compiled DXIL across pipeline builds #2085.

Regression run

The repository's unchanged scripts/smoke.ps1 generated these blocks, using PowerShell 7.7.0 on Linux and a shell wrapper that executes the EXE through Proton. Z: is mapped for reading the Windows log path. Both clean-source runs use the same title/profile copy, 90 s, XCL_PSO_PRELOAD=0, no automatic input, and a separate Xwayland surface on a background workspace. The PR's opt-in flag is enabled where available. Coverage is startup/start screen/menu, not world loading or native traversal execution.

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 4060
title: 6ca5cab7
seconds: 90
exit: 0x0
frames shown: 1828 (PresentX 1828)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 24206a657b11ccde6884a3a6cb3bb7a262d18075
gpu: NVIDIA GeForce RTX 4060
title: 6ca5cab7
seconds: 90
exit: 0x0
frames shown: 1874 (PresentX 1874)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

Both runs exited without recorded crashes or device removals. Wine prints 0 MB for process commit, so the memory-growth comparison is not established by this counter. The existing queue-drain warning may be present at timer shutdown.

Not tested

AI use

Codex (GPT-6 family; exact variant unavailable in this session) prepared the implementation, split the commits, cross-built the binaries, ran the listed Linux/Proton checks and drafted this description. No game data or console SDK headers are included.

Return the cached Arc<Compiled> to pipeline builders so repeated shader requests reuse the compiled storage. Keep the VS and PS owners alive while the driver consumes their bytecode.

Assisted-by: Codex (gpt-6.1-sol)
Prepare native input copies with checked descriptor capture, packed vertex spans and a committed allocation cap. This preparatory module is not called by title execution yet.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
Build native acceleration structures from captured inputs and retain every referenced buffer within the allocation cap. The title-facing observer is connected in the next change. GPU fixtures cover build, compact-copy, traversal and budget failure.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
Forward the original builder calls, then record bounded shadow builds on the active recording segment. Rehydration invalidates captured mappings because its additional transforms are not reproduced. The observer is disabled unless explicitly requested.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
Track compatible native structures by UMA range and recording owner. Invalidate bindings on reset, release and page remapping; cross-recording consumers retain the console path. Shader consumption is added separately.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
Prepare an exact-program traversal matcher with control-flow guards, register-liveness assertions and sample-gated baseline GPU checks. Translation behavior is unchanged until the consumer is connected.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
Bind a compatible native TLAS directly and use hardware hits to shorten one exact-program traversal region. Preserve the console check for nearer and zero-distance intersections. The opt-in path remains disabled by default and has no demonstrated retail FPS benefit.

Assisted-by: Codex (GPT-6 family; exact variant unavailable)
@DarkPanda69

Copy link
Copy Markdown

Native Windows run on AMD (native wave64) and NVIDIA, which the stack lists as untested. I applied this PR's diff against main, so it includes the lower native-AS branches it is stacked on (#2184–#2188 as of their current heads).

Head 24206a6 applied on main 568e7db, debug, Windows 11 Pro 26200, XCL_ADAPTER set to each card:

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010, waves 32..64):
  • RTX 3060 (driver 32.0.16.1088, waves 32 only): same 7 passed / 1 SKIPPED for host_bvh rayquery; gpu:: 588 passed, 0 failed, 22 ignored; console_shaders 3 passed, 4 ignored.

Not tested: the retail shadow region (no sample), XCL_SAMPLE_*, a title, release build.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants