Commit Graph
1505 Commits
Author SHA1 Message Date
Adrià 2b6c1112b8 Merge pull request #6763 from SP4C3B4R-8/perf/windows-draw-input-copies
perf(agc): copy draw inputs on NVIDIA's Windows driver instead of binding host imports in place
2026-10-19 13:45:06 +02:00
Adrià f6eeca4f5f Merge pull request #6786 from fdfawef324/claude/agc-indirect-args-stale
fix(agc): wait for address-based writers before reading indirect dispatch arguments
2026-10-19 13:16:24 +02:00
Adrià ebf054c67f Merge pull request #6781 from XairRrR/fix/cmask-clear-host-stage
fix(agc): include the host stage in the CMASK clear's host-access barriers
2026-10-19 12:45:52 +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
SP4C3B4R-8andClaude Opus 5.5 4a6069481f perf(agc): copy draw inputs on NVIDIA's Windows driver instead of binding host imports in place
NVIDIA's Windows driver reads a host import of guest memory far slower than a buffer it allocated.
Since draw vertex and index ranges are bound in place from host imports (#2253, measured on Linux), Astro
Bot's Crash Site on Windows 11 with an RTX 5070 Ti spends 164 ms of every frame in draws on the GPU, and
45 ms with the ranges copied as before; with the same build, 4.71 fps in place against 7.52 copied. An
RTX 3060 shows the same (draws 32.3 against 24.3 ms per frame), while AMD's Windows driver reads them in
place about as fast as a copy (RX 9070 XT: 69.8 against 73.1 ms), so copying there only costs CPU.

The device decides once (DrawInputsInPlaceUsable, Context::drawInputsInPlace): ranges are copied with
VK_DRIVER_ID_NVIDIA_PROPRIETARY on Windows and bound in place everywhere else. APS5_DRAW_INPUTS_IN_PLACE=1
binds them in place and APS5_NO_DRAW_INPUTS_IN_PLACE=1 copies them on any device, the second winning.
agc_draw_inputs_in_place_driver checks the decision per driver and host; agc_draw_inputs_copied checks
that an aligned imported range is copied and its read not noted when the context copies, whatever the
inherited environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN8FJFTedayRXLHythXkZ4
2026-10-19 11:48:36 +02:00
Dean 83bf557dcf Merge pull request #7461 from parl0v/perf/dcc-shadow-key-sync
perf(agc): wait only for the key bytes' writers when reading DCC keys under a unit shadow
2026-10-19 22:22:12 +13: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
Adrià 13cf6954a3 Merge pull request #6674 from veosett/codex/fmask-image-reads
fix(agc): read uncompressed FMASK images from guest memory
2026-10-19 11:05:57 +02:00
Adrià d53d0e2d40 Merge pull request #6606 from veosett/codex/indirect-index-prefix
fix(agc): resolve sparse indirect index ranges per record
2026-10-19 10:47:44 +02: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
f6c8e8474f fix(agc): wait for address-based writers before reading indirect dispatch arguments
A CPU read of DISPATCH_INDIRECT arguments waited only through the flush
hook, which waits for the ranges recorded work noted as pending writes.
An address-based store (FLAT/GLOBAL, or through a descriptor the
recompiler cannot resolve to a static buffer) is not recorded as a
pending write: its batch leases the registered allocations, and only the
guest pin waiter finished that batch. So the thread-dimension,
misaligned and disabled paths, the fill-kernel path and the device's CPU
fallback read the arguments from before an address-based producer ran.
GTA V (PPSA04264) dies loading Story on such a read: a 64-thread clear
kernel read {160, 288, 0xffffffff} as thread dimensions
(3x288x4294967295 groups), bytes its 1-thread setup kernel had not yet
overwritten with {n, 1, 1}, and threw "workgroup count
3x288x4294967295 exceeds device limits".

Every CPU read of dispatch arguments at execution now first finishes the
recorder up to the newest batch recorded with a lease
(Graphics::FinishLeaseWork). The group read-ahead still reads without
waiting; a dispatch it resolved is adopted only when the execution-time
read gives the same counts, and one that differs is dropped and counted
in the [groupcap] line. The device limit error names the argument
address and cpuReason, and the driver adds the queue, path and
read-ahead outcome. The [indirect] read time includes the lease wait,
and the [recorder] sync-site table records the offset of
FinishLeaseWork's caller. The CPU reads that still miss address-based
writes (indirect draw arguments and count, the copy kernel's count
record, the awaits-title checks) are listed in the technical debt.

IndirectArgumentsPendingProducer covers the execution-time CPU argument
reads on compute queues and the pending-label CPU fallback in the Vulkan
device. Its sixth case records a real argument label behind a host Vulkan
event in an earlier batch and an address-based producer in the later open
batch. The event releases only after that producer batch is submitted;
a bounded watchdog releases for cleanup but fails the case. It requires
a deferred producer lease, an unsubmitted producer at the argument
decision, cpuReason 2 and the fresh arguments and counter result. Small
valid stale counts keep a broken-wait control finite on every driver.
Exact CPU-reason and watchdog diagnostics identify the failing path. This
replaces a spinning workload whose earlier label could retire before
the fallback decision on lavapipe, allowing a false green with cpuReason 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
2026-10-19 10:18:11 +02: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
Adrià 5325133b13 Merge pull request #6609 from meh7an/perf/agc-pending-writes-published-union
perf(agc): rule out pending write overlaps from the published union
2026-10-19 10:14:18 +02:00
Adrià 9a5726cc18 Merge pull request #6601 from Amoenus/codex/feat-msaa-sampled-readback
feat(agc): read individual multisample image samples
2026-10-19 10:14:12 +02:00
Adrià Franch 6a894d4c1c Merge upstream/main into codex/fmask-image-reads 2026-10-19 09:48:51 +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
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à 64a9caa62d Merge pull request #6499 from parl0v/perf/keep-import-across-split
perf(agc): keep a host import across a split of its guest range
2026-10-19 08:54:36 +02:00
Adrià c1ca83479f Merge pull request #6566 from TheAggie/perf/agc-draw-fewer-allocations
perf(agc): fewer heap allocations per recorded draw
2026-10-19 08:53:07 +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
Dean ea5b811341 Merge pull request #7489 from AlxcBTW/pr/barrier-batch
perf(agc): skip the staging, write-back and label-run leading barriers a covering barrier already orders
2026-10-19 19:51:53 +13: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à 8b54728061 Merge pull request #6360 from hypermoist/fix/agc-gpu-indirect-dispatch-limit
fix(agc): check GPU-side indirect dispatch group counts against the device limit
2026-10-19 08:37:32 +02:00
Josip Parlov b2a12bac84 fix(agc): hold a released trimmed import through the recorder
releaseTrimmed freed the trimmed import's memory at once when the
calling thread did not hold GpuMutex. It now hands the memory to the
active recorder whenever there is one, as retireImport does for the
imports importRunAt and refreshImports retire, so the memory outlives
the open batch and every batch submitted before it.
2026-10-19 08:02:13 +02:00
Josip Parlov 16473dbbe1 perf(agc): keep the larger side of a host import cut inside its range
A protect or unmap strictly inside a plain host import still retired the
whole import, and the next access imported both sides of the cut again.
The larger side is now kept as a trimmed import, as a cut at the head or
the tail already is, and only the smaller side is imported again. Equal
sides keep the tail.
2026-10-19 08:02:13 +02:00
Josip Parlov f9caa09745 perf(agc): keep a host import across a split of its guest range 2026-10-19 08:02:12 +02:00
hypermistandClaude Opus 5.5 6a33a080bf Merge upstream main into fix/agc-gpu-indirect-dispatch-limit
recordDispatch now reads its indirect offset through HostImportOffset,
which adds the import's lead. The unchecked path passes that offset to
vkCmdDispatchIndirect; the clamp kernel reads from import.address plus
the guest offset, since import.address already includes the lead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 18:57:30 +13:00
Dean 323ece2445 Merge pull request #7445 from elliot1377/fix/agc-dispatch-split-base
fix(agc): split oversized dispatches with workgroup offset specialization
2026-10-19 18:51:58 +13:00
Dean 819ced2e1d Merge pull request #7674 from thuanquang/fix/mesh-layer-block
fix(shader): write a mesh shader's layer through a per-primitive block
2026-10-19 18:51:54 +13:00
Adrià 9f5d4bd929 Merge pull request #6503 from ThatsLeo/perf/shader-hw-f32-flush
perf(shader): flush f32 denormals in hardware when a startup probe matches the emulation
2026-10-19 07:40:27 +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 ade174f250 Merge pull request #7050 from SP4C3B4R-8/fix/depth-retire-whole-plane
fix(agc): retire a depth surface on a storage write only when the write covers a whole plane
2026-10-19 18:22:02 +13:00
Dean Galvin fac38912d9 Merge main into pr-7489
# Conflicts:
#	core/libs/prx/libSceAgcDriver/CMakeLists.txt
2026-10-19 18:04:50 +13:00
ThatsLeo ac14d6317d perf(shader): flush f32 denormals in hardware when a startup probe matches the emulation
Devices with DenormFlushToZero for f32 run the mixed denormal-flush programs with and
without the hardware mode at startup; when every result matches, add, sub, mul, fma,
floor and ceil in the default rounding mode drop their software flush.
2026-10-19 07:00:13 +02: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
Adrià 3904ce6cf5 Merge pull request #6505 from keravyn-ops/fix/htile-pending-fill
perf(agc): take the HTILE words pending fills leave instead of reading them
2026-10-19 06:03:19 +02: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
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
Kovalev Vladislav 94bd3c3872 fix(agc): preserve indirect index tests alongside current main 2026-10-19 09:25:11 +06: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
keravyn-ops fac1979549 perf(agc): take the HTILE words pending fills leave instead of reading them
A depth target's bind (storeBackClearedHtile) reads its HTILE words to find a fast clear and
stores them back expanded. When a recorded fill over the HTILE was still pending, that read
made the flush hook submit the open batch and wait for the GPU, under the GPU mutex. A title
that clears its depth targets with buffer fill kernels pays that wait at every clear.

Uniform fills now note their 32-bit word with the pending write (NotePendingWordFill; the byte
value the DCC key paths use is unchanged). When every pending write over the HTILE is such a
fill and the rest of the range already holds the same word, the bind takes the landed word
from the notes, and stores the expanded words as a GPU fill recorded behind the pending ones.
Any other pending write keeps the read. APS5_NO_PENDING_HTILE_FILLS=1 always reads.

PPSA12544 on a Radeon 780M (Windows): 1271 pending-write syncs per 10 s waited 5.5 s at the
bind, about 4.3 ms each; with this change there are none, and the scene runs at 60-61 fps
instead of 44-46.
2026-10-19 05:16: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