Commit Graph

6138 Commits

Author SHA1 Message Date
Adrià Franch e2ac1a6690 feat(shader): implement image_load_pck and image_load_mip_pck with signed variants
Return the raw texel bits: dmask bit i selects texel dword i, dwords past the
texel read 0 and the _sgn forms sign-extend texels narrower than 32 bits
(measured on RDNA2 hardware). Only formats whose bits are exactly recoverable
from the sampled view are accepted (unsigned/signed integer, unorm up to 16
bits, 32-bit float components), on a direct sampled image with identity
swizzle; anything else throws.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 22:32:13 +02:00
Phi1ow be59a9e7e9 feat(http): implement sceHttpCreateRequest2, sceHttpsEnableOption, sceHttpsLoadCert and sceHttpGetLastErrno
Four more libSceHttp exports, following the library's existing "no network emulated" model:

- sceHttpCreateRequest2 -> a new handle, like sceHttpCreateRequestWithURL2
- sceHttpsEnableOption -> 0, the counterpart of the existing sceHttpsDisableOption
- sceHttpsLoadCert -> 0 (certificates are accepted and ignored; no TLS is performed)
- sceHttpGetLastErrno -> 0 (no request reaches the network, so no errno is recorded); a
  null output pointer returns ERROR_INVALID_VALUE, like the other getters in this file

Signatures follow the public OpenOrbis SDK headers. GuestHttp is extended to cover the four
functions; the new assertions fail without the change (the symbols are undefined).
2026-10-04 22:04:13 +02:00
Phi1ow 75c2ea8548 feat(sysmodule): implement sceSysmoduleLoadModuleInternal and sceSysmoduleUnloadModuleInternal
Two exports were missing. System modules are linked statically, so load and unload are
reference counts over the known module table, exactly like the existing
sceSysmoduleLoadModuleInternalWithArg and sceSysmoduleUnloadModule:

- sceSysmoduleLoadModuleInternal(uint32_t) -> increments the module's load count, returns 0
- sceSysmoduleUnloadModuleInternal(uint32_t) -> decrements it, or 0x80A90003 when the module
  was not loaded

Unknown or zero ids throw, like the sibling internal loader. Adds a CMakeLists.txt so the
library can carry its guest test. Signatures follow the public OpenOrbis SDK headers.

New test core/libs/tests/GuestSysmodule.cpp loads a module twice, unloads it twice and checks
the not-loaded error on a third unload; it fails without the change (the symbols are
undefined) and passes with it.
2026-10-04 21:56:29 +02:00
Pouare514 89cd75e15f fix(libkernel): idempotent fixed virtual reservation over registered range 2026-10-04 21:02:15 +02:00
Pacuka a48a9eabf7 fix(agc): keep the pixel register fallbacks to the null program and refuse its color writes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 20:57:01 +02:00
Pacuka b90a913715 fix(agc): draw without a pixel program when SPI_SHADER_PGM_PS is unset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 20:54:11 +02:00
Dean d7f0c49fdc
Merge pull request #532 from adriadam10/fix/audio-in-pacing
fix(audioin): never return a no-device block before its deadline
2026-10-05 07:37:03 +13:00
Adrià Franch d4d045f73e test(shader): execute flat and global loads against hardware results
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 19:09:54 +02:00
Adrià Franch bc12722698 fix(shader): convert unorm and snorm buffer format loads with correct rounding
Format loads divided by 2^b-1 with OpFDiv, which Vulkan only bounds to 2.5 ULP; RADV returns a
different f32 than the hardware for many 8- and 16-bit values. The quotient is now built on the
bits: v/(2^b-1) is v's b bits repeated, so the mantissa is the rotated value replicated and rounded
on the next bit (no ties). Adds an execution test of buffer_load_format_x..xyzw,
tbuffer_load_format_x/xy/xyz and buffer_store_format_x..xyzw against values measured on RDNA.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 18:49:49 +02:00
Adrià Franch e1a99077d1 test(shader): execute the untested buffer byte/short/dwordx2/x3 loads and stores and the 32-bit integer buffer atomics against values measured on RDNA
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 18:37:45 +02:00
Pouare514 88320f1297 feat(tools): suggest real names for Unknown NID stubs from hash-verified DB 2026-10-04 18:23:08 +02:00
DotDebian d98bbcd5bb fix(libkernel): report invalid nanosleep requests through errno and the sce error codes
nanosleep and _nanosleep forwarded the result of sceKernelNanosleep, which
returned -1 for a rejected request: errno was never set, and the sce call
returned a value that is not an sce error. A request with negative seconds
was rejected as well, where FreeBSD's kern_nanosleep returns 0 without
sleeping.

nanosleep and _nanosleep now return -1 with errno set to EINVAL when tv_nsec
is outside [0, 1000000000) and to EFAULT for a null request;
sceKernelNanosleep returns the matching SCE_KERNEL_ERROR code. A request
with valid nanoseconds and negative seconds returns 0 at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:19:53 +02:00
DotDebian 12d77169ab feat(agc): implement sceAgcAcbDmaDataGetSize
sceAgcAcbDmaData emits the 7-dword DMA_DATA packet through
Agc::Command::WriteDma, the writer sceAgcDcbDmaData shares, so its size
query returns the same 28 bytes instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:12:38 +02:00
Adrià Franch dc878c9c5c test(shader): execute every non-f64 VOPC compare against values measured on RDNA
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 18:12:35 +02:00
DotDebian 638d3802ad feat(ampr): implement the command buffer markers
sceAmprCommandBufferPushMarker, PushMarkerWithColor, PopMarker, SetMarker
and SetMarkerWithColor record a marker command, and the matching
sceAmprMeasureCommandSize functions return its size. The APR executor
skips markers, as it does a nop.

Signatures follow the ampr_emu reimplementation of libSceAmpr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:10:16 +02:00
DotDebian cd6c20f783 feat(font): implement sceFontGetResolutionDpi
Report the horizontal and vertical resolution kept in the font handle's
style block, as set when the font is opened (72 dpi) or by
sceFontSetResolutionDpi. Error handling follows the other handle getters:
an invalid handle or two null outputs fail and clear the outputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:59:31 +02:00
DotDebian 2452ffcb3f feat(libSceAudioOut): implement sceAudioOutSetMixLevelPadSpk
The mix level is a linear gain on the pad speaker port, 32768 being 0 dB.
A pad speaker port opens at 11626 (-9 dB). An unknown handle, a port of
another type and a level above 0 dB return the AudioOut error codes; a
negative level throws, as its effect is unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:51:25 +02:00
DotDebian 46b5d5d8b0 feat(agc): implement the sceAgcBranchPatch setters
sceAgcBranchPatchSetCompareAddress, sceAgcBranchPatchSetThenTarget and
sceAgcBranchPatchSetElseTarget rewrite the compare address and the two
buffer targets of the packet sceAgcCbBranch emits. The then target is
the first buffer and the else target the second, as in AMD's
COND_INDIRECT_BUFFER packet. The cache policy bits are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:48:12 +02:00
Adrià Franch a32a593762 fix(audioin): never return a no-device block before its deadline
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 17:27:50 +02:00
DotDebian f9625f2581 feat(libkernel): implement the pthread_rwlock try and timed lock functions
The POSIX layer only exported init, destroy, rdlock, wrlock and unlock.
pthread_rwlock_tryrdlock, pthread_rwlock_trywrlock,
pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock now wrap the
existing scePthreadRwlock functions and accept the static initializer.

The timed variants take an absolute CLOCK_REALTIME deadline. Like
FreeBSD libthr they try the lock first and only validate abstime when
the lock is not free. A null abstime throws, as pthread_mutex_timedlock
does.

scePthreadRwlockTryrdlock and scePthreadRwlockTrywrlock return EBUSY
when the caller already holds the write lock instead of calling into
std::shared_timed_mutex, where that is undefined behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:13:36 +02:00
DotDebian e2dd34f360 test(shader): cover the SOPK s_waitcnt counters and count them as decoded
The decoder maps SOPK opcodes 0x17 to 0x1a to SWaitcnt, but no test encoded them and tools/progress.py only counted S_WAITCNT_VSCNT. The test runs the four waits with a null and a live register field and checks that SCC and the register are left unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:13:18 +02:00
Adrià Franch f08e691b22 fix(shader): saturate v_cvt_pk_u16_u32/i16_i32; test VOP3 integer ops
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 17:09:47 +02:00
DotDebian a701cfb08d feat(shader): implement global_load_dword_addtid
Decode FLAT opcode 0x16 in the global segment and load one dword per
active lane from the SGPR pair base plus the signed offset plus four
times the lane id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:09:25 +02:00
DotDebian 9754103cc4 fix(shader): keep decoding past an s_endpgm while a branch targets later code
The decoder stopped at an s_endpgm unless the next word was a known branch
target. When an earlier branch jumps further than that word, the block right
after the s_endpgm is entered only from later code, so the program was cut
short and the graph builder rejected the branch as targeting an invalid
program counter. Stop only when no decoded branch targets a word at or past
the one after the s_endpgm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:03:31 +02:00
DotDebian a590841f19 test(shader): cover the VOP3 carry-out add and subtracts and count v_sub_co_u32 as decoded
v_add_co_u32, v_sub_co_u32 and v_subrev_co_u32 (VOP3 0x30f, 0x310, 0x319)
decode to VAddI32, VSubI32 and VSubrevI32 and had no execution test.
tools/progress.py listed the first and the last as variants of those
opcodes but not v_sub_co_u32, which it reported as missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:01:01 +02:00
Adrià Franch f64a683bdf fix(shader): s_wqm SCC and s_andn{1,2}_wrexec destination
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 16:56:48 +02:00
Pouare514 497a772c5d fix(libkernel): hand arena reservations to NoOverwrite mappings 2026-10-04 16:46:39 +02:00
DotDebian cb1f456ce4 fix(shader): address ds_append and ds_consume on LDS by the instruction offset alone
On LDS the counter is at the instruction offset. The emitter added
M0[31:16] to it and required the offset to be below M0[15:0], which is
the GDS base and a size no other LDS access reads. The GDS path is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 16:43:54 +02:00
Pouare514 5babbe5016 fix(libkernel): support NoOverwrite mappings on Windows 2026-10-04 16:39:24 +02:00
DotDebian 624eeac4c5 test(shader): cover v_fmac_f32, v_fmamk_f32 and v_fmaak_f32 and count them as decoded
VOP2 0x2b, 0x2c and 0x2d decode to the opcodes of v_mac_f32, v_madmk_f32
and v_madak_f32 and differ only by the encoding, which keeps them fused.
The progress map derives names from the opcode enum, so it listed the three
fused forms as missing.

The new test decodes the six encodings and checks that the translation
rounds the product separately for 0x1f-0x21, keeps 0x2b-0x2d fused, and
reads the accumulator and the literal from the right operand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 16:36:17 +02:00
Pouare514 f4301a1347 feat(crashreport): dump all threads on fatal crash plus hang watchdog 2026-10-04 16:36:16 +02:00
Pouare514 fb9e0fff5b fix(libs): TLOU runtime funcs for Net (getpeername, htonll/ntohll) 2026-10-04 16:33:18 +02:00
Pouare514 9be52e47be fix(libs): TLOU runtime throwing stubs for Ssl LoadCert and GetMemoryPoolStats 2026-10-04 16:30:21 +02:00
Pouare514 af20824af4 fix(libs): TLOU sceRtcParseDateTime ISO 8601 subset parser 2026-10-04 16:30:14 +02:00
Pouare514 22dd013049 fix(libs): TLOU runtime funcs for SessionSignaling (activate user, peer address 2) 2026-10-04 16:29:47 +02:00
Pouare514 49feb79476 fix(relinker): scan overlapping span from address and cover FS-prefixed previous instruction 2026-10-04 15:41:17 +02:00
Pouare514 52587f8cf1 fix(relinker): tolerate trailing data in TLS scan 2026-10-04 15:27:57 +02:00
Pouare514 2be3860983 fix(tests): flush stdout in QuickFirst so ctest pipe captures handler output 2026-10-04 15:24:44 +02:00
Pouare514 1cbf3fa8e4 feat(libc): implement at_quick_exit and quick_exit 2026-10-04 15:20:51 +02:00
Slick Daddy e31f3edf4a test(shader): register agc_spirv_module_tests with ctest 2026-10-04 15:59:04 +03:00
Slick Daddy 753e1b9347 fix(shader): declare the word-size constraint before the overloads that use it 2026-10-04 15:58:31 +03:00
Slick Daddy 4dd9d45be8 fix(shader): cache operand-free constants and cover interning with a test
OpConstantTrue and OpConstantFalse carry no operand word, so they reached the
declaration cache through the variadic Constant template, which builds the key
vector, and paid an allocation on every call. ConstantBool emits both, so a
shader paid it twice per boolean constant. Add the two-word overload; the
compile-shaped benchmark drops from 10413 allocations to 415.

Add agc_spirv_module_tests covering the interning contract: a repeated
declaration returns one id and is emitted once, operand shapes that share a
leading key word stay distinct, integral and enum operands agree, decorated
types stay separate from plain ones, memoized ids survive AllocateId, modules
do not share ids, and ids stay unique and contiguous past the cache capacity.
The test passes against both the previous header and this one, so it pins the
contract rather than the implementation.

Benchmark, pre-optimization header against this one, best of five:

  hot loop x 2M              613.6 ms ->   46.3 ms   13.2x
  compile-shaped 5000 instr    4.2 ms ->    0.4 ms   10.8x
  64 compile-shaped modules  286.0 ms ->   25.4 ms   11.3x

Allocations for the compile-shaped case fall from 55217 to 415. Both builds
compute the same value over the same call sequence.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 15:58:31 +03:00
Slick Daddy 87e261b451 perf(shader): intern SPIR-V type and constant ids without a per-call allocation
Every SpirvModule::Type and Constant call built a heap std::vector key and
looked it up in a std::map keyed on std::vector, so the comparison walked the
key bytes. At the one to three such calls per emitted instruction a shader
issues thousands of them per compile.

Add a fixed-size, linearly probed declaration cache that holds the key inline
and is consulted before the key vector is built, making a repeated declaration
a hash and a compare. The cacheable shapes are those whose operands are a
word: OpTypeVoid, OpTypeBool, OpTypeInt, OpTypeFloat, OpTypeVector,
OpTypePointer, OpTypeStruct, OpTypeArray, OpTypeFunction and the scalar
OpConstant family. The overloads are constrained on word-sized operands so
that enum operands such as spv::StorageClassFunction reach the cache instead of
binding the variadic template by reference.

Measured with a harness driving the module through the emitters' call shapes:
80000 hot type and constant calls drop from 80074 heap allocations to 140. The
assigned ids and the emitted SPIR-V word stream are byte-identical.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 15:58:31 +03:00
Pacuka 6814cab9f9 fix(libkernel): map POSIX adaptive mutexes to the adaptive type
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:30:12 +02:00
Pacuka 98f050f879 fix(libkernel): default mutexes to error checking and add the adaptive type
The PS5 libthr (FreeBSD) creates error-checking mutexes by default and has
PTHREAD_MUTEX_ADAPTIVE_NP (type 4); relocking an error-checking or adaptive
mutex returns EDEADLK. Default mutexes were Normal and type 4 was mapped to
Normal, so a relock threw instead of returning EDEADLK, which aborted an
Unreal Engine title's recursive directory scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:28:33 +02:00
Pacuka 3e5648dcf7 fix(ajm): refuse Opus rates other than 48 kHz and record the parameter layout as unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:28:19 +02:00
Pacuka 5ecf80e2f5 feat(ajm): decode Opus (codec 24) through FFmpeg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:26:57 +02:00
QDarkRex 47f0bf93ef fix(relinker): identify unsupported Windows TLS instructions
The unsupported-instruction error now lists the instruction bytes, and the relink failure names the input file, the main executable or the guest module, on an extra Input: line.
2026-10-04 19:09:10 +07:00
Adrià Franch c5effd409e feat(shader): saturate VOP2 integer SDWA results on clamp
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 13:36:35 +02:00
Adrià Franch 978dad19b1 feat(shader): accept every SDWA selector on VOP2 integer ops
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 13:29:20 +02:00