Repository navigation
fix(shader): test depth first where the console's pixel shader does - #526
Merged
pragyaangaur merged 1 commit intoNov 27, 2026
Merged
Conversation
A console pixel shader built with [earlydepthstencil] sets DB_SHADER_CONTROL.DEPTH_BEFORE_SHADER (bit 12): pixels behind closer geometry never run it. The host tests depth after any shader that writes UAVs, so those pixels' writes landed. GTA VI's alpha prepass writes velocity through a UAV; the window behind the player overwrote her motion vectors inside the window's rectangle. Such shaders now get ForceEarlyDepthStencil, unless they export depth or stencil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What. A console pixel shader built with
[earlydepthstencil]setsDB_SHADER_CONTROL.DEPTH_BEFORE_SHADER(bit 12). Such shaders now get DXILForceEarlyDepthStencil, even when they write UAVs or title memory or discard. The one exception is a shader that exports depth or stencil, which can't be tested first (the console doesn't combine the two either). The existing read-mark rule for early depth is unchanged.Depends on the lower.rs refactor PR (#R). Main's
lower.rsis 523,123 bytes, 1,165 undercargo xtask policy's 512 KiB file limit; this change alone would leave 36 bytes, and not fit beside DispatchX. The first commit here is that PR's; please review the second.lower.rsends at 520,973 bytes (521,127 with the DispatchX PR).Why. On the console, pixels behind closer geometry never run such a shader, so they never make its writes. The host tests depth after any shader that writes UAVs, so those pixels' writes landed. In GTA VI the alpha prepass writes velocity through a UAV: the window quad behind the player wrote its motion vectors over hers, inside the window's rectangle (seen in a render-target dump of the cell scene).
Tests
lower::tests::console_depth_before_shader_keeps_early_depth_stencil_with_uav_writes: withDEPTH_BEFORE_SHADER, a title UAV store (with and without view marks) and a conditional discard both get early depth, and validate. A depth export stays late.pixel_shader_skips_early_depth_stencil_with_discard_depth_or_uavstill holds without the bit.cargo test --workspace723 passed;tools/macos/test-wine.sh --workspace --no-fail-fast1444 passed, 1 failed (descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait, intermittent on plain main too in our runs, which shared the machine with a game run); gnullvm clippy--workspace --all-targets -D warnings, with and without--all-features: clean;cargo xtask policy: ok.Update: rebased onto main
f7dddb0(after #518–#522 and #447); tests re-run there, clippy and policy clean. This change has also been in our play builds on the M5 Pro (integration v8/v9, lit and correct prison scene) for the last day.🤖 Generated with Claude Code