Commit Graph
6138 Commits
Author SHA1 Message Date
Adrià FranchandClaude 6138494928 feat(shader): implement image_sample_cd/_g16 variants and fix a16 gradient layout
Co-Authored-By: Claude <[email protected]>
2026-10-05 03:39:58 +02:00
MichonandClaude Opus 5.5 e18d4292a2 fix(shader): decode image_sample_cd as a derivative sample
image_sample_cd takes its derivatives in the image_sample_d address
layout; only the hardware LOD selection differs (one LOD per quad instead
of per pixel). The decoder refused it. It now samples with the given
gradients per lane, which matches whenever the lanes of a quad pass equal
derivatives.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-05 03:39:39 +02:00
Adrià FranchandClaude f3b74e2cef fix(shader): choose unary f32/f16 special results on the bits, as RDNA does
v_ceil/floor/trunc/rndne/fract/sqrt/rsq/rcp/rcp_iflag/log/exp/sin/cos
(f32 and f16) and v_frexp_mant_f32 left NaN, invalid, zero and infinite
results to the driver: signalling NaNs came back unquieted, lavapipe lost
the NaN sign and payload, invalid results were +NaN instead of -NaN, f32
sin/cos at whole and half cycles returned tiny values instead of +0, and
v_fract_f16 of a tiny negative rounded up to 1.0.

Adds an execution test for the 27 opcodes with expected values from
hardware; approximate ops are compared with tolerances from the Vulkan
precision table.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:38:12 +02:00
Adrià FranchandClaude 6686bff493 test(shader): compare f16 sine results within the Vulkan error bound
Co-Authored-By: Claude <[email protected]>
2026-10-05 03:38:07 +02:00
Adrià FranchandClaude 30fdc07cd5 test(shader): accept any NaN where the driver picks the f16 result payload
Co-Authored-By: Claude <[email protected]>
2026-10-05 03:38:07 +02:00
Adrià FranchandClaude b94b1f96dc fix(shader): apply clamp but not omod to f16 results, as RDNA does
writeF16 dropped the clamp bit, so VOP3/SDWA f16 results with clamp
(v_rcp_f16, v_fma_f16, v_cvt_f16_f32, v_add_f16_sdwa, ...) were not
saturated. Clamp now limits to [0, 1] with NaN and -0 going to +0.
The f16 sqrt/rsq/log and sin/cos paths applied omod, which the
hardware ignores on f16 results in the default float mode, and
v_cvt_pkrtz_f16_f32 applied clamp and omod to its inputs, which the
hardware ignores as well.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:38:07 +02:00
Adrià FranchandClaude 063437cdcd feat(shader): implement v_div_scale_f64, v_div_fmas_f64 and v_div_fixup_f64
These make up the precise f64 division macro compilers emit for a / b.
Like the f32 ops, the rules were measured on an RDNA2 GPU (41152 rows,
model matches all of them):
- div_scale decides from the exponent fields only: 2^128 or 2^-128
  scaling and VCC for differences >= 768 or <= -768, a denormal or huge
  (>= 2045) denominator and a numerator exponent <= 53; a NaN source is
  passed through unchanged and a zero input gives 0xfff8000000000000.
- div_fmas scales by 2^128 when the exponent of S2 is >= 1024, else
  2^-128, before the single rounding, so it reuses the exact fma
  emulation with the scale folded into its final rescale.
- div_fixup follows the ISA: NaN sources are quieted, a NaN quotient
  with finite inputs becomes +-inf, exponent differences below -1075
  give a signed zero.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:37:13 +02:00
Adrià FranchandClaude 4f901b9a77 feat(shader): implement v_rcp/rsq/sqrt_f64 and v_trig_preop_f64
Decode and translate the remaining unary f64 transcendentals and
v_trig_preop_f64.

On RDNA2 hardware v_rcp_f64, v_rsq_f64 and v_sqrt_f64 are approximations
(relative error up to ~2^-24.3 over 8209 inputs; sqrt(1.0) is not even
exact), so they are emitted as exact double operations and the test
compares against the hardware value with a 2^-23 tolerance. Special
cases are exact and selected on bits: NaN inputs are quieted (RADV keeps
signaling NaN on FDiv), negative inputs give the default NaN
0xfff8000000000000, rsq(-0) = -inf, sqrt(-0) = -0.

v_trig_preop_f64 matches the hardware bit for bit on 24627 results plus
a sweep of the table tail: the 2/PI table is 1184 bits (bits below b17
read as zero), shift = 53 * S1[4:0] + max(exp - 1077, 0), +128 scale for
exp >= 1968, omod ignored. The 53-bit window is read from a private u32
table and scaled in two exact steps so only the final multiply rounds.

Stacked on the f64 infrastructure of #446.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:36:14 +02:00
Adrià FranchandClaude 36c2fa4ffe fix(shader): translate s_round_mode only for round to nearest even
Any other mode throws instead of being a silent no-op.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:34:37 +02:00
Adrià FranchandClaude 69e2d801d1 feat(shader): decode the s_endpgm variants, s_round_mode and SMEM probe/discard
s_endpgm_saved and s_endpgm_ordered_ps_done end the wave like s_endpgm
(checked on an RDNA2 GPU: nothing after them runs), so they decode to
SEndpgm and the control flow graph treats them as terminators.
s_atc_probe, s_atc_probe_buffer and s_dcache_discard(_x2) have no visible
effect and translate to no-ops like the other scalar cache controls.
s_round_mode is ignored like s_setreg MODE writes; listed in TechnicalDebt.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:34:37 +02:00
Adrià FranchandClaude 12befda5cf fix(shader): refuse DPP16 on opcodes with no DPP form
Co-Authored-By: Claude <[email protected]>
2026-10-05 03:33:06 +02:00
Adrià FranchandClaude fd159a63b0 fix(shader): DPP16 lanes whose source lane is inactive
Without bound_ctrl and fetch-inactive, a DPP16 lane whose source lane is
inactive keeps its old value instead of being written with 0. With
fetch-inactive, a source outside the row reads 0.

Co-Authored-By: Claude <[email protected]>
2026-10-05 03:32:41 +02:00
Adrià FranchandClaude 391eb6ffe8 feat(shader): decode DPP8 on VOP1 and VOP2
Co-Authored-By: Claude <[email protected]>
2026-10-05 03:32:30 +02:00
Dean ebf29f8d91 Merge pull request #595 from NahuelGenchi/fix/fma-legacy-dx9-zero
fix(shader): apply the DX9 zero rule to v_fma_legacy_f32
2026-10-05 14:32:00 +13:00
Dean 8a0efb6338 Merge pull request #589 from hamb3r/fix/windows-dpi-awareness
fix(video): set per-monitor v2 DPI awareness on Windows
2026-10-05 14:31:18 +13:00
Dean bc0726c486 Merge pull request #583 from DiulioAires/fix/bytewriter-bounds
fix(relinker): check byte writer bounds
2026-10-05 14:30:37 +13:00
Dean 70596d78eb Merge pull request #577 from CnRJay/feat/s-getreg-mode
feat(shader): implement s_getreg_b32 for the MODE round mode fields
2026-10-05 14:29:24 +13:00
raghav314 77e2fe1322 docs(ajm): record where the codec info and gapless values come from 2026-10-05 06:58:23 +05:30
Dean 13e0afcc00 Merge pull request #576 from CnRJay/feat/vop-legacy-fma-dot2
feat(shader): implement v_dot2_f32_f16
2026-10-05 14:27:40 +13:00
Dean 359aa37233 Merge pull request #594 from DotDebian/feat/shader-buffer-atomic-csub
feat(shader): implement buffer_atomic_csub
2026-10-05 14:25:56 +13:00
Dean 60b6cfc173 Merge pull request #590 from CnRJay/fix/agc-thread-local-teardown
fix(agc): free per-thread driver state at thread exit without emutls
2026-10-05 14:25:46 +13:00
Dean ff96422459 Merge pull request #587 from nicolasabosch/fix/wave32-wide-subgroups
fix(shader): isolate wave32 operations in wide host subgroups
2026-10-05 14:25:04 +13:00
Dean ec46678f61 Merge pull request #588 from DotDebian/feat/relinker-sha1-memory-operand
feat(relinker): lower SHA-1 instructions with a memory operand
2026-10-05 14:24:22 +13:00
Dean 65b750aee6 Merge pull request #592 from DotDebian/fix/pngenc-filter-subset
fix(pngenc): restrict adaptive filtering to the requested filter subset
2026-10-05 14:23:41 +13:00
Dean 18d9745de4 Merge pull request #584 from DotDebian/feat/font-get-render-scaled-kerning
feat(font): implement sceFontGetRenderScaledKerning
2026-10-05 14:23:00 +13:00
Dean 4ae4f53ffb Merge pull request #338 from Pouare514/feat/prx-loader-tripwires
feat(prx): unknown loader tripwires for TLOU
2026-10-05 14:22:18 +13:00
Dean d5170a3ac3 Merge pull request #521 from Pouare514/fix/crashreport-hang-watchdog
feat(crashreport): hang watchdog with all-threads dump
2026-10-05 14:21:37 +13:00
Dean 1a7323ecfc Merge pull request #549 from Pouare514/fix/reserve-virtual-idempotent
fix(libkernel): idempotent fixed virtual reservation over registered range
2026-10-05 14:20:55 +13:00
Dean 62ed092cc9 Merge pull request #359 from DotDebian/feat/kernel-mlock
feat(libkernel): implement sceKernelMlock
2026-10-05 14:20:14 +13:00
Dean 11d17fcba7 Merge pull request #367 from DotDebian/fix/pthread-key-reuse
fix(libkernel): do not expose stale thread-specific values through a reused pthread key
2026-10-05 14:19:32 +13:00
Nahuel Genchi 331d16d44a fix(tools): count v_fmac_legacy_f32 and v_fma_legacy_f32 as decoded shader instructions
VOP2 0x06 and VOP3 0x140 were only matched by their RDNA 1 names.
2026-10-04 21:47:22 -03:00
Nahuel Genchi d32eb5d309 fix(shader): apply the DX9 zero rule to v_fma_legacy_f32
VOP3 0x140 was translated as a plain fma, so a zero source times an
infinity or a NaN gave NaN instead of the addend. A zero source now
gives +0 + src2, the same rule v_mul_legacy_f32 and v_mac_legacy_f32
already follow. The opcode also takes neg and abs on its sources.
2026-10-04 21:47:22 -03:00
Pouare514 15a4b73e6c fix(crashreport): single-dump timed watchdog with positive-only timeout 2026-10-05 02:31:17 +02:00
DotDebianandClaude Opus 5.5 bf635fae68 feat(shader): implement image_bvh64_intersect_ray
MIMG 0xe7 is the node test of image_bvh_intersect_ray with a 64-bit node
pointer: the pointer takes the first two address dwords (low, high), so
the instruction addresses 12 dwords, or 9 with A16.

The node index and address are computed from the whole pointer. A zero
base in the T# is a null BVH only for the 32-bit form: with 64-bit
pointers the T# may cover all of memory from base 0 and the pointer then
carries the node address, so only the T# size bounds the node.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 00:26:32 +00:00
Dean 8387b4da51 Merge pull request #573 from CnRJay/feat/ds-atomics-64
feat(shader): implement the 64-bit LDS atomics
2026-10-05 13:26:22 +13:00
DotDebianandClaude Opus 5.5 4dea441f01 fix(libkernel): do not expose stale thread-specific values through a reused pthread key
scePthreadKeyDelete frees a key slot and the next scePthreadKeyCreate
hands the same index out again, but every thread kept the value it had
stored under that index. The new key read the previous key's value
instead of NULL, and at thread exit its destructor was called on that
stale pointer.

Each slot now carries a sequence number, as in FreeBSD libthr. A thread
value is visible to scePthreadGetspecific and to the exit destructors
only while its sequence matches the slot's, so a new key starts as NULL
in every thread, as POSIX requires, and a deleted key reads NULL.

scePthreadGetspecific stays lock-free and scePthreadSetspecific no
longer takes the key lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 00:26:20 +00:00
DotDebianandClaude Opus 5.5 774b34986c feat(libkernel): implement sceKernelMlock
Lock the guest pages of the range with VirtualLock or mlock, following FreeBSD mlock(2): the range is widened to guest pages, a zero length succeeds, a wrapping range is EINVAL and a range that is not mapped and accessible is ENOMEM. The Windows working set limits and the Linux RLIMIT_MEMLOCK soft limit are raised when the lock needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 00:25:56 +00:00
raghav314andClaude Opus 5.5 2771eeea77 feat(ajm): implement DecodeSingle, GetGaplessDecode and GetCodecInfo
sceAjmBatchJobDecodeSingle runs a single-frame decode job with the stream
sideband. sceAjmBatchJobGetGaplessDecode and sceAjmBatchJobGetCodecInfo
append run jobs without buffers that return the gapless-decode and codec-info
sidebands.

A run job without input or output buffers no longer decodes: it reports the
instance state with a zero result instead of PARTIAL_INPUT on MP3 and Opus.

RUN_GET_CODEC_INFO (bit 11) writes the ATRAC9 codec info after the gapless
sideband. Codec info for other codecs, and codec info together with
RUN_MULTIPLE_FRAMES, throw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 05:55:12 +05:30
Dean e440e2c22b Merge pull request #579 from CnRJay/fix/ampr-wait-signatures
fix(libs): take the AMPR wait and counter signatures from ampr_emu
2026-10-05 13:20:59 +13:00
Pouare514 20cbc8e306 fix(prx): keep main's GetConnectionStatus body and Http blank line untouched 2026-10-05 02:18:52 +02:00
DotDebianandClaude Opus 5.5 da9752bd5f feat(shader): implement buffer_atomic_csub
MUBUF opcode 0x34 subtracts the data register from a buffer dword and
clamps the result to zero, returning the previous value. The form without
glc throws: no GFX10 target is known to provide it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 02:15:47 +02:00
Pouare514 ac7bc704c3 fix(prx): export tripwire NIDs under recomputed real names, restore main's hunks 2026-10-05 02:13:22 +02:00
Pouare514 66a95ada20 feat(prx): unknown loader tripwires for TLOU 2026-10-05 02:12:32 +02:00
hamb3randsaulo benigno a347b02b48 feat(pad): map Xbox View button to PS5 touchpad
Controllers other than DualShock 4 and DualSense lack a dedicated touchpad button. Maps the SDL Back button (View on Xbox) to PadButton::TouchPad for non-PlayStation controllers.

Co-Authored-By: saulo benigno <[email protected]>
2026-10-05 03:11:15 +03:00
hamb3randsaulo benigno c2fa7fd97f fix(avplayer): add decode-ahead buffers for application video output
When an application requests only 2 video buffers and holds one during playback, decode-ahead frames allow the decoder to stay ahead and prevent stalls under SyncModeNone.

Co-Authored-By: saulo benigno <[email protected]>
2026-10-05 03:10:07 +03:00
ChadandClaude Opus 5.5 e017894bb4 fix(agc): free per-thread driver state at thread exit without emutls
On MinGW, thread_local storage is emutls: libgcc frees a thread's blocks
from a winpthread key destructor when the thread function returns, and
the CRT runs the thread_local destructors later, from the module's TLS
callback at thread detach. The destructors of the driver's non-trivial
thread_locals (the deferred label queue, packet profile, capture and
revalidation scratch vectors, build profile, memory counters, disk cache
buffers) therefore ran on freed storage. Under the debug heap the flip
test failed on every run at the queue worker's exit after the injected
flip failure; without it the use-after-free showed up as intermittent
heap corruption or a stack overflow on the Windows CI job.

ShaderRecompiler::ThreadOwned keeps such state behind a trivially
destructible thread_local pointer and deletes it from its own pthread key
destructor, which receives the objects directly instead of reading
emutls. The driver no longer registers any thread_local destructor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 19:08:54 -05:00
hamb3randsaulo benigno 3b2edec285 fix(video): set per-monitor v2 DPI awareness on Windows
Avoid Windows DPI virtualization so SDL, the drawable and the swapchain use physical pixels.

Co-Authored-By: saulo benigno <[email protected]>
2026-10-05 03:08:42 +03:00
DotDebianandClaude Opus 5.5 bfe9bf9af4 fix(pngenc): restrict adaptive filtering to the requested filter subset
A filter_type naming a subset of the PNG filters used only the first
filter of the mask, because stb's writer is either fully adaptive or
forced to one filter. Decoder::Png::Encode now takes the set of allowed
filter types, filters the rows and writes the chunks itself, and keeps
stb for deflate only. Output for the all-filters and single-filter
cases is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 02:08:31 +02:00
Nicolas Abosch f1d8ec8913 fix(shader): isolate wave32 operations in wide host subgroups 2026-10-04 21:02:46 -03:00
DotDebianandClaude Opus 5.5 e11b4b5554 feat(relinker): lower SHA-1 instructions with a memory operand
SHA1RNDS4/NEXTE/MSG1/MSG2 with a memory source made `--to-intel` fail
the whole relink. The stub now spills a scratch xmm, loads the operand
into it with the unaligned load already used for SHA-256 and runs the
register-form lowering. The SHA1RNDS4 immediate is read after the SIB
byte and displacement. RIP-relative operands still fail: the stub runs
at a different address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 02:02:13 +02:00