Commit Graph
12196 Commits
Author SHA1 Message Date
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 DaddyandClaude 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 <[email protected]>
2026-10-04 15:58:31 +03:00
Slick DaddyandClaude 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 <[email protected]>
2026-10-04 15:58:31 +03:00
PacukaandClaude Opus 5.5 6814cab9f9 fix(libkernel): map POSIX adaptive mutexes to the adaptive type
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 14:30:12 +02:00
PacukaandClaude Opus 5.5 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 <[email protected]>
2026-10-04 14:28:33 +02:00
PacukaandClaude Opus 5.5 3e5648dcf7 fix(ajm): refuse Opus rates other than 48 kHz and record the parameter layout as unknown
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 14:28:19 +02:00
PacukaandClaude Opus 5.5 5ecf80e2f5 feat(ajm): decode Opus (codec 24) through FFmpeg
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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à FranchandClaude c5effd409e feat(shader): saturate VOP2 integer SDWA results on clamp
Co-Authored-By: Claude <[email protected]>
2026-10-04 13:36:35 +02:00
Adrià FranchandClaude 978dad19b1 feat(shader): accept every SDWA selector on VOP2 integer ops
Co-Authored-By: Claude <[email protected]>
2026-10-04 13:29:20 +02:00
Adrià FranchandClaude 50256b0ac4 fix(shader): VOP3 op_sel on v_alignbit/alignbyte_b32 and 16-bit max3/min3/med3
op_sel[1:0] on v_alignbit_b32/v_alignbyte_b32 selects the byte of src2 that
holds the shift, op_sel[2] is ignored and op_sel[3] writes the low 16 result
bits to the high half with the low half zeroed (measured on gfx1035).
v_alignbyte_b32 now uses src2[1:0] only, as the ISA says; values >= 4 gave
a wrong result before. v_max3/min3_{i16,u16} and v_med3_u16 take op_sel like
v_med3_i16 already does.

Co-Authored-By: Claude <[email protected]>
2026-10-04 12:41:07 +02:00
Adrià FranchandClaude 89eb938803 fix(shader): VOP3P integer clamp on v_pk_mad/add/sub_{i16,u16}
Co-Authored-By: Claude <[email protected]>
2026-10-04 12:33:38 +02:00
MichonandClaude Opus 5.5 34c57ca65d feat(agc): render into one depth slice of a 3D color target
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-04 12:24:09 +02:00
MichonandClaude Opus 5.5 d7d7c142f4 feat(agc): 4 KiB standard color targets and color views of one array slice
Color targets with the SW_4KB_S swizzle (CB_COLOR_ATTRIB3 tile mode 5) are laid out in 4 KiB
blocks with the standard element order the texture detiler uses, and are resident through the
same storage images as 64 KiB targets. A CB_COLOR_VIEW selecting one slice (SLICE_START equal to
SLICE_MAX) renders into that slice: the target starts one slice size per slice after the surface,
the slice size being the surface's mip chain as a texture of the same tile mode lays it out. Views
of several slices are still rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-04 12:24:05 +02:00
SP4C3B4R-8andClaude Opus 5.5 48ebf3195e fix(libSceAgcDriver): skip depth and stencil tests whose plane is absent
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 12:17:38 +02:00
Adrià FranchandClaude 1233dd815d fix(shader): clamp f32 results to +0 for NaN and -0
Co-Authored-By: Claude <[email protected]>
2026-10-04 12:16:07 +02:00
Adrià FranchandClaude 1a5507698b fix(shader): choose v_div_scale_f32/v_div_fmas_f32 NaNs on the bits and refuse s_denorm_mode
v_div_scale_f32 returns a NaN source unchanged instead of scaling it,
and v_div_fmas_f32 quiets the first NaN input or returns the default
NaN 0xffc00000, so results no longer depend on the driver's NaNs. The
test compares NaN results bit for bit. s_denorm_mode throws: the
recompiler does not pin a denormal mode, so no value matches what it
models.

Co-Authored-By: Claude <[email protected]>
2026-10-04 12:05:33 +02:00
Adrià FranchandClaude 11bc279945 feat(shader): implement v_div_scale_f32, v_div_fmas_f32, v_div_fixup_f32 and s_denorm_mode
These make up the precise f32 division macro compilers emit for a / b. No
reference emulator implements them and the ISA pseudocode disagrees with the
hardware, so the rules were measured on an RDNA2 GPU:
- div_scale decides from the exponent fields only: 2^64 or 2^-64 scaling
  and VCC for differences >= 96 or <= -96, a denormal or huge (>= 253)
  denominator and a numerator exponent <= 24; a zero input gives 0xffc00000.
- div_fmas scales by 2^64 when the exponent of S2 is >= 128, else 2^-64,
  before the single rounding (the ISA says a fixed 2^32).
- div_fixup follows the ISA, and a NaN quotient with finite inputs becomes
  +-inf.
s_denorm_mode is accepted and ignored; listed in TechnicalDebt.

Co-Authored-By: Claude <[email protected]>
2026-10-04 12:05:33 +02:00
Adrià FranchandClaude 7f291b7658 feat(shader): implement the float and 64-bit inc/dec buffer atomics
buffer_atomic_fcmpswap, fcmpswap_x2, fmin_x2, fmax_x2, inc_x2 and
dec_x2 are compare-and-swap loops on the dword or qword. fcmpswap
compares as floats (-0 equals +0, NaN equals nothing) and fmin/fmax are
IEEE minNum/maxNum with -0 < +0, a quieted result for a signalling NaN
and the other operand for a quiet one, all with integer ops so the
driver's float controls do not matter. The existing 32-bit fmin/fmax
kept the old value whenever a NaN or two zeros were involved; it now
uses the same rule.

Co-Authored-By: Claude <[email protected]>
2026-10-04 12:01:15 +02:00
Adrià FranchandClaude ae36aafcb2 feat(shader): implement buffer_atomic_inc/dec and the 64-bit integer buffer atomics
buffer_atomic_inc, buffer_atomic_dec, buffer_atomic_cmpswap_x2 and
buffer_atomic_{add,sub,smin,umin,smax,umax,and,xor}_x2 threw in the decoder.
The 64-bit ones use native 64-bit SPIR-V atomics like the existing
swap_x2/or_x2; inc and dec wrap at the data operand through the existing
compare-exchange helpers.

Co-Authored-By: Claude <[email protected]>
2026-10-04 11:59:54 +02:00
Dean 2cf901bcff Merge pull request #401 from MichonGoddijn231849/perf/buffer-pool-buckets
perf(agc): keep the buffer pool's free slots by key and retain 4096
2026-10-04 22:56:48 +13:00
Dean 0bd5766246 Merge pull request #394 from MichonGoddijn231849/feat/mipmapped-3d-textures
feat(agc): mipmapped 3D textures
2026-10-04 22:56:31 +13:00
Dean 1104cfce5b Merge pull request #404 from MichonGoddijn231849/perf/color-swizzle-tables
perf(agc): build the color target swizzle tables once per element size
2026-10-04 22:56:14 +13:00
Dean 0623b69325 Merge pull request #376 from MichonGoddijn231849/feat/depth-bounds-bias
feat(agc): depth bounds test and depth bias
2026-10-04 22:55:57 +13:00
Dean bd753903e3 Merge pull request #294 from MichonGoddijn231849/split/color-target-gaps
fix(agc): color targets with gaps between written MRT slots, depth array slices
2026-10-04 22:55:40 +13:00
Dean 97822deb0b Merge pull request #446 from adriadam10/feat/vop3-f64-basic
feat(shader): implement basic f64 VALU ops
2026-10-04 22:55:23 +13:00
Dean ce8b0838ee Merge pull request #471 from adriadam10/perf/single-front-end
perf(shader): build a shader's front end once on first use
2026-10-04 22:55:06 +13:00
Dean 6a4bbade0d Merge pull request #435 from adriadam10/feat/vop3-mad-i64-i32
feat(shader): implement v_mad_i64_i32
2026-10-04 22:54:49 +13:00
Dean 13cbbfa7f7 Merge pull request #325 from adriadam10/feat/relative-indexing
feat(shader): implement v_movrelsd_b32, v_movrelsd_2_b32, v_swap_b32 and v_swaprel_b32
2026-10-04 22:54:32 +13:00
Dean f4071f2469 Merge pull request #331 from adriadam10/feat/format-d16-stores
feat(shader): implement the D16 format buffer stores
2026-10-04 22:54:11 +13:00
Dean 1f4e030374 Merge pull request #330 from adriadam10/fix/formatted-store-conversion
fix(shader): convert formatted buffer stores to the element format
2026-10-04 22:53:54 +13:00
Dean 598833214b Merge pull request #329 from adriadam10/feat/format-d16
feat(shader): implement the D16 format buffer loads
2026-10-04 22:53:37 +13:00
Dean 5ce9600d87 Merge pull request #319 from adriadam10/feat/d16-memory
feat(shader): implement the D16 byte/short loads and high-half stores
2026-10-04 22:53:20 +13:00
MichonandClaude Opus 5.5 527c8e46a8 fix(shader): v_mov_b32 SDWA writes byte destinations
v_mov_b32 accepted SDWA destination selectors for the words only; a byte
destination (dst_sel BYTE_0..3) threw 'VOP1 SDWA destination selector is not
supported'. The write itself already handles bytes and every dst_unused mode
(TranslationContext::writeRawU32). GTA V aborted during boot on such a move
(dst_sel BYTE_0, dst_unused UNUSED_PRESERVE) in one of its eboot compute
shaders. The error now names the selector, opcode and pc. The SDWA destination
execution test covers BYTE_0 and BYTE_2 with UNUSED_PRESERVE and BYTE_1 with
UNUSED_PAD.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-04 11:44:10 +02:00
MichonandClaude Opus 5.5 66a46259d1 fix(agc): pad tiled 3D mip levels from their size rounded up, as addrlib does
addrlib sizes a non-tail level with ShiftCeil; the layout used the image's
rounded-down extent, so volumes with a non-power-of-two width or height (33x20x12
in the new test) got a different layout.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-04 10:27:32 +02:00
MichonandClaude Opus 5.5 efde918a62 feat(graphics): mipmapped 3D textures
3D textures with more than one mip level were refused. Each slab of
blockDepth slices of a thick (SW_4KB_S / SW_64KB_S) volume now holds the
whole mip chain, smallest level first and level 0 last, as 2D chains are
laid out. A level's depth halves per level, so the texture loops skip the
slices a level does not have. Thin 3D (D/R 64KB_X) chains use the 2D mip
layout per depth slice. Thick mip tails still throw.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-04 10:27:32 +02:00
Dean 9f9a8f5a53 Merge pull request #340 from QDarkRex/fix/relinker-tls-fs-disp32
fix(relinker): load Windows guest TLS values at signed displacements
2026-10-04 20:39:50 +13:00
Adrià FranchandClaude e1b7ecc1c5 feat(shader): implement v_mad_i64_i32
Decode VOP3b 0x177 and translate it next to v_mad_u64_u32: the high half of
the product comes from SMulHi, and the carry-out is the sign of the exact
sum (bit 64 of the sign-extended product plus the sign-extended addend), as
measured on RDNA2 hardware.

Co-Authored-By: Claude <[email protected]>
2026-10-04 09:17:12 +02:00
Dean 8a64778581 Merge pull request #486 from RomainROCH/codex/fix-executable-segments
fix(relinker): validate all executable segments and preserve live imports
2026-10-04 20:09:49 +13:00
Dean 3237b6b548 Merge pull request #484 from RomainROCH/codex/fix-elf-string-bounds
fix(relinker): bound dynamic strings by the declared table size
2026-10-04 20:09:33 +13:00
QDarkRex ab5c339039 fix(relinker): reject guest TLS loads from unmodelled control block fields
Loads at fs:1 through fs:0x27 read tcb_dtv and tcb_thread on the FreeBSD layout, which the Windows thread control block does not model, so they returned zero. Accept only the TLS block, fs:0 and the stack guard at fs:0x28, and fail the relink for the rest.
2026-10-04 14:09:19 +07:00
Dean a75b2c9550 Merge pull request #316 from adriadam10/fix/wave32-subgroup-size
fix(agc): run wave32 compute programs on 32-wide subgroups
2026-10-04 20:09:16 +13:00