Shaders: a pixel program the console tests depth before (DB_SHADER_CONTROL.DEPTH_BEFORE_SHADER) is declared [earlydepthstencil]: glass no longer lies over what stands in front of it #353

Open
Serph91P wants to merge 1 commit from upstream-pr/353 into main
Serph91P commented 2026-11-26 18:16:18 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Serph91P on 2026-11-26T18:16:18Z.


A character standing in front of a window pane had hair, neck and shirt smeared right of a straight vertical line, the pane's edge; panes seemed to shimmer through whatever was in front of them. One commit on 2de9980.

Cause: the glass pre-pass (PS_AlphaPrepass, d16aa632) also writes the pane's depth and velocity into a storage texture. The console tests depth before the program runs (bit 12 of DB_SHADER_CONTROL). The translator read the bit and did not pass it on, and D3D12 tests depth after a program that writes storage textures unless it is declared early. So the texture was written for every pixel the pane's mesh covers, behind the head too; PS_AlphaVelocityDepthResolve then put the pane's depth and velocity into the scene's at those pixels, and the title's TAA smeared them.

What this does: emit/lower.rs gives a pixel program with the bit set and no depth export the DXIL flag for early depth and stencil. In the frame looked at, 333 pixel programs carry the bit, 50 of them can kill pixels. TRANSLATOR_VERSION 1 → 2; #354 also goes 1 → 2 on its own, so whichever lands second needs 3.

Tested (RX 7900 XTX, RADV Mesa 26.3.1, vkd3d-proton 71cae091, Proton Experimental)

  • Recorded frame: replacing only this one program restores the hair strands and removes the line; the storage texture is non-zero on 798,390 texels instead of 1,146,013 (the head excluded); with every program retranslated the differences are on the character inside the pane's rectangle only.
  • In the title: panes are no longer drawn over characters or walls in several rooms (observer); steady frame time unchanged (median 62.1 ms).
  • This branch alone: builds for x86_64-pc-windows-msvc (cargo-xwin); the whole archive gives 25,694 that translate and 195 that do not, as before; cargo test -p victory-shader --lib (209 passed), cargo xtask policy and cargo test -p xtask pass.

Not tested: Windows, NVIDIA. No unit test for the flag. To watch: the 50 programs that can kill pixels now test and write depth before they run, as the console does; a problem would show as cut-outs (foliage, hair) hiding what is behind them.

No game data in the commit.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6632681276 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/353). Originally posted by [Serph91P](https://github.com/Serph91P) on 2026-11-26T18:16:18Z. --- A character standing in front of a window pane had hair, neck and shirt smeared right of a straight vertical line, the pane's edge; panes seemed to shimmer through whatever was in front of them. One commit on 2de9980. **Cause:** the glass pre-pass (`PS_AlphaPrepass`, d16aa632) also writes the pane's depth and velocity into a storage texture. The console tests depth before the program runs (bit 12 of `DB_SHADER_CONTROL`). The translator read the bit and did not pass it on, and D3D12 tests depth after a program that writes storage textures unless it is declared early. So the texture was written for every pixel the pane's mesh covers, behind the head too; `PS_AlphaVelocityDepthResolve` then put the pane's depth and velocity into the scene's at those pixels, and the title's TAA smeared them. **What this does:** `emit/lower.rs` gives a pixel program with the bit set and no depth export the DXIL flag for early depth and stencil. In the frame looked at, 333 pixel programs carry the bit, 50 of them can kill pixels. `TRANSLATOR_VERSION` 1 → 2; #354 also goes 1 → 2 on its own, so whichever lands second needs 3. **Tested** (RX 7900 XTX, RADV Mesa 26.3.1, vkd3d-proton 71cae091, Proton Experimental) - Recorded frame: replacing only this one program restores the hair strands and removes the line; the storage texture is non-zero on 798,390 texels instead of 1,146,013 (the head excluded); with every program retranslated the differences are on the character inside the pane's rectangle only. - In the title: panes are no longer drawn over characters or walls in several rooms (observer); steady frame time unchanged (median 62.1 ms). - This branch alone: builds for `x86_64-pc-windows-msvc` (cargo-xwin); the whole archive gives 25,694 that translate and 195 that do not, as before; `cargo test -p victory-shader --lib` (209 passed), `cargo xtask policy` and `cargo test -p xtask` pass. **Not tested:** Windows, NVIDIA. No unit test for the flag. To watch: the 50 programs that can kill pixels now test and write depth before they run, as the console does; a problem would show as cut-outs (foliage, hair) hiding what is behind them. No game data in the commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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/353:upstream-pr/353'
git switch 'upstream-pr/353'

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/353'
git switch 'upstream-pr/353'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/353'
git switch 'upstream-pr/353'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/353'
git switch 'main'
git merge --squash 'upstream-pr/353'
git switch 'main'
git merge --ff-only 'upstream-pr/353'
git switch 'main'
git merge 'upstream-pr/353'
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
avatarmanz/VIctory-7900XTX!353
No description provided.