AGC: an RGBA8 texture over a depth surface's stencil plane stops FPV Simulator ("sampling the stencil plane ... is not implemented") #2994

Closed
opened 2026-10-10 20:05:07 +00:00 by AlxcBTW · 0 comments
AlxcBTW commented 2026-10-10 20:05:07 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T20:05:07Z.


FPV Simulator (PPSA10698 v01.006.000, Unity 2021.3 URP) ends on Windows when it presents a frame:

[gpu] color target 0x231590000 stays non-resident: AGC graphics: storage image access to depth/stencil surface 0x231590000 is not implemented
[videoout] presentation failed: AGC graphics: sampling the stencil plane of depth surface 0x230cd0000 (1920x1080, vk format 130) as a 1920x1080 texture of guest format 130 (vk 43), tile mode 7, dimension 1, levels 0-0, slice 0 is not implemented (T# 02315900 c8200000 010dc1df 91b00fac 00000000 00700000 00000000 00000000)
terminate called after throwing an instance of 'std::runtime_error'

Cause

Unity reuses the memory of transient render targets. The T# base, 0x231590000, is the stencil plane of the D32S8 surface at 0x230cd0000, and the first line shows the title binding that address as a color target. The texture is a 1920x1080 RGBA8 sRGB view of the same extent, so it reads the color data, not an 8-bit stencil plane.

Since 9d65003c (#1495), DepthSurfaceTexture treats a depth-plane view in a format that cannot hold the plane as reused memory and falls through to the ordinary texture path. Stencil-plane views kept the old handling: every same-extent view of the stencil plane goes to the depth surface, and Sampled throws for any format other than R8 uint.

Fix

AlxcBTW/AnyPS5#26 (a1827af1, on main 57f96fd2). A stencil-plane view whose texels are not one byte wide now falls through to the ordinary texture path, like 9d65003c's rule for the depth plane. 8-bit views keep their current handling. Full CI, with the change merged into main 3cb317fc, passed on Linux, macOS and Windows. I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it.

#454 (open) is broader: it retires a depth surface once another writer covers its depth or stencil plane. Both change the same lines in DepthSurfaceTexture.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, RTX 5070 Laptop.

  • New cases in DepthSurfaceReuse.cpp (agc_driver_graphics): an R8 uint view of a D32S8 surface's stencil plane still samples the plane; RGBA8 and R32F views of the same extent are read as reused memory. Without the source change the RGBA8 case throws the same sampling the stencil plane ... is not implemented error.
  • Non-GPU tests 446/446, agc_driver on NVIDIA 253/253, check_conventions.py passes.
  • In-game: not re-run on this branch. The stop above is from a local build of main with other patches.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5794830393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2994). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-10T20:05:07Z. --- FPV Simulator (PPSA10698 v01.006.000, Unity 2021.3 URP) ends on Windows when it presents a frame: ``` [gpu] color target 0x231590000 stays non-resident: AGC graphics: storage image access to depth/stencil surface 0x231590000 is not implemented [videoout] presentation failed: AGC graphics: sampling the stencil plane of depth surface 0x230cd0000 (1920x1080, vk format 130) as a 1920x1080 texture of guest format 130 (vk 43), tile mode 7, dimension 1, levels 0-0, slice 0 is not implemented (T# 02315900 c8200000 010dc1df 91b00fac 00000000 00700000 00000000 00000000) terminate called after throwing an instance of 'std::runtime_error' ``` ### Cause Unity reuses the memory of transient render targets. The T# base, 0x231590000, is the stencil plane of the D32S8 surface at 0x230cd0000, and the first line shows the title binding that address as a color target. The texture is a 1920x1080 RGBA8 sRGB view of the same extent, so it reads the color data, not an 8-bit stencil plane. Since 9d65003c (#1495), `DepthSurfaceTexture` treats a depth-plane view in a format that cannot hold the plane as reused memory and falls through to the ordinary texture path. Stencil-plane views kept the old handling: every same-extent view of the stencil plane goes to the depth surface, and `Sampled` throws for any format other than R8 uint. ### Fix [AlxcBTW/AnyPS5#26](https://github.com/AlxcBTW/AnyPS5/pull/26) (`a1827af1`, on `main` 57f96fd2). A stencil-plane view whose texels are not one byte wide now falls through to the ordinary texture path, like 9d65003c's rule for the depth plane. 8-bit views keep their current handling. [Full CI](https://github.com/AlxcBTW/AnyPS5/actions/runs/38077839478), with the change merged into `main` 3cb317fc, passed on Linux, macOS and Windows. I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it. #454 (open) is broader: it retires a depth surface once another writer covers its depth or stencil plane. Both change the same lines in `DepthSurfaceTexture`. ### Tested Windows 11, WinLibs GCC 15.2.0 r7, RTX 5070 Laptop. - New cases in `DepthSurfaceReuse.cpp` (`agc_driver_graphics`): an R8 uint view of a D32S8 surface's stencil plane still samples the plane; RGBA8 and R32F views of the same extent are read as reused memory. Without the source change the RGBA8 case throws the same `sampling the stencil plane ... is not implemented` error. - Non-GPU tests 446/446, `agc_driver` on NVIDIA 253/253, `check_conventions.py` passes. - In-game: not re-run on this branch. The stop above is from a local build of `main` with other patches. AI-assisted: yes (Claude Code).
Sign in to join this conversation.
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#2994
No description provided.