Commit Graph
617 Commits
Author SHA1 Message Date
Josip ParlovandJJenkx 16daeffb65 test(agc): sweep the storage image budget across heap sizes and pressure
Checks the floor and caps, that more memory used outside the texture
caches never raises the budget, and that a budget above the floor
leaves room for the live sampled textures plus an eighth of the budget,
on 2-32 GiB heaps.

Co-authored-by: JJenkx <31495916+JJenkx@users.noreply.github.com>
2026-10-20 13:09:21 +02:00
Josip Parlov 321460a4ed fix(agc): reserve only the sampled textures alive from the storage image budget
StorageTextureBudget reserved the larger of the sampled textures alive
and their 2 GiB floor. The sampled budget already reserves
TextureCacheBudget, at least the storage cap, for the storage cache, so
on an 8 GB card the two caches each kept the other's maximum: with
3936 MiB used outside the caches on a 7189 MiB budget and 49 MiB of
sampled textures, the storage budget came out at 306 MiB and sat at its
512 MiB floor while about 2.7 GB of the budget stayed free.

The storage budget now reserves the sampled textures alive and gives
room back as they grow, at its next read. Where they hold 2 GiB or more
the budget is unchanged.
2026-10-20 13:09:20 +02:00
Adrià 6c94343e04 Merge pull request #7627 from JJenkx/fix/agc-infinite-depth-bounds
fix(agc): preserve infinite depth bounds
2026-10-20 13:04:48 +02:00
Dean d14a186f46 Merge pull request #7933 from veosett/codex/windows-pipeline-journal-paths
fix(agc): support long Windows pipeline journal paths
2026-10-20 22:35:05 +13:00
Adrià da077b993b Merge pull request #6773 from XairRrR/fix/empty-screen-scissor
fix(agc): rasterize nothing for an attachment-free draw with an empty screen scissor
2026-10-20 11:14:16 +02:00
Adrià 38e04ad920 Merge pull request #6708 from milescoviello/fix/agc-export-without-targets
fix(agc): accept any fragment export where the draw has no color target
2026-10-20 11:07:44 +02:00
Adrià e9a5a0c849 Merge pull request #6772 from XairRrR/fix/storage-array-window
fix(agc): serve views of arrays past maxImageArrayLayers from their viewed slices
2026-10-20 10:55:09 +02:00
Kovalev Vladislav 80024c48fd test(agc): serialize journal replay result capture 2026-10-20 14:40:12 +06:00
Kovalev Vladislav 61fa2d2221 test(agc): cover long pipeline journal paths and external tails 2026-10-20 14:19:17 +06:00
Dean 524259954a Merge pull request #6457 from EagleBearerYS/perf/agc-host-import-aligned-blocks
perf(agc): import adjacent host ranges as aligned blocks and stop re-trying budget refusals
2026-10-20 09:51:55 +13:00
XairRrR f408eb711e test(agc): give the mock device a maxImageArrayLayers limit
Texture and storage images now refuse more array layers than the
device's maxImageArrayLayers. The mock context left that limit at 0,
so agc_depth_copy_kept_bytes failed creating its 8x8 storage image.
Give it the 2048 layers real devices report.

AI-assisted: yes
2026-10-19 21:37:26 +02:00
Dean Galvin f3751e96ad Merge main into pr-6457
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
2026-10-20 03:54:07 +13:00
Gjon Gojcevic a15694eb94 feat(agc): render layered draws into a one-slice surface as an array of its view's slices
A layered draw into a color view of slices 0 to 5 of a 2D surface whose
CB_COLOR_ATTRIB3 declares one slice was refused. The CB clamps the
render target array index to the view's SLICE_MAX, not to the surface's
slice count, so each layer is written one slice pitch further on.
PPSA01317 renders a 512x512 cube map this way. Such a view now renders as
a 2D array of the view's last slice + 1 slices.

AI-assisted: yes
2026-10-19 15:52:35 +02:00
Gjon Gojcevic 8c84dfcd35 feat(agc): render layered draws into 2D array color views
A draw whose vertex shader exports the render target array index into a
color view of several slices of a 2D array target was refused. The view
now renders layers lastSlice - slice + 1 through a 2D array attachment
view of the array's resident image starting at its first slice, and the
draw marks every rendered slice dirty. A view of several slices of a
surface that is not a 2D array is still refused, as is a layered draw
without the array's resident image.

AI-assisted: yes
2026-10-19 15:52:35 +02:00
Adrià 85029a00f5 Merge pull request #6762 from simonbronk/fix/stencil-op-value-export
fix(agc): replace with a stencil operation value the pixel shader exports
2026-10-19 15:45:10 +02:00
Adrià d5bbceb4f7 Merge pull request #6725 from johandavidcm/fix/agc-depth-write-address
fix(agc): compare the depth write base only when the depth plane is written
2026-10-19 14:48:21 +02:00
Adrià FranchandClaude Sonnet 5.5 fd0b928fd3 test(agc): accept the folded stencil operation value when SPIR-V tools optimize the module
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 12:53:13 +02:00
simonbronkandClaude Opus 5.5 7563b4a480 fix(agc): replace with a stencil operation value the pixel shader exports
With DB_SHADER_CONTROL.STENCIL_OP_VAL_EXPORT_ENABLE the pixel shader
supplies the value that REPLACE_OP and the add and subtract operations
use in place of DB_STENCILREFMASK.STENCILOPVAL. The bit was refused as a
whole, which stopped Onimusha: Way of the Sword (PPSA27836) at a
DB_SHADER_CONTROL 0x45 draw with DB_STENCIL_CONTROL 0x40040 (REPLACE_OP
on depth pass, both faces), write mask 0xff and compare ALWAYS.

The export is accepted with the 32_GR and 32_ABGR Z formats. When no
reachable operation through a non-zero write mask reads the value, it
cannot change the result and is ignored. Without a test value export, a
reachable REPLACE_OP becomes REPLACE with the exported value as
FragStencilRefEXT (or the bounded replay on devices without the
extension), provided both faces compare without the test value and use
no ONES or REPLACE_TEST; early tests throw. The add and subtract
operations, and REPLACE_OP with a test value export, still throw.

The value is read from bits 8-15 of the second MRTZ channel: the
title's pixel shader shifts it left by 8 right before exp mrtz
(v_lshlrev_b32 v0, 8, v0). That is the only evidence for the layout and
it is listed as technical debt. The pixel stage info carries the new
flag into the cache key, the draw keys and request serialization
version 31.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:53:13 +02:00
Adrià c82ffb0f20 Merge pull request #6647 from binarycleric/fix/agc-table-update-after-bind
fix(agc): bind image and sampler tables through update-after-bind limits
2026-10-19 12:20:50 +02:00
Dean 7f37d45ed3 Merge pull request #6451 from EagleBearerYS/fix/agc-sample-location-grid-fallback
fix(agc): fall back to pixel (0,0)'s sample locations where the device has no 2x2 grid
2026-10-19 22:22:04 +13:00
Dean Galvin a48e28a632 Merge main into pr-6457
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
2026-10-19 22:12:18 +13:00
Adrià 5de7c09c37 Merge pull request #6669 from milescoviello/fix/msaa-cmask-codes
fix(agc): read a multisampled target's CMASK by its MSAA codes
2026-10-19 10:44:42 +02:00
Adrià f161098d3b Merge pull request #6563 from notaxeltv/feat/agc-msaa-enable-rect-list
fix(agc): allow MSAA_ENABLE single-sample rect lists
2026-10-19 10:44:32 +02:00
JJenkx 4bd0f1d450 fix(agc): preserve infinite depth bounds 2026-10-19 04:33:54 -04:00
Adrià b715404323 Merge pull request #6646 from EagleBearerYS/fix/agc-heap-mirror-replan-unwatched
fix(agc): plan a heap again when its mirror's range has left the write watch
2026-10-19 10:15:31 +02:00
Jon Daniel 070a3f12c6 fix(agc): bind image and sampler tables through update-after-bind limits
Image and sampler table capacity came only from the regular descriptor
limits. MoltenVK reports Metal's argument table limits there (256 sampled
images and 16 samplers per stage), below the typed heaps the tables are
reserved on top of, so both capacities were 0 and every table draw or
dispatch was refused as if the device lacked descriptor indexing. Its
update-after-bind limits are 1000000 sampled images and 500000 samplers.

- descriptorBindingSampledImageUpdateAfterBind is queried and enabled, and
  the update-after-bind limits are read when either it or the storage
  buffer feature is present.
- A table whose regular capacity is 0 takes its capacity from the
  update-after-bind limits. Its binding is update-after-bind and its set
  layout and pool are update-after-bind ones, in ShaderResources and in
  DescribeSetLayouts alike. A table that fits the regular limits is
  unchanged.
- An update-after-bind set layout and its allocation are checked against
  the update-after-bind sampled image and sampler limits when the device
  has descriptorBindingSampledImageUpdateAfterBind. Vulkan counts the
  descriptors of such sets against those limits in place of the regular
  ones, and requires them to be at least the regular ones only when the
  feature is supported, so without it, and for storage images, the
  regular limits are kept as before. Storage buffers keep their own
  update-after-bind flag.
- Compute pipeline capture and replay accept update-after-bind sampled
  image and sampler bindings.
2026-10-19 09:34:13 +02:00
notaxeltvandCursor 92f11a93ed fix(agc): allow MSAA_ENABLE single-sample rect lists
Filled rectangles (VGT_PRIMITIVE_TYPE 7 and 17) use the same single-sample MSAA_ENABLE path as triangles; PPSA03541 stops on a rect-list draw otherwise.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 09:23:53 +02:00
Dean Galvin 23fc286e4c Merge main into pr-6451
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
2026-10-19 20:08:05 +13:00
Dean Galvin 33bbd084b9 Merge main into pr-6457
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
2026-10-19 20:05:31 +13:00
gguerra26 538b63ef4c fix(agc): normalize unused viewport depth ranges
Use representable viewport endpoints only when the draw has no depth attachment and its pixel shader does not read PositionZ. Preserve XY coverage, clip-space mode, depth clamping, and validation of non-finite inputs.

Balatro (PPSA21402) reaches rendering on Apple M1 with MoltenVK after this change instead of stopping at VK_EXT_depth_range_unrestricted. Depth-dependent draws retain their original behavior.
2026-10-19 09:02:24 +02:00
Adrià 72aba1dff5 Merge pull request #6571 from klosixgaming-arch/fix/agc-cb-resolve-msaa-disabled
fix(agc): compare a CB resolve's sample count with the rasterizer onl…
2026-10-19 08:58:54 +02:00
Adrià fdf64dba83 Merge pull request #6567 from SleglJan/pr/rewritten-set-variable-count
fix(agc): reuse a recycled descriptor set only for a table of its own size
2026-10-19 08:52:26 +02:00
al3w0f205 55d4a9fa1d feat(libSceAgcDriver): support quad-list primitive type
Primitive type 19 (DI_PT_QUADLIST, 0x13) is used by Unity and other engines for UI quads, sprites and font glyphs. Because Vulkan lacks native quad-list primitive topology, quad draws are expanded on the CPU into indexed triangle lists with 6 indices per 4-vertex quad, respecting the first/last provoking vertex configuration and discarding incomplete trailing vertices. Adds unit tests and documents the functional debt.
2026-10-19 07:39:59 +02:00
Dean 4ffb0cd12b Merge pull request #7377 from EagleBearerYS/fix/shader-pixel-bda-single-exit
fix(shader): end a pixel shader's failed BDA reads through one exit
2026-10-19 18:22:07 +13:00
Adrià ceab3dd674 Merge pull request #6523 from billythemenace2/fix/agc-mesh-support-before-validation
fix(agc): refuse mesh-path draws on a device without mesh shaders before validating them
2026-10-19 06:08:33 +02:00
Adrià e0b8be9dc5 Merge pull request #6530 from milescoviello/feat/smoothing-mixed-samples
feat(agc): draw radeonsi line and polygon smoothing (SAMPLE_COVERAGE, merged mixed samples)
2026-10-19 06:06:26 +02:00
Dean 3ddbc4accc Merge pull request #4650 from Mouad-Scriptz-0/feat/agc-depth-range-remap
feat(agc): remap a viewport depth range the device cannot express into the vertex shader
2026-10-19 16:52:31 +13:00
Dean 3fda339541 Merge pull request #7169 from Ondra97/codex/fix-command-batch-fence-failure
fix(agc): ignore failed fence creation outputs
2026-10-19 16:52:12 +13:00
Yunus Shaikh 0644811579 Merge main into perf/agc-host-import-aligned-blocks
The host-import debt entry takes #6472's budget sentence and keeps this branch's sentence on remembered refusals.
2026-10-18 20:40:40 -07:00
billythemenace2andClaude Opus 5.5 60a2aa47d6 fix(agc): refuse mesh-path draws on a device without mesh shaders before validating them
A draw on the mesh path was validated before its pipeline checked for
mesh shader support, so on a device without VK_EXT_mesh_shader (an RDNA1
RX 5700 XT) Sackboy: A Big Adventure (PPSA01289) stopped on "subgroup
capability 61 is unsupported for shader stage 128" instead of the actual
cause. ValidateShaders now takes the device's mesh shader support and
refuses such a draw first with "device does not support mesh shaders".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 05:19:01 +02:00
klosixgaming-arch 0d4cbd538b fix(agc): compare a CB resolve's sample count with the rasterizer only under MSAA_ENABLE
PPSA08270 (Eternights) stopped after its story intro with "AGC graphics:
CB resolve from a target whose sample count differs from the
rasterizer's". It resolves a 4x 512x512 target into a single-sample one
with PA_SC_MODE_CNTL_0.MSAA_ENABLE off while PA_SC_AA_CONFIG still holds
2x from earlier draws. Without MSAA_ENABLE the scan converter does not
use PA_SC_AA_CONFIG's sample count, so the resolve takes its sample
count from CB0 as it already does when PA_SC_AA_CONFIG is single-sample.
2026-10-19 03:06:07 +00:00
Dean fa0ac6d5ce Merge pull request #5926 from xXPBSXx/fix/agc-vertex-fetch-overhang
fix(libSceAgcDriver): zero the overhanging record of a vertex fetch
2026-10-19 15:56:44 +13:00
Yunus Shaikh e19cf1ac21 Merge main into fix/agc-heap-mirror-replan-unwatched
The host-import debt entry takes main's budget sentence and keeps this branch's heap-mirror sentence.
2026-10-18 19:55:25 -07:00
Jan ŠléglandClaude Opus 5.5 04aef899a6 fix(agc): reuse a recycled descriptor set only for a table of its own size
DescriptorCache::AllocateRewritten handed out any recycled set of the requested layout. The
variable descriptor count of an image-table binding is fixed when its set is allocated, and
PrepareDrawBindings writes the table's present elements, up to its current element count, into
the set it gets. A draw whose table had more elements than the table the recycled set was
allocated for could write descriptors past the set's allocation
(VUID-VkWriteDescriptorSet-dstArrayElement-00321).

A set from a chain pool now records the variable count it was allocated with, as a dedicated-pool
set already does, and recycled sets are kept per layout and variable count, so a rewritten draw
reuses a set only for a table of the same size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 04:40:35 +02:00
Yunus Shaikh af6f2ecab8 Merge main into perf/agc-host-import-aligned-blocks
Main's sameRange for a failed import now takes the import budget, as the HostImport overload does, so a recorded failure is compared against the run the budget would import again.
2026-10-18 19:38:07 -07:00
Dean Galvin 41764f27ac Merge main into pr-4650
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.cpp
2026-10-19 15:36:07 +13:00
AhirandClaude Opus 5.5 f970620d95 fix(agc): keep half the host heap out of the host import budget
Imports, type-3 mirrors and the buffers and textures placed in host memory share the driver's system memory heap. On Windows that heap is half the physical memory, so on a 16 GiB machine the old budget (the heap less 2 GiB) let imports hold about 6 of its 8 GiB, and host buffer allocations then overflowed into the 256 MiB device-local host-visible heap and failed. The budget now reserves the larger of 2 GiB and half the largest host heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 04:11:15 +02:00
xXPBSXxandClaude Sonnet 5.5 d01548e81b fix(libSceAgcDriver): zero the overhanging record of a vertex fetch
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 03:47:33 +02:00
Adrià 23629c2847 Merge pull request #6454 from EagleBearerYS/perf/shader-image-table-reuse-v3-pr
perf(agc): share one image table per heap and write epoch through capture, compare, resolution and descriptors
2026-10-19 03:39:03 +02:00
Adrià 72b0ab3e8e Merge pull request #6312 from meh7an/perf/agc-cut-draw-allocations
perf(agc): cut per-draw heap allocations
2026-10-19 03:38:58 +02:00