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

Open
github-bot wants to merge 1 commit from github-bot/gh-3379 into main AGit
Owner

@⁠Luislariosss on GitHub · 2026-12-03 18:02 UTC · original
Luislariosss:fix/skip-rt-shadow-without-bvh → main · +49 −20 · 2 files · 1 commits · open

Claimed in the coordination issue as: D3D12-GPU-SKIP-RT-SHADOW-WITHOUT-BVH (#3312)

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.
**@⁠Luislariosss** on GitHub · 2026-12-03 18:02 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3379) `Luislariosss:fix/skip-rt-shadow-without-bvh` → `main` · +49 −20 · 2 files · 1 commits · open Claimed in the coordination issue as: D3D12-GPU-SKIP-RT-SHADOW-WITHOUT-BVH (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/3312) 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.
Without LEONIDA_BVH_BUILDER=1 no acceleration structure is built, so the
traced shadow passes (CS_GenerateShadowMasks_Raytraced, CS_RTShadowTrace,
CS_RaytraceShadows) trace against nothing and speckle the tiles the title
marks for rays (hair, arms) with random shadow. Leave them out by default
when the builder is off, as CS_RaytracingResolve already is.
LEONIDA_SKIP_RT_SHADOW still decides when set: 1 leaves them out even with
the builder, 0 runs them even without it.

The decision is now a pure function (skip_rt_shadow_for) with a unit test
over builder on/off and the switch unset/1/0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 18:05:32 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3379/head:github-bot/gh-3379'
git switch 'github-bot/gh-3379'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3379'
git switch 'github-bot/gh-3379'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3379'
git switch 'github-bot/gh-3379'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3379'
git switch 'main'
git merge --squash 'github-bot/gh-3379'
git switch 'main'
git merge --ff-only 'github-bot/gh-3379'
git switch 'main'
git merge 'github-bot/gh-3379'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!3379
No description provided.