fix(agc): add an opt-in workaround for NVIDIA depth test errors #18937

Merged
lgqdaxia merged 1 commit from upstream-pr/18937 into main 2026-11-13 02:09:28 +00:00
lgqdaxia commented 2026-11-12 14:15:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lgqdaxia on 2026-11-12T14:15:36Z.


What

Read-only D32S8 draws can make later depth tests accept extra samples on the tested NVIDIA driver. In PPSA05813, the missing stencil depth-fail updates produce straight shadow stripes across the character's face and neck.

Add APS5_READONLY_DEPTH_BOUNDS_COMPARE=1 as an opt-in workaround, disabled by default. Eligible draws retain their native depth bounds and use read-only GREATER_OR_EQUAL at viewport depth 1. Samples surviving those bounds already pass this comparison. Other draw states retain their original behavior.

This uses the fixed-depth comparison technique from #9737.

Before (left) / enabled (right)

PPSA05813 car scene: original shadow stripes on the left, workaround enabled on the right

Tested

Windows 11 Pro (26300), NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14; MinGW GCC 15.2.0.

  • Standalone 64×64 Vulkan reproduction: history/untouched counts 3200/2048 become 2048/2048; depth, stencil and history color stay byte-identical.
  • PPSA05813 01.000.007: a switch-only recorded-frame comparison clears the stripes; VUID 0, SYNC-HAZARD 0 in both arms.
  • CPU state-eligibility and default/0/1 checks passed; State.cpp, DrawDecode.cpp and Graphics.cpp compiled successfully.
Validation refs — 2026-11-12, Windows/NVIDIA

Production compilation and CPU checks: 55d1dece34 + bf6fae80b7. Game-frame comparison: frozen eb499dddc5 runtime with the same production change. The current branch rebases that implementation onto 389e0e17fc; the production diff is preserved.

Standalone results

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: Fixes #18936
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, 621.14, Windows 11 Pro
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5278994637 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18937). Originally posted by [lgqdaxia](https://github.com/lgqdaxia) on 2026-11-12T14:15:36Z. --- ### What Read-only D32S8 draws can make later depth tests accept extra samples on the tested NVIDIA driver. In PPSA05813, the missing stencil depth-fail updates produce straight shadow stripes across the character's face and neck. Add `APS5_READONLY_DEPTH_BOUNDS_COMPARE=1` as an opt-in workaround, disabled by default. Eligible draws retain their native depth bounds and use read-only `GREATER_OR_EQUAL` at viewport depth 1. Samples surviving those bounds already pass this comparison. Other draw states retain their original behavior. This uses the fixed-depth comparison technique from #9737. **Before (left) / enabled (right)** ![PPSA05813 car scene: original shadow stripes on the left, workaround enabled on the right](<https://github.com/user-attachments/assets/b1bee73c-14ca-4bbf-a0d3-3430fadc420f>) ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro (26300), NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14; MinGW GCC 15.2.0. - [Standalone 64×64 Vulkan reproduction](<https://github.com/user-attachments/files/34752071/standalone-repro.zip>): history/untouched counts `3200/2048` become `2048/2048`; depth, stencil and history color stay byte-identical. - PPSA05813 01.000.007: a switch-only recorded-frame comparison clears the stripes; VUID `0`, SYNC-HAZARD `0` in both arms. - CPU state-eligibility and default/0/1 checks passed; `State.cpp`, `DrawDecode.cpp` and `Graphics.cpp` compiled successfully. <details> <summary>Validation refs — 2026-11-12, Windows/NVIDIA</summary> Production compilation and CPU checks: `55d1dece34` + `bf6fae80b7`. Game-frame comparison: frozen `eb499dddc5` runtime with the same production change. The current branch rebases that implementation onto `389e0e17fc`; the production diff is preserved. [Standalone results](<https://github.com/user-attachments/files/34752072/repro-result.json>) </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: Fixes #18936 - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, 621.14, Windows 11 Pro - [x] AI-assisted: yes
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
boykopovar/AnyPS5!18937
No description provided.