Commit Graph
14017 Commits
Author SHA1 Message Date
Dean Galvin 2596f8c0ad perf(agc): record occlusion counter dumps on the GPU
Every ZPASS_DONE counter dump drained the device so the CPU could add up
the occlusion queries of the finished batches and store the running total.
PPSA21564 dumps around each occlusion-tested pass: about 1.5k drains per
10 s at its title screen, and in a level's early passes four drains a frame
that took 5.6 s of every 10 s of the graphics worker.

The running total now lives in a small buffer the GPU updates in batch
order. A batch still ends its occlusion query at submit; a query that saw
draws is remembered, and its pool is kept alive until it is folded. A dump
ends the open batch's query, copies the remembered results next to the
total, adds them with a one-thread compute shader that also stores the 16
DB counters into the dump's host import, and begins a fresh query for the
rest of the batch. The dump is ordered with the work around it like any
other GPU store, noted as a pending write and stamped. More than 64
remembered results are folded at a submit. Query pools are recycled.

A dump into memory the GPU cannot see, under a pending copied write-back
or over a label the CPU stores at a completion falls back to the drain,
which settles the remembered results on the CPU. Without buffer device
addresses the counting stays on the CPU.
2026-10-04 16:17:09 +13:00
Dean 33a2f907f4 Merge pull request #460 from oneandonlydean/perf/agc-gpu-mesh-indirect
perf(agc): draw mesh-stage indirect draws on the GPU
2026-10-04 16:15:58 +13:00
Dean 2cb95dab12 Merge pull request #452 from SP4C3B4R-8/fix/scissor-window-offset
fix(libSceAgcDriver): accept scissors that apply the zero window offset
2026-10-04 15:48:01 +13:00
Dean Galvin fb55cb2c0e perf(agc): draw mesh-stage indirect draws on the GPU
A mesh program took its draw's index count from push constants, so an
indirect mesh-path (NGG) draw needed the CPU to read its record first,
waiting for the GPU to finish everything recorded before. In PPSA21564
that was about 170 waits per 10 s at the title, menu and level (about
1 s), and one per frame in the intro (2.2 s per 10 s).

The two free mesh push dwords now carry the device address of an argument
record (a VkDrawMeshTasksIndirectCommandEXT followed by the index count
and first index). When the address is set, the prologue takes the index
count and the first index from the record (the new MeshArgument IR value,
a load through a physical storage buffer pointer) and offsets its index
reads by the first index; a direct draw leaves the address 0 and draws as
before. Mesh modules declare the physical storage buffer capability for
it, and the driver's SPIR-V validation accepts the extension in mesh
modules.

An indexed mesh draw with one record that patches no user SGPR now stays
on the GPU. A one-thread compute pass (Graphics/shaders/MeshArguments.comp)
turns the record, read in place from its host import, into the draw's
argument record: the groups and instances of vkCmdDrawMeshTasksIndirectEXT
and the index count and first index the mesh program reads, with the CPU
path's rules (count clamped to the index buffer, nothing for an empty
record or past the device's group limits). The index buffer descriptor
covers the whole buffer and the program offsets by the first index. When
the records cannot be read in place, the CPU reads them and fills the
same argument record (ResolveMeshArguments).
2026-10-04 15:45:56 +13:00
Dean dca710d602 Merge pull request #465 from oneandonlydean/fix/agc-cross-queue-submission-order
fix(agc): run a wait-free submission of another queue after queue 0's earlier submissions
2026-10-04 15:45:30 +13:00
Dean 26e7783483 Merge pull request #457 from oneandonlydean/perf/shader-cache-version-inputs
perf(shader): hash only the recompiler's inputs into the shader cache version
2026-10-04 15:45:12 +13:00
Dean 2ccd3d7b56 Merge pull request #440 from oneandonlydean/feat/agc-fan-gs-input
feat(agc): take triangle fans as NGG geometry shader input
2026-10-04 15:44:54 +13:00
Dean 3e23099fbb Merge pull request #472 from adriadam10/fix/shader-memory-test-page-read
test(agc): keep shader memory test tables inside one guest page
2026-10-04 15:41:47 +13:00
Dean 0bd34077b4 Merge pull request #455 from arreina/pr/libatrac9-bounds
fix(audio): bound ATRAC9 decoding to the superframe
2026-10-04 15:41:29 +13:00
Dean 837bb8fe96 Merge pull request #438 from adriadam10/feat/vop3-div-fixup-f16
feat(shader): implement v_div_fixup_f16
2026-10-04 15:41:11 +13:00
Dean bbfb3c2b5c Merge pull request #242 from adriadam10/fix/nid-dynstr-suffix-sharing
fix(nid): share string suffixes when rebuilding .dynstr
2026-10-04 15:40:53 +13:00
RomainROCH 5211ba115b fix(libc): count wide string precision in output characters 2026-10-04 04:31:26 +02:00
Dean e006f64237 Merge pull request #284 from SP4C3B4R-8/fix/replaced-device-host-imports
fix(libSceAgcDriver): destroy host imports of a replaced Vulkan device
2026-10-04 15:13:54 +13:00
Dean e7eabe5048 Merge pull request #282 from SP4C3B4R-8/fix/vulkan-prefer-discrete-gpu
fix(libSceAgcDriver): prefer a discrete GPU over the first suitable device
2026-10-04 15:08:45 +13:00
Dean e84b558bf1 Merge pull request #462 from oneandonlydean/fix/agc-own-store-write-watch
fix(agc): consume the write-watch faults of the driver's own CPU stores
2026-10-04 15:01:48 +13:00
Dean 7c4ff2df70 Merge pull request #464 from oneandonlydean/fix/relinker-exact-reciprocals
fix(relinker): lower VRSQRTPS and VRCPPS to correctly rounded results for --to-intel
2026-10-04 14:45:23 +13:00
Dean Galvin 097566d547 fix(relinker): lower VRSQRTPS and VRCPPS to correctly rounded results for --to-intel
RSQRTPS and RCPPS are approximations whose low bits differ between Intel
and AMD. Intel returns 0x3F7FF000 for 1/sqrt(1.0), and two Newton-Raphson
steps on it settle on 0.99999994 instead of 1.0. PPSA21564 renormalises
its spring quaternions that way: an identity quaternion keeps w at
0.99999994 with a zero axis, its axis-angle conversion then normalises the
zero axis into NaNs, and the NaN bone poses reach keyframed physics bodies.
A NaN body later moves to an invalid broadphase cell and the game crashes
a few seconds into its hub level.

--to-intel now replaces the VEX.128 register forms with an out-of-line stub
that computes 1/sqrt(x) with SQRTPS and DIVPS (1/x with DIVPS), keeping
the upper half of the destination cleared and the scratch register intact.
A site with no room for the jump, including one followed by a branch
target or a RIP-relative instruction, keeps the native instruction and is
reported as kept instead of failing the relink.
2026-10-04 14:40:16 +13:00
Dean 396b282315 Merge pull request #339 from DotDebian/feat/cpu-time-clocks
feat(libkernel): support the CPU-time clocks in clock_gettime and clock_getres on Windows
2026-10-04 14:21:40 +13:00
Dean 40a9e455ea Merge pull request #430 from adriadam10/feat/relinker-sha1-lowering
feat(relinker): lower SHA-1 instructions for --to-intel
2026-10-04 14:14:08 +13:00
Dean fafec33471 Merge pull request #380 from DotDebian/fix/progress-count-sopp-shared-opcodes
fix(tools): count the debug branches and s_ttracedata_imm as decoded shader instructions
2026-10-04 14:13:51 +13:00
Dean e6505d8a93 Merge pull request #312 from RomainROCH/codex/fix-save-memory-metadata
fix(savedata): report memory metadata write failures
2026-10-04 14:13:01 +13:00
Dean 7384588c35 Merge pull request #411 from MichonGoddijn231849/fix/writelane-ignores-exec
fix(shader): v_writelane_b32 ignores EXEC
2026-10-04 14:06:16 +13:00
Dean d77b96fd44 Merge pull request #403 from MichonGoddijn231849/perf/pending-image-index
perf(agc): index the pending storage images by guest range
2026-10-04 14:06:00 +13:00
Dean d43b12c34e Merge pull request #433 from adriadam10/fix/relinker-sse4a-upper-qword
fix(relinker): zero dst[127:64] in EXTRQ and INSERTQ lowerings
2026-10-04 14:05:41 +13:00
Dean 40b1c7a6f9 Merge pull request #432 from adriadam10/fix/relinker-vex-rip-relative
fix(relinker): report RIP-relative operands of VEX, EVEX and 0F38/0F3A instructions
2026-10-04 14:05:25 +13:00
Dean deb7e0dfff Merge pull request #363 from DotDebian/test/sopk-cmpk-compares
test(shader): cover the s_cmpk compares and count them as tested variants
2026-10-04 14:05:04 +13:00
Dean ad473fa569 Merge pull request #389 from DotDebian/feat/mimg-sample-d-cl-o
feat(shader): decode image_sample_d_cl_o
2026-10-04 14:04:47 +13:00
Dean 0207f9ca9a Merge pull request #388 from DotDebian/fix/mimg-sample-lod-clamp
fix(shader): let image samples clamp their LOD on devices with shaderResourceMinLod
2026-10-04 14:04:31 +13:00
Dean 0df090c30b Merge pull request #386 from DotDebian/feat/vop3p-integer-dot
feat(shader): implement the integer dot products
2026-10-04 14:04:14 +13:00
Dean ea07493147 Merge pull request #372 from DotDebian/feat/shader-s-wakeup
feat(shader): decode s_wakeup as a no-op
2026-10-04 14:03:57 +13:00
Dean b19e9761fa Merge pull request #348 from julienlgy/feat/lib-sce-audio3d-port-close
feat(libSceAudio3d): add missing sceAudio3dPortClose stub
2026-10-04 14:03:40 +13:00
Dean 1137cffb72 Merge pull request #429 from RomainROCH/codex/fix-rfc3339-offsets
fix(rtc): reject invalid RFC 3339 timezone offsets
2026-10-04 14:03:23 +13:00
Dean 1964aad443 Merge pull request #428 from RomainROCH/codex/fix-posix-semaphore-limits
fix(libkernel): enforce POSIX semaphore count limits
2026-10-04 14:03:06 +13:00
Dean 12db9a8fcf Merge pull request #420 from MichonGoddijn231849/fix/ajm-batch-job-size
fix(ajm): a decode job fits the 64-byte batch titles allocate
2026-10-04 14:02:48 +13:00
Dean dfac4ab1ec Merge pull request #412 from arreina/pr/pixel-position-export
fix(shader): reject position exports without vertex input info
2026-10-04 14:02:31 +13:00
Dean e656baf20b Merge pull request #398 from Pouare514/fix/libc-fopen-enoent
fix(libc): return NULL with ENOENT for missing files in fopen
2026-10-04 14:02:14 +13:00
Dean d0bec2e448 Merge pull request #378 from DotDebian/fix/posix-file-errno
fix(libkernel): return -1 and set errno from the POSIX open, stat, unlink and rmdir
2026-10-04 14:01:57 +13:00
Dean a6cdfa1c7f Merge pull request #352 from arreina/pr/savedata-delete-dir-name
fix(savedata): reject invalid directory names in sceSaveDataDelete
2026-10-04 14:01:40 +13:00
Dean e5676b3f0e Merge pull request #315 from RomainROCH/codex/fix-semaphore-overflow
fix(libkernel): avoid semaphore count overflow
2026-10-04 14:01:19 +13:00
Dean e50c18a42d Merge pull request #314 from RomainROCH/codex/fix-fgetpos-error
fix(libc): propagate file position errors
2026-10-04 14:01:01 +13:00
Dean 1dd1be67e3 Merge pull request #262 from RomainROCH/codex/fix-aligned-delete
fix(libc): release aligned allocations through the application heap
2026-10-04 14:00:42 +13:00
Dean Galvin bb1531fc34 fix(agc): consume the write-watch faults of the driver's own CPU stores
A store the driver makes with the CPU into watched guest memory (a
GuestMemory::Write, a changed-bytes write-back, a completion action's label
store, the copy HLE's CPU path) faults its pages dirty in the write watch and
stamps the range with MarkWritten. The faults stayed behind: collects are
memoized per packet, so the next walk over those pages came later and stamped
them again, as a CPU write made after every check in between.

PPSA21564 fast-clears its normal G-buffer every frame with a register DCC key
fill on the GPU. While that fill is still pending, the first draw into the
target materializes the clear with a CPU store of the clear texels and a
refresh of the resident image. A dozen draws later a walk found the store's
faults, the target read as changed, and the image was uploaded again from
guest memory, dropping the draws recorded in between. Lighting then sampled
cleared normals and the level's moon and rocks went unlit in about half the
frames.

The driver's stores now consume those faults themselves: a walk before the
store stamps earlier CPU writes as such, a walk after it takes the store's
own faults as a driver store, and the range is stamped as before.

On Windows the arena's range also holds host regions that were already in
use when it was reserved (heaps, thread stacks). They are not write-watched,
so a store into one is stamped as before, without a walk.
2026-10-04 11:36:05 +13:00
Dean 85959469a4 Merge pull request #478 from oneandonlydean/fix/libc-unwind-c-personality
fix(libc): run the cleanups of frames that use the C personality
2026-10-04 11:34:58 +13:00
Dean 1e54dae613 Merge pull request #466 from oneandonlydean/perf/agc-shared-dcc-keys
perf(agc): keep a surface's storage image when another descriptor names uncompressed DCC keys
2026-10-04 11:34:41 +13:00
Dean 53d1ebc10f Merge pull request #459 from oneandonlydean/perf/agc-own-stack-verify
perf(agc): answer verifications of the caller's own live stack without a page query
2026-10-04 11:34:24 +13:00
Dean c416d9e221 Merge pull request #458 from oneandonlydean/perf/agc-dcc-keys-without-wait
perf(agc): read DCC keys behind the driver's own pending key store without a wait
2026-10-04 11:34:07 +13:00
Dean 0990e9a695 Merge pull request #456 from oneandonlydean/feat/shader-replay-code-words
feat(agc): let agc_shader_replay write a request's code words for other disassemblers
2026-10-04 11:33:49 +13:00
Dean 7fc6f0e10c Merge pull request #445 from oneandonlydean/fix/recompiler-readfirstlane-empty-exec
fix(recompiler): v_readfirstlane_b32 of an empty EXEC reads lane 0
2026-10-04 11:33:32 +13:00
Dean b6673c793c Merge pull request #444 from oneandonlydean/perf/agc-lazy-check-messages
perf(agc): build check failure messages only when a check fails
2026-10-04 11:33:15 +13:00
Dean 98004c632d Merge pull request #443 from oneandonlydean/fix/agc-write-data-pfp
fix(agc): accept WRITE_DATA with ENGINE_SEL = PFP
2026-10-04 11:32:58 +13:00