Skip to content

fix(agc): treat a view past a depth surface's first level as memory - #5982

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/depth-surface-later-level
Oct 16, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/depth-surface-later-level

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

Forspoken (PPSA03984) builds a depth pyramid from its 1984x1116 D32_SFLOAT_S8_UINT depth surface: a compute shader samples one level of a five-level R32F view at the surface's address and stores the next. It stops at the first sample:

compute shader 0x900857a300: AGC graphics: sampling the depth plane of depth surface 0xa22c1b0000 (1984x1116, vk format 130) as a 1984x1116 texture of guest format 22 (vk 100), tile mode 7, dimension 1, levels 1-1, slice 0 is not implemented

A depth surface is one level here, because the driver rejects draws that render a depth mip (DB_DEPTH_VIEW MIP_LEVEL). A view at the surface's address and extent that starts at a later level does not read or write that level, so it is not the depth plane: what it reaches was written by other GPU work or the CPU. DepthSurfaceTexture and DepthSurfaceStorage sent such views to the surface anyway, and the surface rejected the level. They now return no surface for a sampled or storage view that starts past the first level, or a storage access to a later level. The texture and storage caches then read it from memory, as they already do for a view of another extent or format. The level check in RequireStorable can no longer fail and is removed.

A view that starts at the first level and also covers later levels is unchanged: it still includes the depth plane, and sampling it is still rejected.

agc_driver_graphics gains a five-level R32F view of a D32 surface's own extent: its first level must still sample the depth plane, and a view of level 1 must be read as memory. In agc_driver_depth_storage, a storage access to level 1 and a storage and a sampled view of level 1 must leave the depth surface alone. The storage check there expected "not implemented" before. With main's DepthSurface.cpp the graphics test stops with the "levels 1-1" error above and the storage test with "storage image access to level 1 of the depth plane".

Tested

Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on main ed835aa, RTX 4070 Ti with NVIDIA 595.99.02:

Not checked on Windows or on a console.

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
  • Unblocks: none
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions github-actions Bot added the agc libSceAgc* label Oct 14, 2026
@milescoviello
milescoviello force-pushed the fix/depth-surface-later-level branch from 8bcff0c to ac816ca Compare October 15, 2026 02:57
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 15, 2026
@milescoviello
milescoviello force-pushed the fix/depth-surface-later-level branch from ac816ca to 463ab14 Compare October 15, 2026 08:59
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 15, 2026
@milescoviello
milescoviello force-pushed the fix/depth-surface-later-level branch from 463ab14 to 16e193a Compare October 15, 2026 09:39
@milescoviello
milescoviello force-pushed the fix/depth-surface-later-level branch from 16e193a to 51a1871 Compare October 15, 2026 12:00
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cpp
PR 5987 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cpp
PR 6222 core/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cpp
PR 6553 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cpp
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp

A depth surface is one level: the driver rejects draws that render a
depth mip. A sampled or storage view at the surface's address and extent
that starts at a later level, or a storage access to a later level, does
not touch that level, so it is not the depth plane. DepthSurfaceTexture
and DepthSurfaceStorage still sent such views to the surface, which
rejected the level. Forspoken (PPSA03984) builds a depth pyramid from its
1984x1116 D32 depth surface with a compute shader that samples one level
of a five-level R32F view and stores the next, and stopped there.

Both now leave such views to the texture and storage caches, as they
already do for a view of another extent or format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello
milescoviello force-pushed the fix/depth-surface-later-level branch from 00e159d to 92f170c Compare October 15, 2026 16:56
@adriadam10 adriadam10 self-assigned this Oct 16, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on main + this PR: libSceAgcDriver ctest passes except agc_driver_tessellation, which segfaults on RADV on main as well. With DepthSurface.cpp reverted, agc_driver_graphics and agc_driver_depth_storage fail, so the new checks do exercise the change. A view starting past level 0 now goes to memory, and level 0 of a mipmapped view still samples the depth plane. Merging once the full Build is green.

@adriadam10
adriadam10 merged commit 4a9c1d5 into boykopovar:main Oct 16, 2026
8 checks passed
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