Commit Graph

1000 Commits

Author SHA1 Message Date
boykopovar c19448f834
Merge pull request #214 from oneandonlydean/fix/recompiler-sdwa-dword-dst
fix(recompiler): zero the high half of 16-bit SDWA results written as a whole dword
2026-10-01 21:27:50 +03:00
boykopovar e6a0af7e09
Merge pull request #213 from arreina/pr/cache-empty-memcpy
fix(shader): skip the push constant copy when there is nothing to copy
2026-10-01 21:22:29 +03:00
boykopovar b99472f7a6
Merge pull request #211 from ljkx/fix/decoder-rex-prefix-order
fix(relinker): ignore a REX prefix that is followed by another prefix
2026-10-01 21:21:44 +03:00
boykopovar de49f81697
Merge pull request #143 from SamG-Coder/codex/shader-geometry-validation
fix(shader): preserve NGG passthrough and wave32 launch inputs
2026-10-01 21:17:52 +03:00
boykopovar cfb1d76e60
Merge pull request #142 from SamG-Coder/codex/shader-interpolation-operands
fix(shader): preserve interpolation instruction operands
2026-10-01 21:17:16 +03:00
boykopovar cbf2bde178
Merge pull request #141 from SamG-Coder/codex/bounded-shader-jump-tables
feat(shader): lower bounded PC-relative jump tables
2026-10-01 21:16:14 +03:00
Dean Galvin b37365d2dd fix(recompiler): zero the high half of 16-bit SDWA results written as a whole dword
A 16-bit VOP1/VOP2 result in SDWA form with dst_sel:DWORD writes the whole register, so with
dst_unused:UNUSED_PAD the high half is zero. write16Bits treated dst_sel:DWORD as the plain
encoding and kept the old high half, which is right only for the non-SDWA form (GFX10 16-bit
instructions preserve the high bits). The decoder already marks SDWA destinations with
explicitSdwaDst; write16Bits now sends those through writeRawU32 like the other selectors.

GFX10 compilers rely on this to zero-extend f16 results before packing two of them with an
integer add, e.g. v_cvt_f16_f32_sdwa ... dst_sel:DWORD dst_unused:UNUSED_PAD followed by
v_lshl_add_u32 v2, hi, 16, lo. PPSA21564's FidelityFX depth-of-field combine pass packs its
near/far colours into LDS this way 60 times: whatever the low register held before leaked
into the high half, so green (and alpha) of the packed pairs came back huge or infinite while
red and blue stayed right. The bloom then spread the bad green over the intro cinematic.

agc_driver_sdwa_destination_tests runs the padded, preserved and plain encodings and the
packing idiom on the GPU against a model of the guest instructions.
2026-10-02 01:07:59 +13:00
Alberto Ruiz cc3d2d21ef fix(shader): skip the push constant copy when there is nothing to copy
decodeResult and decodeAllocation called memcpy with the data() of
empty vectors, which may be null. Passing a null pointer to memcpy is
undefined even for a zero size, and UBSan reports it on every entry
without push constants, including the existing shader disk cache test.
The copy now runs only for a non-empty table, as Reader::Values does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R5WJS4ZdQynAJesCZKH5hb
2026-10-01 13:28:36 +02:00
ljkx d54dfb1595 fix(relinker): ignore a REX prefix that is followed by another prefix
In 64-bit mode a REX prefix only takes effect when it immediately
precedes the opcode; a REX followed by a legacy prefix or another REX is
ignored. The instruction decoder, the rewriter's reference classifier,
DecodedInstruction and the SSE4a, SHA-256 and CLZERO operand decoders
read legacy prefixes and then at most one REX. `48 F3 0F 2B 00`
(MOVNTSS) was therefore scanned as `[48 F3][0F 2B 00]` and kept, and
`48 67 0F 01 FC` lost its address-size prefix.

All of them now accept REX bytes among the prefixes and keep only one
that directly precedes the opcode. The converter's guard against
prefix-only fragments is removed, since the decoder no longer produces
them, and the TechnicalDebt entry describing the split is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 13:09:11 +02:00
boykopovar bc51b337ad
Merge pull request #148 from SamG-Coder/codex/shader-corpus-instructions
feat(shader): support 24-bit high products and fix image sample variants
2026-10-01 13:45:19 +03:00
SamG-Coder 5bcb6eae3e fix(shader): version passthrough requests after upstream pixel layout 2026-10-01 20:44:28 +10:00
SamG-Coder d9482ea3ae fix(agc): exclude hidden mesh words from vertex table lookup 2026-10-01 20:44:28 +10:00
SamG-Coder 4cd8e35366 fix(shader): preserve NGG passthrough launch and primitive inputs 2026-10-01 20:43:17 +10:00
boykopovar 131156c5d0
Merge pull request #209 from ljkx/feat/clzero-to-intel
feat(relinker): lower CLZERO for --to-intel
2026-10-01 13:43:09 +03:00
SamG-Coder 785c24e652 fix(shader): derive mesh launch state from guest wave size 2026-10-01 20:42:49 +10:00
SamG-Coder 7fea9dec9b test(agc): build mesh smoke test on Windows 2026-10-01 20:42:49 +10:00
boykopovar c088b87399
Merge pull request #210 from boykopovar/refactor/agc-driver-exec-cpp
Refactor/agc driver exec cpp
The driver for the libSceAgcDriver library written in #5 turned out to be at least four times more performant than the one originally included in the project. However, the Driver.cpp file turned out to be too large; it is now split into multiple files located in subfolders (the include structure is the same). The behavior remained unchanged.
2026-10-01 13:38:50 +03:00
SamG-Coder dfdbeae901 fix(shader): preserve comparison image flags in disk cache 2026-10-01 20:36:28 +10:00
boykopovar 4a82f04113 refactor(agc): organize driver modules into subdirectories 2026-10-01 13:31:24 +03:00
ljkx 09cb86b076 feat(relinker): lower CLZERO for --to-intel
Lower CLZERO out of line instead of failing the relink: the 64-byte line
containing rAX (EAX with 67h) is cleared with four MOVNTDQ stores of
zero, the same non-temporal, weakly ordered store. The line address is
masked in xmm0 so RFLAGS stays untouched; xmm0 and rcx are spilled below
the red zone. Short sites share stubs through MatchSequence. CLZERO with
LOCK, an FS/GS override, a 66/F2/F3 prefix or longer than 15 bytes fails
the relink.

The decoder splits a REX followed by another prefix into a separate
instruction, which would hide a prefix that changes what CLZERO or the
next instruction does. The converter now fails the relink when such a
prefix-only fragment directly precedes an AMD-only instruction or would
be moved into a stub as a trailing instruction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 12:30:35 +02:00
boykopovar 98b175f938 refactor(agc): fix deps after splitting 2026-10-01 13:24:48 +03:00
SamG-Coder 7bcde3ba95 fix(tools): count tested shared shader instruction variants 2026-10-01 20:23:58 +10:00
SamG-Coder f5e1fcfad3 fix(agc): bind native depth textures for comparison sampling 2026-10-01 20:23:58 +10:00
SamG-Coder ba22c37d17 fix(shader): preserve constant offsets in image sampling 2026-10-01 20:23:21 +10:00
SamG-Coder 70cb9e2eaf feat(shader): translate signed and unsigned 24-bit high products 2026-10-01 20:23:21 +10:00
SamG-Coder 1571ec6914 feat(shader): lower bounded PC-relative jump tables 2026-10-01 20:19:03 +10:00
boykopovar 719b9328b3 refactor(agc): split driver into logical modules 2026-10-01 13:18:40 +03:00
SamG-Coder c329ad26b7 fix(shader): preserve upstream parameter validation during interpolation 2026-10-01 20:15:52 +10:00
SamG-Coder a8311e9d1a fix(shader): preserve interpolation instruction operands 2026-10-01 20:11:53 +10:00
boykopovar c7fb2575a3
Merge pull request #208 from boykopovar/refactor/split-libs-tests-cmake
Refactor/split libs tests cmake
- Moved test inclusions from `core/libs/CMakeLists.txt` to local library CMakeLists.txt files.
- Created CMakeLists.txt files for `libSceSystemService, libSceContentExport, libSceNet, libSceNetCtl, libSceRandom, libSceRtc, libSceJson2, and libSceFiber`.
- The shared libSceNet/libSceNetCtl test is included in libSceNet.
- Added the shared function add_test_executable for hosting test executables.
- Added add_png_decoder(target runtimeTarget) and add_jpeg_decoder(target runtimeTarget). The runtimeTarget parameter is required; libc is currently passed. A non-existent target causes a CMake error. - The decoder is used by the PRX libraries, meaning exceptions from there should be thrown through our libc.prx.

Changed file locations relative to the build folder (previously they were stored in core/libs):
- tests/ - all test executables
- `core/libs/libs/implib/` - PRX import libraries (*.dll.a)

The number of tests found has not changed (88)
2026-10-01 12:55:05 +03:00
boykopovar f694c1387c
Merge pull request #201 from ljkx/feat/monitorx-mwaitx-to-intel
feat(relinker): lower MONITORX and MWAITX for --to-intel
2026-10-01 12:50:04 +03:00
boykopovar bbba29ea61 refactor(cmake): add local library configs and move test definitions 2026-10-01 12:44:01 +03:00
boykopovar a32715f71f refactor(cmake): require explicit runtime target for png and jpeg decoders 2026-10-01 12:38:06 +03:00
boykopovar 867167e2ff refactor(cmake): move prx.a import libraries to implib directory 2026-10-01 12:32:22 +03:00
boykopovar 61ba4d661a refactor(cmake): place all test executables in build tests directory 2026-10-01 12:28:06 +03:00
boykopovar b22ede6c93 refactor(cmake): move some libs test definitions to local cmakelists 2026-10-01 12:21:46 +03:00
boykopovar 96c55bba3f
Merge pull request #98 from SamG-Coder/codex/videoout-vblank-timing
fix(runtime): run converted SDK samples through clean C++ shutdown
2026-10-01 12:08:10 +03:00
SamG-Coder a6ea90b919 fix(libc): reject unsupported format extensions explicitly 2026-10-01 12:00:50 +03:00
SamG-Coder 4e2b200a91 fix(libc): invoke guest exit callbacks with the SysV ABI 2026-10-01 12:00:49 +03:00
SamG-Coder d9d34a47ac fix(libc): translate guest scanning and wide formatting arguments 2026-10-01 12:00:41 +03:00
SamG-Coder 3a651055bb feat(libc): support C locale wide stream input 2026-10-01 11:59:11 +03:00
SamG-Coder 7f834fc415 feat(libc): add C locale conversion and sample runtime exports 2026-10-01 11:58:51 +03:00
SamG-Coder ad6b37ed42 fix(relinker): resolve guest dependencies and lifecycle arrays 2026-10-01 11:57:13 +03:00
SamG-Coder 3c5fe188b7 fix(relinker): forward Windows arguments to guest startup 2026-10-01 11:57:13 +03:00
boykopovar 8cc16ec23a
Merge pull request #184 from YossiYad/fix/self-input-diagnostic
fix(relinker): name the SELF container and the bytes read when the input is not an ELF
2026-10-01 11:53:18 +03:00
Yossi Yadgar 058ba1e08d fix(relinker): name the SELF container and the bytes read when the input is not an ELF 2026-10-01 11:47:55 +03:00
boykopovar e57ee5120d
Merge pull request #206 from Praetorian0420/main
Implement network control and socket functionality improvements
2026-10-01 11:41:41 +03:00
ljkx f994b4f89f feat(relinker): lower MONITORX and MWAITX for --to-intel
Replace MONITORX with a NOP and MWAITX with PAUSE in place, padded with
NOPs to the original length, instead of failing the relink. MWAITX may
return before its timer or a store to the monitored line, and without an
armed monitor it does not wait, so callers already re-check their
condition; the replacement takes that path every time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 10:35:23 +02:00
boykopovar 63071deb03
Merge pull request #205 from oneandonlydean/fix/recompiler-fma-mix-op-sel
fix(recompiler): select v_fma_mix source precision by OP_SEL_HI and the half by OP_SEL
2026-10-01 11:32:45 +03:00
boykopovar db5ce0f83c
Merge pull request #204 from oneandonlydean/fix/agc-misaligned-buffers-in-shader-data
fix(agc): patch the memory offsets of misaligned guest buffers in the shader data buffer
2026-10-01 11:31:57 +03:00