d3d12: leave out traced shadow passes without the BVH builder #3379

Open
Luislariosss wants to merge 1 commit from upstream-pr/3379 into main
Luislariosss commented 2026-12-03 18:02:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Luislariosss on 2026-12-03T18:02:47Z.


Claimed in the coordination issue as: D3D12-GPU-SKIP-RT-SHADOW-WITHOUT-BVH (https://github.com/ProjectLeonida/mandy/issues/3312#issuecomment-7387497732)

Depends on: none

What and why

Without LEONIDA_BVH_BUILDER=1 (and without hardware ray tracing) no acceleration structure is ever built, yet the traced shadow passes still run: CS_GenerateShadowMasks_Raytraced, CS_RTShadowTrace, CS_RaytraceShadows* and the rest of RT_SHADOW_NAMES. They trace whatever the structure's memory holds, so the tiles the title marks for rays (the edges of the cascades' shadows, and hair) come out speckled with shadow at random.

The change leaves those passes out by default when no structure exists. LEONIDA_SKIP_RT_SHADOW stays the explicit override: 1 skips them even with a builder, 0 runs them even without one (the A/B), and unset decides from whether a structure can exist (LEONIDA_BVH_BUILDER=1 or hwrt::active()). Nothing changes for builds that do build a structure.

Tested

  • cargo test -p leonida-gpu --offline --lib -- pipeline::make --test-threads=1: 37 passed.
  • New test skip_rt_shadow_for over the six combinations (structure on/off × switch unset/1/0); red by reverting only the decision to the old expression.
  • cargo clippy -p leonida-gpu --all-targets --offline: clean.
  • cargo xtask policy --staged: ok. (cargo test -p xtask fails only in repository_passes_policy, on three files that were already over the size limit upstream: leonida-gpu/src/host.rs, leonida-gpu/src/indirect/amplify_dxil.rs, leonida-shader/src/emit/lower.rs.)
  • docs/switches.md regenerated for the changed description.

GPUs tested: n/a (no in-game run; the decision is CPU-side).

AI-assisted: yes — implemented and reviewed by coding agents; reviewed by the submitter.

Checklist

  • Based on current main and merges cleanly (rebased on 8da914820).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption.
  • No new translator rule.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5632130825 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3379). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-12-03T18:02:47Z. --- Claimed in the coordination issue as: D3D12-GPU-SKIP-RT-SHADOW-WITHOUT-BVH (https://github.com/ProjectLeonida/mandy/issues/3312#issuecomment-7387497732) Depends on: none ### What and why Without `LEONIDA_BVH_BUILDER=1` (and without hardware ray tracing) no acceleration structure is ever built, yet the traced shadow passes still run: `CS_GenerateShadowMasks_Raytraced`, `CS_RTShadowTrace`, `CS_RaytraceShadows*` and the rest of `RT_SHADOW_NAMES`. They trace whatever the structure's memory holds, so the tiles the title marks for rays (the edges of the cascades' shadows, and hair) come out speckled with shadow at random. The change leaves those passes out by default when no structure exists. `LEONIDA_SKIP_RT_SHADOW` stays the explicit override: `1` skips them even with a builder, `0` runs them even without one (the A/B), and unset decides from whether a structure can exist (`LEONIDA_BVH_BUILDER=1` or `hwrt::active()`). Nothing changes for builds that do build a structure. ### Tested - `cargo test -p leonida-gpu --offline --lib -- pipeline::make --test-threads=1`: 37 passed. - New test `skip_rt_shadow_for` over the six combinations (structure on/off × switch unset/1/0); red by reverting only the decision to the old expression. - `cargo clippy -p leonida-gpu --all-targets --offline`: clean. - `cargo xtask policy --staged`: ok. (`cargo test -p xtask` fails only in `repository_passes_policy`, on three files that were already over the size limit upstream: `leonida-gpu/src/host.rs`, `leonida-gpu/src/indirect/amplify_dxil.rs`, `leonida-shader/src/emit/lower.rs`.) - `docs/switches.md` regenerated for the changed description. GPUs tested: n/a (no in-game run; the decision is CPU-side). AI-assisted: yes — implemented and reviewed by coding agents; reviewed by the submitter. ### Checklist - [x] Based on current `main` and merges cleanly (rebased on `8da914820`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption. - [x] No new translator rule.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3379:upstream-pr/3379'
git switch 'upstream-pr/3379'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3379'
git switch 'upstream-pr/3379'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3379'
git switch 'upstream-pr/3379'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3379'
git switch 'main'
git merge --squash 'upstream-pr/3379'
git switch 'main'
git merge --ff-only 'upstream-pr/3379'
git switch 'main'
git merge 'upstream-pr/3379'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3379
No description provided.