Commit Graph
14017 Commits
Author SHA1 Message Date
Adrià 6b56175a42 Merge pull request #1691 from adriadam10/docs/architecture-shader-registration
docs(architecture): describe shader compilation at registration
2026-10-08 19:47:58 +02:00
Adrià FranchandClaude d3afdb02e2 docs(architecture): describe shader compilation at registration
Co-Authored-By: Claude <[email protected]>
2026-10-08 19:47:03 +02:00
boykopovar 239412351e Merge pull request #639 from boykopovar/feat/no-ingame-shaders-recomp
perf(agc): baseline shader recompilation on registration
In main, baseline recompilation depends on the resource configuration and runs on the first use of each corresponding variant.

This branch prepares IR, the static interface, baseline SPIR-V, and available ABI variants during shader registration. The compiled artifact is separate from per-draw and per-dispatch data.

Before the first execution with a new resource configuration, the runtime reads descriptors, validates compatibility, prepares the binding plan, specializes existing SPIR-V by substituting constants and removing unused branches and computations, materializes invocation data, and creates the Vulkan pipeline. These results are cached.

Variants that depend on linked graphics stages are prepared when the corresponding ABI is resolved. Unregistered compute shaders undergo baseline preparation on their first dispatch, emit an error log, and cache the result.

Subsequent executions reuse prepared artifacts, specializations, and pipelines while updating invocation data and resources as needed.
2026-10-08 20:45:54 +03:00
Adrià 2b297842e4 Merge pull request #1715 from adriadam10/ci/flat-store-serial
test(agc): run agc_driver_flat_store alone
2026-10-08 19:38:53 +02:00
JAB-dev 1986905adb Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into feat/ngs2-reverb-rack 2026-10-08 19:38:46 +02:00
JAB-devandClaude Opus 5.5 d6821edc67 fix(libSceNgs2.native): clamp matrix levels to -4..4 as the PS4 libSceNgs2 does
The PS4 firmware 11.00 libSceNgs2.sprx stores matrix levels clamped to
-4..4, keeps NaN, and rejects a level count of 0. Levels were stored
unclamped, so a level of 8 played twice as loud as on the console, and a
count of 0 cleared the matrix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 19:36:19 +02:00
Scott SchusterandClaude Opus 5.5 0b9b70fa36 feat(agc): accept 8_8_8_8 UINT color targets
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 12:30:34 -05:00
Adrià FranchandClaude beaaa4de18 test(agc): run agc_driver_flat_store alone
Co-Authored-By: Claude <[email protected]>
2026-10-08 19:28:29 +02:00
Adrià 17350cf5fd Merge pull request #895 from Kikoarl/feat/s-call-b64
feat(shader): implement S_CALL_B64
2026-10-08 19:24:59 +02:00
boykopovar 7ac08cbac4 fix(shader): declare required invocation inputs and correct derivative test dimensions 2026-10-08 20:24:58 +03:00
john.maiaandClaude Opus 5.5 16824f2678 feat(videoout): implement sceVideoOutGetResolutionStatus
Three homebrew titles from #1578 import it and stop at start-up without
it: ps5-opengl (PPSA99005), EVO-PLAYER-PS5 (PPSA99039) and
ProsperoRadio (PPSA99001).

It reports the port's resolution as the full and pane size and the
refresh rate ID as sceVideoOutGetOutputStatus does. The 48-byte layout
follows the declarations in ps5-opengl and EVO-PLAYER-PS5, which agree;
the screen size is 0 and the flags are 0. An invalid handle or a null
status throws, as in the other status getters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 18:24:46 +01:00
Adrià b83e849f84 Merge pull request #1710 from adriadam10/ci/relinker-job-name
ci: show a plain name for skipped relinker jobs
2026-10-08 19:23:22 +02:00
Adrià FranchandClaude f8402dcdff ci: drop the relinker job's custom name so a skipped job shows a plain name
Co-Authored-By: Claude <[email protected]>
2026-10-08 19:21:03 +02:00
LuisBiceps 9850628e1b test(libc): reset errno after the worker thread in guest_errors
guest_errors sets errno to 13 and checks at the end that the strerror_r
calls left it alone, but a std::thread is created and joined in between.
Guest errno is the host's errno. Since glibc 2.42, pthread_create first
tries madvise(MADV_GUARD_INSTALL) for the new thread's stack guard.
Kernels before 6.13, including WSL2's 6.6, reject it with EINVAL, and
glibc falls back to mprotect with errno left at EINVAL. POSIX leaves
errno unspecified after a successful call, so the test aborts on Ubuntu
26.04 (glibc 2.43) under WSL2 without anything being wrong.

Check errno right after the strerror calls, and set it to 13 again after
the join, so every errno check covers only strerror and strerror_r.
2026-10-09 01:21:00 +08:00
MathiasDevelopesandClaude Opus 5.5 2c7d9b9c82 feat(agc): DMA_DATA prefetches to DST_SEL nowhere
DMA_DATA with DST_SEL 2 (V_411_NOWHERE in Mesa's src/amd/common/sid.h)
reads its source into L2 and stores nothing; libSceAgc emits it as an
L2 prefetch with the source address repeated as the destination. It
threw as a register or prefetch destination. A prefetch of a memory
source is now accepted and writes nothing: ResolveStore returns it as an
empty store, so the packet stays ordered without a drain,
DecodeMemoryCopy keeps rejecting it and Execute skips it. A prefetch of
a register, GDS or immediate source and a register destination still
throw.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 19:12:54 +02:00
Adrià 7995d6578d Merge pull request #1704 from adriadam10/ci/path-filters
ci: skip jobs unrelated to the changed paths
2026-10-08 19:06:48 +02:00
Adrià 1b368ae7ea Merge pull request #1697 from adriadam10/ci/ctest-parallel
ci: run ctest in parallel
2026-10-08 19:05:27 +02:00
Adrià FranchandClaude 377535261d ci: skip jobs unrelated to the changed paths
Co-Authored-By: Claude <[email protected]>
2026-10-08 19:02:18 +02:00
Adrià FranchandClaude e197a5455e ci: run ctest in parallel
Co-Authored-By: Claude <[email protected]>
2026-10-08 18:57:28 +02:00
muhzain05 fd597084f9 fix(ult): reject finalize with outstanding ulthreads
sceUltFinalize cleared gUlthreads directly, dropping the last
shared_ptr to an UltUlthreadState while its worker thread still held
the raw pointer passed to scePthreadCreate. Finalize now returns
ULT_ERROR_BUSY when an ulthread is still registered, before any global
state is torn down, following the BUSY convention of the queue,
semaphore and queue data pool destroy paths. Joining the ulthread
remains the caller's responsibility, as sceUltUlthreadJoin already
keeps the state alive across scePthreadJoin and erases it afterwards.
2026-10-08 10:51:50 -06:00
boykopovar 8b15d88839 fix(shader): use guest wave lane for ADD_TID on narrow subgroups 2026-10-08 19:48:08 +03:00
alfalfa-starandClaude Opus 5.5 45541350bb feat(agc): accept UINT16_ABGR color exports into unsigned integer targets
SPI_SHADER_COL_FORMAT 7 (UINT16_ABGR) was rejected by DecodeState,
though the recompiler already handles it: a pixel shader's MRT output
under mode 7 is a uvec4, and a compressed export's 16-bit halves are
taken with OpBitFieldUExtract. The format is now accepted when the
target's CB_COLOR_INFO number type is UINT; into any other target it
still throws, as does SINT16_ABGR (8), whose halves would need sign
extension.

The target records the export (ColorTarget::uintExport). Shader
validation then requires a uint4 output at its location instead of a
float4 one, and blending into it is refused (Vulkan has no blending of
integer attachments).

PPSA14632 (LEGO Horizon Adventures) writes a 2848x1600 R8_UINT target
this way; those draws were dropped.

agc_driver_pixel_uint16_export draws compressed MRT0 exports under mode
7 into a linear 16_16_16_16 UINT target, one row per pair of packed
words (0x0000ffff/0xffff0000, 0x00010002/0xffffffff and four distinct
halves), and reads every 16-bit component back under the identity,
STD_REV and ALT_REV export mappings. agc_driver_graphics covers the
decode and the blend refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 18:46:09 +02:00
overlordxrz-source 18798620e8 feat(libkernel): implement sysctl and sysctlbyname for hw.ncpu
ScreenTester5 (PPSA69420) stops at start-up on the unresolved sysctlbyname
import and also imports sysctl. hw.ncpu (CTL_HW.HW_NCPU) reports the same
processor count as sysconf(_SC_NPROCESSORS_ONLN). Other names and MIBs throw.
2026-10-08 12:23:05 -04:00
boykopovar 199eeb1805 fix(shader): preserve structured exits during SPIR-V specialization 2026-10-08 19:19:50 +03:00
emirplus c4c3ed7711 fix(savedata): recover from metadata setup failure
Report SAVE_DATA_ERROR_INTERNAL when setupSaveDataMemory2 fails to persist initial SaveDataParam metadata, and restore previous state so retrying setup can initialize cleanly. Closes #1667.
2026-10-08 19:18:36 +03:00
boykopovar 2767da6a8a fix(tests): check Vulkan availability before shader registration 2026-10-08 19:09:13 +03:00
MichonandClaude Opus 5.5 7208d7d314 fix(agc): a key fill over other images stays inside the image's DCC key extent; test the fill cover
When another live image overlaps the fill, a fill at a live image's dccAddress is a key fill
only while it stays within DccKeyCount (the pipe-aligned key count); with nothing overlapping
the length rule is unchanged. ClassifyFill, NoteKeysFill and ClearByKeysFill share the match.
agc_driver_fill_cover_keys pins Keys, Inside and Several for fills at and beside the keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 18:06:37 +02:00
boykopovar 2da24e8a62 fix(tests): keep bindless image selection within one host subgroup 2026-10-08 19:04:45 +03:00
klosixgaming-arch 5d3029b45a fix(shader): work around Intel iGPU OpSMulExtended bug
Use Hacker's Delight 8-3 formula for signed multiplication high words:
hi = umulhi(a,b) - (a<0 ? b : 0) - (b<0 ? a : 0)

This avoids using OpSMulExtended entirely, which returns wrong high words
for constants -1, -2, and -32768 on Intel iGPUs. The workaround is exact
for all inputs and has no performance impact on other platforms.

Fixes #1246
2026-10-08 11:02:58 -05:00
Morten HolmandClaude Sonnet 5.5 20e8bb09ba fix(libc): run guest exit handlers before the host exit handlers
LibcExit called std::exit, which ran the static destructors of the libraries
before the guest exit handlers. A guest handler that freed memory then locked
a destroyed std::mutex, which throws, and a noexcept guest destructor ended in
std::terminate. The guest handlers now run first, while the library objects
are alive.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-08 17:53:56 +02:00
Jan ŠléglandClaude Fable 5.1 e6a9b50512 feat(libkernel): implement the sigset functions
Add sigemptyset, sigfillset, sigaddset, sigdelset and sigismember with
FreeBSD 11 semantics (lib/libc/gen/sigsetops.c): a 128-bit set of four
32-bit words, signal n at bit n - 1, signals 1 to 128 valid. sigfillset
sets every bit. An invalid signal returns -1 with errno EINVAL and leaves
the set untouched; sigismember returns 1 or 0. A null set throws.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-08 17:45:57 +02:00
boykopovar e4c604d64e fix(shader): update linux shader cache structure size assertions 2026-10-08 18:43:06 +03:00
emirplusandClaude Opus 5.5 b4cc6d26b9 feat(relinker): support Windows guest TLS reads by ALU register-address instructions
Recognize read-direction ALU forms (add, or, adc, sbb, and, sub, xor, cmp) that read from fs:[mem] where mem has a base or index register (such as 64 48 33 03, xor rax, fs:[rbx], in #217). The stub loads the TLS value through the computed address, performs the ALU operation, and preserves scratch registers and flags.

Extend test_tls_function_coverage with execution and stub coverage cases for register-addressed ALU operations, including rax, rcx, rbx and r13 destinations, wide and 32-bit forms, and verification of register and flag preservation.

Refs #217

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 18:39:24 +03:00
Pedro a294b80d29 feat(libkernel): implement getuid, geteuid, getgid, getegid and issetugid
Part of #1578.
2026-10-08 10:39:06 -05:00
XairRrR df3aa1a9db fix(libkernel): raise the open file soft limit on Linux
Each direct memory backing keeps a memfd open, so a title such as
Dreaming Sarah (PPSA02929) holds about 1100 descriptors at startup.
With the systemd default soft limit of 1024, later opens fail with
EMFILE: memfd_create throws "create direct memory backing: Too many
open files", or the title's fopen returns NULL and it faults in fread.

libkernel now raises the RLIMIT_NOFILE soft limit to the hard limit
when it is loaded, before the title creates any descriptor, and throws
if the limit cannot be read or raised.
2026-10-08 17:38:48 +02:00
Nahuel Genchi 5115c24fc7 Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into fix-flip-compute
# Conflicts:
#	core/libs/prx/libSceAgcDriver/CMakeLists.txt
2026-10-08 12:36:13 -03:00
st44rplatinum 7894cda94d feat(libSceSystemService): implement Disable/ReenableMediaPlay 2026-10-08 18:35:19 +03:00
boykopovar 6741e90a1c fix(shader): restore prepared image compatibility and update regression fixtures 2026-10-08 18:32:12 +03:00
Morten HolmandClaude Sonnet 5.5 5333a20537 fix(agc): do not use fragment barycentric on MoltenVK
MoltenVK reports VK_KHR_fragment_shader_barycentric, but its SPIR-V to MSL step
rejects the PerVertexKHR decoration that the barycentric path uses, so every
pixel shader on that path fails to compile into a pipeline. Treat the feature
as unavailable when the driver is MoltenVK, so the no-barycentric path is used.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-08 17:31:20 +02:00
7647710248 test(audiodec): cover the raw M4AAC configuration search with a 5.1 stream
A raw 5.1 LC frame decodes as 6 channels with a maximum of 6 and of 8,
which is only reached by moving past the mono/stereo configuration. The
configuration search is listed under unknown function info, together with
a mono raw stream being reported as 2 channels.

Co-authored-by: Dextroid17 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 17:29:50 +02:00
PacukaandClaude Opus 5.5 7b722253a4 fix(audiodec): take the M4AAC raw channel layout from the stream
For a raw M4AAC stream the maximum channel count was written into the
AudioSpecificConfig as the channel configuration. The maximum only bounds
the stream: The Smurfs Dreams creates its decoder with 8 channels at most
and sends stereo, so FFmpeg refused configuration 8 (reserved) and a
stereo stream under configuration 6 or 7 decodes no frame. The decoder
now starts from the mono/stereo configuration and on the first access
unit that it cannot decode moves on to the configurations with more
channels, up to the maximum, keeping the first one that decodes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 17:29:46 +02:00
MichonandClaude Opus 5.5 fc05d1e3e3 fix(agc): a fill of a surface's DCC keys is a key fill over other images' memory
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 17:27:13 +02:00
boykopovar 0fa7114e93 fix(tests): correct raw buffer bounds in DCC many-buffer and interlock tests 2026-10-08 18:24:15 +03:00
boykopovar d0a62b7ba0 fix(tests): correct raw buffer bounds modes in image tests 2026-10-08 18:21:50 +03:00
boykopovar 381d12b3b4 fix(tests): correct buffer bounds modes in GDS LDS and scalar tests 2026-10-08 18:20:08 +03:00
Mohd FaourandClaude Fable 5.1 ce5a2136a8 fix(sysmodule): report a module that is not loaded as SCE_SYSMODULE_ERROR_UNLOADED
sceSysmoduleIsLoaded returned 0x80A90002 and the unload calls 0x80A90003
for a module that is not loaded. Neither value exists in the SDK: the
sysmodule facility is 0x5A and the error is 0x805A1001, which titles
compare against (GTA V PPSA04263: cmp eax,0x805a1001 after IsLoaded) to
decide whether to load and initialise the module themselves. Return that
value from all three places and cover it in guest_sysmodule.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-08 17:13:02 +02:00
boykopovar bae0aed3bf fix(driver): adapt shader preparation to updated main apis 2026-10-08 18:12:47 +03:00
ahmedhamouda78 73eb8465d6 feat(agc): write the measured sceAgcDcbResetQueue packet sequence
Replace the CLEAR_STATE approximation with the envelope and per-op-bit packet groups measured on PS5 firmware 13.60. Emit groups for op bits 0x001, 0x002, 0x004, 0x008, 0x010, 0x020, 0x080, 0x100 and 0x800 in ascending order; throw for 0x040, 0x200 and 0x400 whose packets the driver rejects. state 2 sets the envelope flag and state 3 sets the 0x004 and 0x800 group payload dword.
2026-10-08 15:10:08 +00:00
Leandro 9bae5b0879 Merge branch 'main' into fix/kernel-download0-at-start 2026-10-08 17:09:06 +02:00
boykopovar eb68ad3b02 fix(shader): preserve main buffer alignment and image formats in prepared shaders 2026-10-08 17:51:05 +03:00