Commit Graph
13 Commits
Author SHA1 Message Date
milescovielloandClaude Opus 5.5 92f170c673 fix(agc): treat a view past a depth surface's first level as memory
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>
2026-10-15 16:55:31 +00:00
umangandClaude Opus 5.5 47f7118241 fix(agc): sample a depth surface's stencil plane through an R8_UNORM view
Vulkan cannot view a stencil aspect as UNORM, so an 8-bit UNORM view of
a stencil plane threw. Copy the stencil aspect through a buffer into an
R8_UNORM image of the surface's extent and sample that. The copy is kept
on the surface and refreshed when the surface was written since, or while
it is the bound depth target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:51:43 +02:00
Romans Pokrovskis 6972b5ae07 fix(agc): filter stencil aliases before native depth sampling 2026-10-15 02:15:38 +03:00
Romans Pokrovskis ee1ba73a2f feat(agc): sample native multisampled depth attachments
Adapt our preserved native-depth sampling work from c0d9edf and sample-aware footprint work from 6e35a877, retaining creation-time coherence and initial HTILE proof. The descriptor interface in upstream PR 4820 remains a separate prerequisite. This source draft has not been built or run.
2026-10-15 02:15:37 +03:00
XairRrR 8fec47a4b2 fix(agc): give each slice of a depth array its own HTILE
A slice of a depth array target (DB_DEPTH_VIEW SLICE_START) offset its
depth and stencil addresses but kept the array's DB_HTILE_DATA_BASE as
its HTILE. Every slice then shared slice 0's metadata: a fast clear of
slice 0's HTILE cleared every slice, and a clear of any other slice's
HTILE matched none.

A slice's HTILE now starts at the base plus the slice times one slice's
pipe-aligned metadata, as addrlib addresses it (sliceSize * slice in
Gfx10Lib::HwlComputeHtileAddrFromCoord; HtileMetadataBytes is that slice
size). The recognized HTILE clear kernel now reports the bytes it
clears, 16 per thread (global_store_dwordx4 at the thread index << 4),
and a surface takes the clear when that range covers its HTILE, as a
DMA_DATA fill does; a clear over a whole array still clears every slice.

Uncharted: Legacy of Thieves Collection (PPSA05684) renders its sun
shadow cascades into the four slices of a 2048x2048 D16 array; each
slice's HTILE lies 256 KiB after the previous one.
2026-10-14 19:45:03 +02:00
XairRrR 80d8bd06be fix(agc): share a depth plane's contents across its stencil pairings
A depth surface is keyed by its depth and stencil addresses, so a depth
plane bound with different stencil planes became separate Vulkan images.
Depth written through one pairing and HTILE fast clears consumed by one
were invisible to the others, and later draws tested against stale depth.

Track which surface owns the current contents of each depth and stencil
plane address. Binding a plane through another surface of the same
format, sample count and extent copies that aspect over, or inherits a
pending clear. Sampling a plane address reads the surface that bound it
last.
2026-10-13 13:30:41 +02:00
eljackjoestar-cmd 78ad5d9dfb fix(agc): validate dynamic layer limits and host subgroup size 2026-10-13 13:01:17 +04:00
Simon 7d06be06f0 fix(libSceAgcDriver): refuse storage access to a widened D16 depth plane
A D16_UNORM_S8_UINT surface is stored as D24_UNORM_S8_UINT or
D32_SFLOAT_S8_UINT on devices without the 16-bit format. Copying its
depth aspect yields 4 bytes per texel, so the 16-bit storage image of
the depth plane would receive the wrong layout. Such an access now
throws, naming the surface and both formats; the stencil plane keeps
its 8-bit layout and stays supported.
2026-10-13 15:00:36 +13:00
Dean Galvin 90d899d982 fix(agc): first-slice view of depth plane arrays, refuse plane copies of another host format
A 2D-array T# over a depth surface bound to a shader image declared 2D had
no first-layer view, so the descriptor got a null view and the shader read 0.
The depth plane texture now creates the 2D view of its first slice when its
view is a 2D array, for the depth image itself and for the plane copy.

A 16-bit depth surface with stencil may be stored as D24_UNORM_S8_UINT or
D32_SFLOAT_S8_UINT. The plane copy sizes and copies slices by the guest
format, so several slices or an R16_UINT view of such a surface now throw.
2026-10-13 12:18:50 +13:00
LexroidandClaude Opus 5.5 7d34a6aa8b fix(agc): store D16 depth with stencil as D24 or D32 where the device lacks it
A 16-bit depth target with stencil maps to VK_FORMAT_D16_UNORM_S8_UINT,
which NVIDIA devices do not support as an attachment, so creating it threw.
The surface, its views and the pipelines now use the first of D16_UNORM_S8_UINT,
D24_UNORM_S8_UINT and D32_SFLOAT_S8_UINT the device can attach and sample.
Guest-side choices (16-bit sampled views, bias units) still follow the guest
format. A constant depth bias is scaled by 256 for D24 storage; on D32 float
storage it throws, as its unit depends on the depth value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 22:13:24 +02:00
Scramblrrrr 4de5726d32 fix(graphics): distinguish reused memory from depth storage aliases 2026-10-11 21:29:25 -03:00
AlxcBTWandClaude Opus 5.5 a1827af12a fix(agc): treat other-shaped views of a depth surface's stencil plane as reused memory
Unity reuses the memory of transient render targets: in FPV Simulator
(PPSA10698) an RGBA8 1920x1080 color texture is sampled at the address
that a D32S8 surface's stencil plane occupied earlier. The lookup found
the stencil plane and threw "sampling the stencil plane ... is not
implemented", which ended the presentation.

9d65003c made depth-plane views in a format that cannot hold the plane
fall through to the ordinary texture path. A stencil-plane view whose
texels are not one byte wide cannot hold the 8-bit stencil plane
either, so it now falls through the same way.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:03:09 +02:00
TideOPL 46606e9c73 test(agc): cover depth surface lookups of reused memory
agc_driver_graphics registers a D32 and a D16 surface on a mock device and looks up views at their addresses. Views of the surface's own extent in R32F or R16, and T#s that read the raw depth bits, sample the depth plane; a view of another extent, a 2D array view of another extent, an R11G11B10 view, an R32 uint view without a depth layout and an R32F view of a D16 surface return null and take the ordinary texture path. On main the first of these throws in DepthSurface::Sampled.
2026-10-10 00:44:40 +01:00