Skip to content

fix(libSceAgcDriver): skip depth and stencil tests whose plane is absent - #453

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
SP4C3B4R-8:fix/absent-depth-stencil-plane
Oct 4, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
SP4C3B4R-8:fix/absent-depth-stencil-plane

Conversation

@SP4C3B4R-8

Copy link
Copy Markdown
Contributor

What

A draw can enable the depth or stencil test in DB_DEPTH_CONTROL while DB_Z_INFO / DB_STENCIL_INFO declare the corresponding plane absent (format 0 / INVALID), for example a stencil test with ALWAYS and KEEP on a depth-only surface. Such a draw was rejected with "stencil test without a stencil plane" (or "depth test without a depth plane"), so none of its depth writes happened either.

The hardware behaves as if the test of an absent plane were disabled. decodeDepth now clears the test bits of an absent plane instead of throwing, and a draw whose planes are both declared absent is treated like a depth pass-through instead of being rejected by DrawRejection. A depth or stencil register that is missing entirely still goes through the existing checks.

Tested

Windows 11, MinGW-w64 GCC 15.2.0. agc_driver_graphics_tests and agc_driver_pm4_tests pass on this branch alone; Graphics.cpp checks that tests on two absent planes are dropped and not rejected, and that a depth test without a depth plane is dropped while the stencil test of a present stencil plane is kept. With a retail title, about 13k draws per minute that write the main depth buffer are no longer skipped.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude). I reviewed and take responsibility for every line.

🤖 Generated with Claude Code

https://claude.ai/code/session_018m6Ad8zkQKPKZmyUQK9vfE

@github-actions github-actions Bot added the agc libSceAgc* label Oct 3, 2026
oneandonlydean pushed a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit cde2df1)

integ: astrobot's resident depth model already skips the tests of an
absent plane (decodeDepth: depthTest needs hasZ, the stencil test needs
the stencil plane, both absent gives no attachment), so boykopovar#453's State.cpp
change is not taken; its test is, reading state.depth.*. Its second
case no longer asserts the stencil test: astrobot drops a stencil test
that always passes and writes nothing (STENCILFUNC ALWAYS, KEEP ops), as
it did before.
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 4, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

This passed my PPSA21564 check, but it now conflicts with main after #376 and #294 merged. Could you rebase? Then it's ready to merge from my side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SP4C3B4R-8
SP4C3B4R-8 force-pushed the fix/absent-depth-stencil-plane branch from cde2df1 to 48ebf31 Compare October 4, 2026 10:21
@SP4C3B4R-8

Copy link
Copy Markdown
Contributor Author

Rebased onto main (2cf901b), now 48ebf31. The only conflict was in DrawRejection after the depth-bounds change: I kept main's handling (0xb mask, "depth bounds without a depth surface") and only added the absent-planes check, which still applies to the depth and stencil tests (word & 3). Graphics and PM4 tests pass locally. Thanks for checking it against PPSA21564.

Written with AI assistance (Claude Code).

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 4, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for the rebase. Keeping main's 0xb mask and the depth bounds rule is right, and the commit is otherwise unchanged. My PPSA21564 check ran with the same rule (tests on an absent depth or stencil plane are dropped) and your test, and the full ctest passes here on current main. Ready to merge.

@oneandonlydean
oneandonlydean merged commit 19f6e33 into boykopovar:main Oct 4, 2026
3 checks passed
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 5, 2026
Conflicts resolved:
- libSceAudioPropagation/Export.cpp: upstream's boykopovar#482 + boykopovar#489 version taken; it is
  the same no-propagation model as astrobot's stand-in, with SourceRender and the
  handle-only UnregisterMaterial already in it.
- State.cpp (boykopovar#453): astrobot's resident depth model kept; it already skips the
  tests of an absent plane (boykopovar#453's test is on astrobot since e087a4f).
- Graphics.cpp, State.hpp, ShaderResources.cpp: astrobot's DepthTarget model kept
  (exportIndex, no DepthSurface.hpp), upstream's ThreadOwned include added.
- BdaResources.cpp: astrobot's form with boykopovar#390's message.
- VulkanDevice.cpp, Context.hpp, PacketExecution.cpp: both sides kept
  (calibrated timestamps, host query reset, GDS, memory budget; pipeline stats).
- Spirv: astrobot's split-wave rules first, then boykopovar#608's wave-mask ballot and
  boykopovar#587's host subgroup lane; astrobot's function LDS sizing and boykopovar#573's LDS lock
  both kept; conditionalDepth kept in the atomic update loops; upstream's
  buffer atomics (boykopovar#321 boykopovar#332 boykopovar#594) and 64-bit LDS atomics taken.
- TechnicalDebt.md: both sides, duplicate lines dropped.


Build fixes folded in: the upstream boykopovar#453 test block duplicated next to
astrobot's adapted copy removed; a lost closing brace after the host
query reset block restored; lookupLog() is a function since boykopovar#590; the
duplicate MUTEX_TYPE_ADAPTIVE constant (astrobot's 93b2d0e equals boykopovar#156)
removed; the ops boykopovar#596 drops removed from the masked-select list and the
BDA test message updated (the gate-batch-2 integ commits 559e4fab6 and
2ec968fb5).
SP4C3B4R-8 added a commit to SP4C3B4R-8/AnyPS5 that referenced this pull request Oct 6, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit cde2df1)

integ: astrobot's resident depth model already skips the tests of an
absent plane (decodeDepth: depthTest needs hasZ, the stencil test needs
the stencil plane, both absent gives no attachment), so boykopovar#453's State.cpp
change is not taken; its test is, reading state.depth.*. Its second
case no longer asserts the stencil test: astrobot drops a stencil test
that always passes and writes nothing (STENCILFUNC ALWAYS, KEEP ops), as
it did before.

(cherry picked from commit 375fe31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants