Commit Graph

6138 Commits

Author SHA1 Message Date
DotDebian 92a378afc4 fix(tools): count the debug branches and s_ttracedata_imm as decoded shader instructions
SCbranchCdbg decodes SOPP 0x17-0x1a and STtracedata decodes 0x16 and 0x28,
so S_CBRANCH_CDBGSYS, S_CBRANCH_CDBGUSER, S_CBRANCH_CDBGSYS_OR_USER,
S_CBRANCH_CDBGSYS_AND_USER and S_TTRACEDATA_IMM were reported as missing
although the decoder handles them and existing tests cover them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:27:13 +02:00
DotDebian 9f2319b46e feat(shader): implement v_sad_u8, v_sad_hi_u8, v_sad_u16 and v_msad_u8
Decode VOP3 0x15a, 0x15b, 0x15c and 0x171 and translate them as the
unsigned sum of absolute differences over the byte or word fields of
the first two sources, accumulated into the third. v_sad_hi_u8 shifts
the sum into the high half first, v_msad_u8 skips the fields whose
reference byte in the second source is zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:25:22 +02:00
DotDebian 1817d83fec fix(libkernel): return -1 and set errno from the POSIX open, stat, unlink and rmdir
open, _open, stat, unlink and rmdir forwarded the result of their sceKernel
twin, so a failure returned 0x8002xxxx instead of -1 and errno was never set
to the guest error. They now return -1 with errno set to the code carried by
the sce error, and report a null pointer as EFAULT and an empty path as
ENOENT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:17:12 +02:00
DotDebian 146795c9cb feat(shader): decode s_wakeup as a no-op
s_wakeup (SOPP 0x03) threw "unsupported SOPP opcode 3" in the decoder. It
pings the other waves of the thread group so they leave s_sleep early.
s_sleep already translates to nothing, so no wave is ever asleep and the
ping has nothing to wake: s_wakeup translates like s_sleep. It carries no
operand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:10:07 +02:00
DotDebian 65eac4fdb6 feat(shader): implement s_get_waveid_in_workgroup
SMEM opcode 0x2a threw in the decoder. It carries only a scalar destination
and returns the index of the current wave in its workgroup. A compute
workgroup fills its waves in local invocation index order, the mapping the
compute prologue already uses for the tg_size wave id, so the result is the
local invocation index divided by the wave size. Other stages throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:08:46 +02:00
asimplestray 5d1a130902 test(shader): cover VOPC compare constants and ordered F16 2026-10-02 16:07:44 +00:00
asimplestray 20f12cc80e feat(shader): implement legacy float multiply-add ops 2026-10-02 16:04:44 +00:00
DotDebian f1be5b8ba5 fix(libkernel): report the thread's priority and affinity from scePthreadAttrGet
scePthreadAttrGet wrote priority 700 and left the affinity of the
destination untouched, whatever the thread was created with or set to
afterwards. It now reports the values the thread holds, as
pthread_attr_get_np already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:03:51 +02:00
asimplestray f6e689de2f feat(shader): implement MIMG sample/gather flag variants 2026-10-02 15:59:39 +00:00
Michon 7b03d86bc5 fix(agc): a replaced device's unit shadows leave the registry
When the windowless device is replaced at the first present, its unit
shadows were published but stayed registered. Lookups take the shadow
whose import starts nearest below an address, so such a stale entry
could hide the live import's shadow. The write-back results it held then
looked absent, and an upload read the import's stale bytes instead.
The replaced device's shadows are now dropped once it is idle.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 17:57:04 +02:00
DotDebian d7d36193db test(shader): cover the operand-less decoding of v_nop, v_pipeflush and v_clrexcp
The VOP3 form of v_nop now decodes without operands, and no test looked at
it. agc_vop1_control_decode decodes the three instructions in VOP1 and VOP3
form and checks the opcode, the length, the null destination and the absence
of sources. agc_driver_vop1_control also runs v_nop in both forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:50:53 +02:00
DotDebian de534fb927 feat(shader): implement the missing integer image atomics
Decode MIMG image_atomic_cmpswap, sub, smin, smax, inc and dec and
recompile them on the image texel pointer. sub, smin and smax map to
the SPIR-V atomic of the same name. cmpswap takes the new value from
VDATA[0] and the comparand from VDATA[1] (dmask 0x3) and returns the
previous value in VDATA[0]. inc and dec use the compare-exchange loop
of ds_inc/ds_dec, whose replacement helpers are now shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:39:14 +02:00
DotDebian e8e5518c04 feat(shader): decode v_pipeflush and v_clrexcp as no-ops
v_pipeflush (VOP1 0x1b) and v_clrexcp (VOP1 0x41) threw in the decoder, as did
their VOP3 forms. SPIR-V has no ALU pipeline to flush, and the recompiler keeps
no exception flags for v_clrexcp to clear, so both translate like v_nop, which
emits nothing. Neither has operands: they decode with a null destination and no
sources. The VOP3 form of v_nop decoded a destination and a source it does not
have and now takes the same path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:23:09 +02:00
DotDebian bd75a89ef4 feat(shader): implement the VOPC f64 compares
Decode v_cmp_*_f64, v_cmpx_*_f64 and v_cmp(x)_class_f64 in their VOPC and VOP3 encodings and translate them as exact IEEE-754 compares on the 64-bit pattern with the existing 64-bit integer IR, so no Float64 capability is needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:16:32 +02:00
DotDebian b279848c12 feat(libkernel): implement the pthread_barrierattr functions
pthread_barrier_init threw for any non-null attributes object, and no
function could create one. Add pthread_barrierattr_init, _destroy,
_getpshared and _setpshared after FreeBSD libthr, and let
pthread_barrier_init take the object.

PTHREAD_PROCESS_SHARED still throws in pthread_barrierattr_setpshared:
FreeBSD 9.0 rejects it and 11.0 accepts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:08:07 +02:00
DotDebian 5046aebc29 fix(tools): count the tested s_cmpk variants
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:06:50 +02:00
DotDebian 6e17a6be7f test(shader): cover the s_cmpk compares
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:06:50 +02:00
Nicolas Abosch 65e59966bc feat(libSceIme): implement parameter initialization and panel size queries 2026-10-02 12:03:34 -03:00
boykopovar 313de1c5a3
Merge pull request #289 from SP4C3B4R-8/feat/missing-exports
feat(libs): declare missing AudioPropagation, AudioIn, NpSessionSignaling and dialog exports
2026-10-02 16:51:14 +03:00
DotDebian ba512363b1 feat(libkernel): implement sceKernelSyncOnAddressWait and sceKernelSyncOnAddressWake
sceKernelSyncOnAddressWait parks the calling thread while the 32-bit word
at the address still holds the expected value, until
sceKernelSyncOnAddressWake releases it or the timeout expires.
sceKernelSyncOnAddressWake releases up to the requested number of threads
parked on the address, in arrival order.

The libc.prx bundled with SDK 9 titles imports both for its once
primitive, so those titles stopped at load with an unresolved import.

# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-02 16:49:44 +03:00
boykopovar a4157bbeee
Merge pull request #355 from DotDebian/feat/map-named-flexible-memory-internal
feat(libkernel): implement sceKernelMapNamedFlexibleMemoryInternal
2026-10-02 16:45:58 +03:00
boykopovar 0a2f99147f
Merge pull request #296 from Pouare514/feat/libSceJpegDec
feat(libSceJpegDec): implement JPEG decoding
2026-10-02 16:45:18 +03:00
boykopovar e00b491465
Merge pull request #286 from SP4C3B4R-8/feat/windows-mapping-hints
feat(libkernel): support mapping address hints and no-overwrite fixed mappings on Windows
2026-10-02 16:41:43 +03:00
DotDebian 74fcea27f8 feat(libkernel): implement sceKernelMapNamedFlexibleMemoryInternal
libkernel did not export sceKernelMapNamedFlexibleMemoryInternal, which
the libc bundled with SDK 9 titles imports. It now forwards to
sceKernelMapNamedFlexibleMemory: the mapping counts against the flexible
budget, gets the range name and is released by sceKernelMunmap. Older
libc builds call the public function at the same sites with the same
arguments and result handling.

The known callers pass flag 0x8000, whose meaning is unknown. It is
still rejected as an unsupported mapping flag and is recorded in
TechnicalDebt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 14:08:58 +02:00
Pouare514 c9ec561697 feat(libScePlayGoDialog): add PlayGo install dialog 2026-10-02 13:34:54 +02:00
Pouare514 8bd9670ab0 feat(libSceJpegDec): implement JPEG decoding 2026-10-02 13:34:41 +02:00
Pouare514 f1a3d60b15 fix(libkernel): boot Dreaming Sarah past unwind and debug raise 2026-10-02 13:34:35 +02:00
julienlgy 2755aff9b1 feat(libSceAudio3d): add missing sceAudio3dPortClose stub
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-02 12:46:50 +02:00
DotDebian dab1110556 feat(libkernel): implement sceKernelCancelSema
sceKernelCancelSema was a throwing stub. It now releases every thread
blocked in sceKernelWaitSema with SCE_KERNEL_ERROR_ECANCELED without
consuming tokens, sets the count to setCount (the initial count when
setCount is negative) and reports how many threads were waiting. A
setCount above the maximum returns SCE_KERNEL_ERROR_EINVAL and changes
nothing.

Waiters are counted separately from waiterCount, which is only
decremented when a waiter leaves, so two cancels in a row do not report
the same thread twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:57:00 +02:00
DotDebian d6cca762f4 feat(libkernel): support the CPU-time clocks in clock_gettime and clock_getres on Windows
CLOCK_THREAD_CPUTIME_ID (14) and CLOCK_PROCESS_CPUTIME_ID (15) threw
"unsupported clock_id" on Windows while the Linux branch already maps
them to the native clocks. clock_gettime now returns the user + kernel
time from GetThreadTimes / GetProcessTimes, and clock_getres reports the
clock interrupt period from GetSystemTimeAdjustment, which is the step
those counters actually advance by.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:40:22 +02:00
DotDebian 7fd0890320 feat(libkernel): implement __elf_phdr_match_addr
Returns 1 when the address lies in an executable PT_LOAD segment of the
given dl_phdr_info, following FreeBSD lib/libc/gen/elf_utils.c (9.x and
11.x branches). The stub parameters become (dl_phdr_info*, void*) to
match the FreeBSD declaration; a null dl_phdr_info throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:18:06 +02:00
QDarkRex 508a9710ae fix(relinker): report TLS bounds failures at file offsets 2026-10-02 16:14:54 +07:00
DotDebian 40d63b1b4c feat(libkernel): implement the sceKernelGetEvent* field accessors
sceKernelGetEventId, sceKernelGetEventFilter, sceKernelGetEventFflags,
sceKernelGetEventData and sceKernelGetEventUserData return the matching
field of the KernelEvent filled by sceKernelWaitEqueue and throw on a
null event. sceKernelGetEventError still throws NotImplemented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:46:15 +02:00
QDarkRex 102e042a49 fix(relinker): bound guest TLS loads to the thread block 2026-10-02 15:45:50 +07:00
QDarkRex 721984a28f fix(relinker): load Windows guest TLS at signed displacements 2026-10-02 15:19:25 +07:00
boykopovar e1654a97e5
Merge pull request #259 from adriadam10/feat/vopc-compare-gaps
feat(shader): implement the missing non-f64 VOPC compares
2026-10-02 11:14:37 +03:00
boykopovar 8ed9e7ab5e
Merge pull request #257 from adriadam10/feat/vop3-integer-gaps
feat(shader): VOP3 v_add/sub_nc_i32 (clamp), v_mul_lo_u16, 16-bit mads, v_ashrrev_i64
2026-10-02 11:13:30 +03:00
boykopovar 623c0d8dc6
Merge pull request #254 from adriadam10/fix/shader-writelane
fix(shader): select the written lane in v_writelane_b32
2026-10-02 11:13:02 +03:00
Dean Galvin 7ed138d13f fix(recompiler): start pixel waves without their helper invocations in EXEC
A pixel wave starts with EXEC holding its covered pixels. The other lanes of
a partly covered quad run as helpers outside EXEC until the shader asks for
whole quads with s_wqm. Pixel shaders started with every invocation in EXEC,
Vulkan's helper invocations included. Those take part in subgroup
operations, so they counted in ballots (v_mbcnt, s_bcnt1 of EXEC,
v_readfirstlane), and a wave's single ds_append or atomic could be performed
by one of them: an atomic in a helper invocation does nothing and returns an
undefined value.

The entry prologue now starts a pixel shader's EXEC as !gl_HelperInvocation,
through a new StageInputKind::HelperInvocation builtin input. s_wqm still
adds the helpers of every quad with a covered pixel, so derivative code keeps
them.

The agc_driver_pixel_helper_lanes execution test draws triangles that leave
partly covered quads across the target with a pixel shader that stores each
covered pixel's v_mbcnt rank in EXEC, the s_bcnt1 count of EXEC and the
v_readfirstlane of a pixel id. Every wave's covered pixels must be lanes
0..n-1 of an n-lane EXEC whose first lane is one of them, in wave64 and
wave32. It skips on a subgroup narrower than 32, such as lavapipe's.
2026-10-02 21:08:32 +13:00
Dean Galvin 151fec7fd6 fix(videoout): read the open param as the service thread's priority and affinity
and throws for any non-zero word after it. Its layout matches shadPS4's
ServiceThreadParams instead: an unknown first word (16), a set-priority flag
and a priority (256..767), a set-affinity flag and a 64-bit CPU mask at
offset 16. PPSA21564 passes 16, 1, 0x100, 1 and 0x1FFF, so it stops at
startup on main.

sceVideoOutOpen now validates each field and reads the mask only when its
flag is set, so a 16-byte param with both flags clear still works. The
priority and affinity are not applied, since the present and vblank threads
are host threads; this and the unknown first word are listed in the
technical debt.
2026-10-02 21:05:25 +13:00
Adrià Franch 58f90eea9d feat(libScePngEnc): implement PNG encoding
scePngEncQueryMemorySize, scePngEncCreate, scePngEncEncode and
scePngEncDelete encode R8G8B8A8 and B8G8R8A8 images with a pitch into
RGB or RGBA PNGs using the shared encoder in core/Decoder/Png.
Decoder::Png::Encode takes optional compression level and filter
options so the encode parameters are honoured.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 10:00:32 +02:00
Adrià Franch 3033e5e554 feat(shader): implement s_movrels/s_movreld (b32, b64) and s_movrelsd_2_b32
s_movrels reads SGPR[src + M0] and s_movreld writes SGPR[dst + M0].
The 64-bit forms align the offset down to even (M0 & ~1), and
s_movrelsd_2_b32 takes the source offset from M0[9:0] and the
destination offset from M0[25:16], as measured on hardware. They use
the same select-over-registers lowering as the vector forms, over the
106 SGPRs. The embedded vertex-fetch scan forgets every tracked SGPR on
a relative write.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 09:59:59 +02:00
Adrià Franch f3f9b4fff7 feat(shader): implement s_bcnt0_i32_b64, s_ff0_i32_b64, s_flbit_i32(_i64), s_quadmask_b32
The decoder threw for these SOP1 opcodes. The 64-bit find-first-zero and
signed leading-bit counts reuse the existing 64-bit helpers with a flag;
s_quadmask_b32 is the 32-bit half of s_quadmask_b64. s_bcnt0 and s_quadmask
set SCC to result != 0; the find and leading-bit forms leave it.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 09:59:47 +02:00
Adrià Franch 24f959b48c fix(shader): select the written lane in v_writelane_b32
The WriteLane IR takes {value, lane, previous}, as the translation and the
read-lane eliminator use it, but the SPIR-V emitter compared the lane id with
the previous value and selected between the lane index and the value. Every
v_writelane therefore wrote its value to all lanes (or the lane index to the
lane whose old value happened to equal its id).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 09:59:37 +02:00
boykopovar 01eaae0bf9
Merge pull request #253 from adriadam10/feat/shader-cache-hint-noops
feat(shader): decode cache invalidations and performance hints as no-ops
2026-10-02 10:50:20 +03:00
boykopovar 9b3927b4ea
Merge pull request #252 from adriadam10/feat/vop3-f16-ubyte-aliases
feat(shader): VOP3 v_max/min_f16, v_cvt_f32_f16/ubyte and abs/neg on f16 binaries
2026-10-02 10:49:58 +03:00
boykopovar 29364c33d8
Merge pull request #248 from adriadam10/feat/ngs2-atrac9
feat(libSceNgs2.native): decode ATRAC9 sampler voices, parse and size ATRAC9 waveforms
2026-10-02 10:47:15 +03:00
boykopovar 4eab28c1fa
Merge pull request #241 from adriadam10/feat/audio-legacy
refactor(audio): drop duplicated stub exports from libSceAudio
2026-10-02 10:35:29 +03:00
boykopovar 194ea62ff9
Merge pull request #228 from adriadam10/feat/ajm-from-native
refactor(ajm): drop duplicated stub exports from libSceAjm and libSceAjmi
2026-10-02 10:35:05 +03:00
boykopovar a0eb90559e
Merge pull request #237 from adriadam10/fix/ajm-mp3-s16p
fix(ajm): convert planar 16-bit MP3 output from FFmpeg
2026-10-02 10:34:44 +03:00