[pr-fix][rendering][shaders] A guarded quad read counts a helper neighbour as present, as the console's whole-quad mode does (DARNER_QUAD_HELPERS, on) #466
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!466
Loading…
Reference in a new issue
No description provided.
Delete branch "damalama487/Darner:pr-quad-helpers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #434
Contributor role (optional)
What it changes
quad_read_guarded(crates/darner-shader/src/emit/lower.rs) keeps a quad neighbour's value only whenwaveActiveBallotnames that lane. The ballot leaves helper lanes out, while the console's whole-quad mode has them in EXEC. So when the source lane of a DPP/quad read is a helper lane, the read fell back to this lane's own value. In 5178 the pixel shader builds a normal from the quad's differences: with the neighbour replaced by itself the difference is 0, the cross product is 0,rsqrt(0)is inf and0 × infis NaN (%705= 0 →%706= inf →%707= NaN →%710,%712in the DXIL of that PSO).This PR counts a helper source as present: a quad read of the source's own
isHelperLanesays whether it is a helper, and then its value is taken.DARNER_QUAD_HELPERS=0gives the old behaviour (the ballot only). The switch is read by the translator, so it is added toKEYEDinshader_cache.rs(60 → 61) and a change of it builds shaders anew.How it was tested
Tested revision: branch commit
7a6fb1dfonmaind91d8e4d. Gates 1 and 2 ran on this same diff onmain47d21cd3; the three files it touches are byte-identical in47d21cd3andd91d8e4d(d91d8e4donly changes F2). Gate 3 ran on7a6fb1dfitself (the branch's source archive, sha256434fb17b…). The game ran this same change on top ofmain47d21cd3plus other open PRs (notmainalone).Commands and results:
cargo clippy --workspace --all-targets --locked -- -D warnings(target x86_64-pc-windows-msvc) → ok, 0 warningscargo clippy --workspace --all-targets --all-features --locked -- -D warnings(same target) → ok, 0 warningscargo xtask policy→asset policy: 564 files okcargo test --workspace --lockedon7a6fb1df, Windows 11, RTX 4070 Ti SUPER, debug profile (run with--offline --no-fail-fast) → 3411 passed, 2 failed, 121 ignored. Both failures fail the same withDARNER_QUAD_HELPERS=0and with it unset (rerun from the built test binaries), so they do not come from this change:darner-gpuhost::packed_present_tests::packed_float_single_planes_are_presented: "frame 0 (R8G8B8A8_UNORM) was not presented" — the run was in a service session (session 0) with no desktop to present to.darner-shaderemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders: DXIL validation "Not all elements of output SV_Depth were written" — the fixture's own problem, fixed by #227 (also reported in #456).pixel_quad_edge_dpp_and_guarded_swizzle_match_on_gpuanddivergent_broadcast_quad_read_is_guarded.Changes a default: yes, for every card (guarded quad reads in pixel shaders).
A/B result: the same build and the same switches, the two runs' switch lines in the play log differing only in
DARNER_QUAD_HELPERS=0(A) against unset (B). Series X profile, 3840x2160 output (2560x1440 scene, DLSS Quality), frame generation x2, hardware ray tracing, RTX 4070 Ti SUPER.DARNER_QUAD_HELPERS=0, as on main)Water, 1:1 crops (A left, B right; the two shots are of the same spot at different times of day, so B is darker overall):

Headlights on a night road, 1:1 crops (A left, B right):

Whole frames, half size: water, road.
Gates run on that revision: 1 and 2 (clippy) and 3 (
cargo test --workspace --locked) as above.Gameplay: RTX 4070 Ti SUPER 16 GB, i7-12700KF, Series X profile; first with a 2560x1440 picture on a 3840x2160 screen, DLSS Quality, no frame generation; then the A/B above at 3840x2160 output with frame generation x2. Hardware ray tracing in both.
Shader wave sizes tested: 32 lanes (NVIDIA).
Hardware dependence: likely general (helper lanes and the ballot behave the same on every card), untested on AMD and Intel.
Coverage gaps: the water A/B shots are not of the same light. The DXIL values of
%705–%712in capture 44's pixel before and after are not included. With the change, small dark dots stay under headlights on a rough road; the player sees them as what is left of the old wrong shadow, not a new artefact (not measured). The gaps between wooden slats are not fixed by it.Checklist
main.docs/asset-policy.md.Checked for overlap
🤖 Generated with Claude Code
WIP: [pr-fix][rendering][shaders] A guarded quad read counts a helper neighbour as present, as the console's whole-quad mode does (DARNER_QUAD_HELPERS, on)to [pr-fix][rendering][shaders] A guarded quad read counts a helper neighbour as present, as the console's whole-quad mode does (DARNER_QUAD_HELPERS, on)