Commit Graph
548 Commits
Author SHA1 Message Date
Dean Galvin 2e329d1179 Merge main into pr-6479 via the rebased #6457
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
#	docs/dev/debt/libSceAgcDriver.md
2026-10-19 21:02:08 +13:00
Dean Galvin fe5c276ec7 Merge main into pr-6457
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
2026-10-19 21:00:19 +13:00
Adrià 75ec3b5671 Merge pull request #6543 from karanvora2599/fix/agc-radv-fill-memory-hle
fix(agc): take RADV's fill-memory kernel as a buffer fill
2026-10-19 09:37:38 +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 <[email protected]>
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
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
JJenkx c8d7e37f4c fix(agc): initialize point size and limits from SDK defaults 2026-10-19 02:48:17 -04:00
Adrià fcde2cf95c Merge pull request #6529 from al3w0f205/feat/agcdriver-quadlist-primitive
feat(libSceAgcDriver): support quad-list primitive type
2026-10-19 08:38:11 +02:00
Adrià 22e59888ce Merge pull request #6467 from fogydes/feat/agc-driver-command-buffer-submit
feat(libSceAgcDriver): implement command buffer submission
2026-10-19 08:37:37 +02:00
Karan Vora 2907ca6cac fix(agc): take RADV's fill-memory kernel as a buffer fill
RADV initializes and fast-clears DCC keys with its fill_memory compute
kernel, which stores through a global address. Run as an ordinary
dispatch, its stores name no range. The DCC key tracking therefore saw
a key fill only once it had landed in guest memory, which could be
after later writes to the surface had already been recorded.

vkQuake (PPSA99010) hits this on every item pickup:
- the scene renders into a second color buffer;
- RADV's UNDEFINED -> GENERAL barrier fills color buffer 0's keys with
  DCC_CLEAR_0000;
- a screen-effects compute pass writes color buffer 0;
- the UI pass draws on color buffer 0.
The keys landed while the UI pass was being recorded. The refresh took
them for a clear made after the compute pass, dropped its results and
cleared the image to black. For the length of the pickup flash the
scene was black, with only the HUD drawn.

The fill HLE now matches the 16-byte variant of the kernel as a fill of
min(threads * 16, user[4] + 16) bytes. The kernel takes its address in
user[2..3], its largest store offset in user[4] and its value in
user[5]. A key fill through it is handled where it is in the command
stream.
2026-10-19 08:21:36 +02:00
fogydes c3775ea000 feat(libSceAgcDriver): implement command buffer submission 2026-10-19 11:28:13 +05:30
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 Galvin 9e32729ab5 Merge main into pr-7154
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
#	core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
2026-10-19 18:29:52 +13:00
Yunus Shaikh acf80cc109 docs(agc): describe the 2x checkerboard in the sample-location debt entry without title ids 2026-10-18 20:58:27 -07:00
Yunus Shaikh a932bcc7d6 fix(agc): take shader cache FormatVersion 41 and word the grid-reference skip as a device limitation
main took FormatVersion 40 with #6486, so this branch moves to 41. The grid-reference test's skip now reads as a device that does not keep depth at custom sample locations, the wording tools/check_skips.py accepts as a device limitation. The sample-location debt entry describes the 2x checkerboard without naming titles.
2026-10-18 20:57:10 -07:00
Yunus Shaikh 18463ff5c2 Merge main into fix/agc-sample-location-grid-exact
#4650 took request serialization version 35 for its depth remap flag, so this branch's sample order moves to 36. The serialization tests drop #4650's trailing byte from every older version they build, as main's do, along with the iteration fields and the sample order.
2026-10-18 20:56:57 -07:00
elliot 11a7b61d72 fix(agc): split oversized dispatches with workgroup offset specialization
A dispatch over maxComputeWorkGroupCount was split into vkCmdDispatchBase
chunks whose base reached the limit, which VUID-vkCmdDispatchBase-baseGroupX-00421
forbids, and NVIDIA refused the split outright.

Compute modules now declare WorkgroupOffset specialization constants (default 0)
that the recompiler adds to WorkgroupId and GlobalInvocationId and keeps
unmaterialized. Each chunk is recorded with vkCmdDispatch from group 0, bound to
a pipeline variant specialized with the chunk's base. The NVIDIA throw is gone;
device-memory LDS splits still throw.

Fixes #7375
2026-10-18 22:54:33 -05: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
Yunus Shaikh 21b14210ff Merge main into perf/agc-remember-evicting-refusals
The host-import debt entry takes #6472's budget sentence and keeps this branch's sentence on remembered refusals.
2026-10-18 20:40:45 -07: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
Yunus Shaikh 3a9bc814c2 Merge main into perf/agc-host-import-blocks
importBudget keeps this branch's configuredBudget split and takes #6472's HostImportBudget for the default; the host-import debt entry takes #6472's budget sentence next to this branch's report and refusal sentences.
2026-10-18 20:38:28 -07: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
Yunus Shaikh 4d52a66fd3 Merge main into perf/agc-remember-evicting-refusals
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:39:07 -07: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
Yunus Shaikh abf42b2214 Merge main into perf/agc-host-import-blocks
Main's sameRange for a failed import now takes this branch's 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:36:25 -07: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 <[email protected]>
2026-10-19 04:11:15 +02:00
XairRrR 132e69d595 fix(agc): drop the depth plane images of older surfaces a new plane overlaps
Each depth surface stores its plane through a storage image of its own,
kept for the surface's life. A title that switches output resolution
binds new depth targets over memory where the previous targets' planes
were, and the old images stayed live there. Storage images over the same
memory lend each other pending results, so a later store of the new
plane did not reach guest memory and buffer reads kept seeing the old
depth. A bind now drops the images and the pending store of older
surfaces whose planes overlap its plane over another range. A
same-range surface (another stencil or HTILE address) keeps its image.
The scan runs only when a surface or plane image was created since the
surface's last scan.

AI-assisted: yes
2026-10-19 03:49:59 +02:00
XairRrR 84e3b73f16 fix(agc): keep depth planes coherent with buffer reads and writes of their memory
A depth surface lives in its Vulkan image, so a buffer read of its depth
plane saw guest memory the surface never wrote, and a buffer write into the
plane never reached the surface: binding the target again kept the old
depth.

- A single-sample 32-bit depth surface with the 64 KiB Z swizzle
  (DB_Z_INFO SW_MODE 24) keeps a storage image in that swizzle over its
  plane. A bind that writes or fast clears depth marks the plane stale;
  FlushDepthPlanes copies the depth into the storage image and stores it
  into guest memory. It runs from StorageTexture::FlushPending, when a
  buffer upload finishes (over its regions and address space), and before
  a dispatch for each GuestBuffers V# it binds (a cached dispatch reads
  them without an upload). A reused build flushes its in-place buffer
  regions, and an image lookup flushes the range it reads, as do the
  write-stamp proofs that let a cached image or a reused build skip that
  lookup: a stale plane's memory looks unchanged to them.
- Stale planes are kept as ranges under their own lock with an atomic
  hull; a flush that overlaps none returns without the GPU and surface
  locks.
- Every bind of such a surface, and every flush of its stale plane,
  collects the plane's writes. Written by someone else since the surface's
  previous bind, store or reload, the plane is reloaded from memory
  instead of stored, so a guest write after a depth draw is not
  overwritten by that draw's late store. A pending HTILE fast clear wins
  over the reload.
- A color target flushes the stale planes under it before it retires their
  surfaces, so a target that loads or blends reads the stored depth. A
  retired surface's plane is no longer stale: a later flush never stores
  its old depth over what the new owner of the memory wrote.
- The depth surfaces lock is recursive: a store reached from a flush under
  DepthSurfaceTexture re-enters it.
- Draws pass whether they write depth, so read-only binds do not mark the
  plane stale.

PPSA05684 copies its main depth plane into two ping-pong planes with a
buffer compute, draws the cage's depth into them and fogs its menu from the
result; without this the copy carried nothing and the fog covered the
cliff and the cage.

agc_driver_depth_plane_buffer_memory draws depth 0.5 into such a plane,
fetches vertices from it (the plane must hold 0.5), writes 0.75 into the
memory and draws at 0.5 under LESS (must pass), then checks the depth
written after the reload reaches memory again. On a new plane it writes
memory after a depth draw and before any store: a buffer read must keep
the guest bytes and the next bind must reload them; a guest write before a
depth draw must then lose to that draw. A linear texture at an offset into
a plane must read what memory holds after a flush, also when it is viewed
through its cached storage image after another depth draw. On a plane with
HTILE, an HTILE fast clear after a guest write must win. A color target
that blends ZERO/ONE over a plane just drawn at 0.5 must write back the 0.5
it loaded.

AI-assisted: yes
2026-10-19 03:49:59 +02:00
xXPBSXxandClaude Sonnet 5.5 55b197d31c docs(debt): describe the vertex fetch overhang case without the title
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-19 03:47:33 +02:00
xXPBSXxandClaude Sonnet 5.5 d01548e81b fix(libSceAgcDriver): zero the overhanging record of a vertex fetch
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-19 03:47:33 +02:00
Dean Galvin 4d4ae6e5eb Merge main into pr-4650
# Conflicts:
#	core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
#	core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
#	core/shader/recompiler/tests/RequestSerializerTests.cpp
2026-10-19 14:32:36 +13:00
Yunus Shaikh 745f199d5a Merge main into fix/agc-sample-location-grid-exact
Combines this branch's sample order with #6470's once-per-pixel and once-per-sample inputs. The pixel request keeps both sides' fields: #6470's iteration, position location and sample locations are serialized at version 34, and the sample order after them at version 35. The serialization tests move the sample-order bytes after the iteration fields and drop both from older versions. The pixel info collector adds sample order to the SampleLocationsVary inputs, and the draw keys compare and hash both. EmitSampleOffset's iterated index already goes through GuestSampleIndex, since the SampleId builtin does. The shader cache stays at FormatVersion 40, and the sample-location debt entry takes #6470's sentence on the position inputs.
2026-10-18 18:30:37 -07:00
Yunus Shaikh b6489b863a Merge main into fix/agc-sample-location-grid-fallback
The custom MSAA sample-location debt entry keeps this branch's grid stand-in text and takes main's sentence on ANCILLARY and the position inputs of a once-per-pixel shader.
2026-10-18 18:25:31 -07:00
Adrià 00666eeb36 Merge pull request #6470 from EagleBearerYS/fix/recompiler-once-per-pixel-sample-inputs
fix(recompiler): run a pixel shader the guest does not iterate once per pixel
2026-10-19 03:21:34 +02:00
Adrià 12c1d1875f Merge pull request #6464 from AymanFE/claude/project-thread-d8qx30
fix(agc): overestimate single-sample draws with centroid inputs
2026-10-19 03:02:01 +02:00
MaxandClaude Opus 5.5 5140b08d82 feat(libSceAgc): implement sceAgcDcbSetIndexIndirectArgs
Write the INDEX_ATTRIBUTES_INDIRECT packet the console's builder writes,
as measured by the prosper console oracle, with OpenAGC's signature, and
report its measured size of 16 bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 02:53:01 +02:00
Yunus Shaikh 4bd379b6ed Merge main into perf/agc-remember-evicting-refusals
Resolves the AGC driver debt file bullet by bullet.
2026-10-18 17:12:07 -07:00
Yunus Shaikh 4bbb952fac Merge main into perf/agc-host-import-aligned-blocks
Resolves the AGC driver debt file bullet by bullet.
2026-10-18 17:11:27 -07:00
Yunus Shaikh 03fab5cffc Merge main into perf/agc-host-import-blocks
Resolves the AGC driver debt file bullet by bullet.
2026-10-18 17:10:33 -07:00
Dean a373e85e56 Merge pull request #7194 from XairRrR/fix/agc-htile-later-slice-clear
fix(agc): take a later slice's HTILE clear when every word has ZMask 0
2026-10-19 13:09:45 +13:00
Yunus Shaikh 78b0e2f281 Merge main into fix/agc-sample-location-grid-exact
Takes #6215's framebuffer owners and target-owned sampled textures, keeping this branch's sample-order steps after the framebuffer and the sampled-only usage next to the storage order view.
2026-10-18 16:43:28 -07:00
Adrià a6dd29b3da Merge pull request #6215 from Ondra97/codex/fix-msaa-retired-target-lifetime
fix(agc): reclaim retired multisample color targets
2026-10-19 01:37:13 +02:00
Ondra97andRomans Pokrovskis 785f8f7bcf fix(agc): reclaim retired multisample color targets
Co-authored-by: Romans Pokrovskis <[email protected]>
2026-10-19 01:08:37 +02:00
Ondra97 a64d038154 fix(libs): flush pending GPU results before file writes 2026-10-19 00:53:25 +02:00
Dean Galvin cf4d1f4a97 Merge main into pr-4650
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.cpp
2026-10-19 11:15:57 +13:00
Yunus Shaikh d13a90d015 Merge main into fix/recompiler-once-per-pixel-sample-inputs
Resolves the shader debt file bullet by bullet: main's EmitSetAttribute entry, and this branch's PERSP_SAMPLE/LINEAR_SAMPLE and pixel-position entries.
2026-10-18 15:14:25 -07:00
Yunus Shaikh d2e2cd650d Merge main into fix/agc-sample-location-grid-exact
Keeps the multisampled target's sample-order view fields next to #6297's HTILE fields.
2026-10-18 14:56:26 -07:00