Commit Graph

904 Commits

Author SHA1 Message Date
Adrià c20184aba7
Merge pull request #2162 from CouchRiv/fix-shader-fma-mix-f16-fused
fix(shader): round v_fma_mixlo_f16 and v_fma_mixhi_f16 once to f16
2026-10-10 08:46:56 +02:00
Adrià d43d50beb1
Merge pull request #2322 from jweidenh/codex/last-provoking-vertex
feat(agc): support last provoking vertex for native primitives
2026-10-10 08:36:55 +02:00
Alex 3a9da568fe fix(shader): round v_fma_mixlo_f16 and v_fma_mixhi_f16 once to f16
The f16 forms of v_fma_mix computed an f32 FMA and converted it to f16,
so a result that lands on an f16 tie after the f32 rounding was rounded
twice. RDNA2 rounds the exact product-sum once. They now use the exact
f64 path of v_interp_p2_f16 and flush f32 sources like v_fma_mix_f32.
They follow the f16 round and denormal fields on hardware, so another
f16 mode throws, as packed f16 does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 08:33:43 +02:00
Adrià 55a631bb4a
Merge pull request #1281 from SirDarky/fix/shader-mad-legacy-rounded-product
fix(shader): round the v_mad_legacy_f32 product before the add
2026-10-10 08:31:19 +02:00
Adrià 0aaadd6457
Merge pull request #1599 from andrey231/fix/storage-keep-baseline
fix(agc): store GPU results over CPU-stamped bytes the CPU left unchanged
2026-10-10 08:28:10 +02:00
Adrià 23ed501f4a
Merge pull request #1511 from cubersu/fix/libc-swprintf-wcsrtombs-utf16
fix(libc): format guest wide strings in swprintf as 16-bit units
2026-10-10 08:26:15 +02:00
jweidenh 3a8cf3a38b feat(agc): support last provoking vertex for native primitives 2026-10-10 08:26:14 +02:00
Adrià b5315f046d
Merge pull request #2381 from SleglJan/docs/shader-scalar-measurements
docs(shader): record the measured s_call_b64 and null s_swappc_b64 behaviour
2026-10-10 08:25:58 +02:00
Adrià 1a668689d6
Merge pull request #2133 from queeeef/fix/agc-3d-access-on-2d-texture
fix(shader): bind 2D textures to 3D sample and load accesses as measured
2026-10-10 08:25:22 +02:00
Adrià 530b6a4270
Merge pull request #2226 from EdouardSence/fix/agc-conservative-uncertainty-disabled
fix(agc): accept disabled conservative rasterization with uncertainty-region bits
2026-10-10 08:20:08 +02:00
Marcus 5377db48fd fix(shader): round the v_mad_legacy_f32 product before the add
VOP3 0x140 is v_mad_legacy_f32 on gfx10.1. Measured on gfx1010 (RX 5700
XT) in wave32 and wave64, IEEE 0 and 1 and f32 denormal modes 0 to 3, it
rounds the product before the add, flushes f32 denormal sources, product
and result in every mode, and gives a +0 product for a zero factor.

The translation multiplies, applies the zero rule and flushTinyProduct,
adds, and keeps the nanResultF32 wrapper. f32DenormalFlushFor returns 3
for the instruction before reading FLOAT_MODE. A sum of two zeros takes
its sign on the bits, as lavapipe returned -0 for +0 + -0. The execution
test pins the measured results and compares NaN bits exactly. RDNA2
(gfx1031), where the encoding is v_fma_legacy_f32 and fused, is noted in
TechnicalDebt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 08:18:55 +02:00
Adrià accf6bffc5
Merge pull request #2477 from itsbo5/feat/libScePad-bias-correction
feat(libScePad): implement scePadSetAngularVelocityBiasCorrectionState
2026-10-10 08:18:16 +02:00
Adrià 3064754c6a
Merge pull request #1547 from russhil/feat/shader-barycentric-emulation
feat(shader): emulate fragment barycentrics with a generated geometry stage
2026-10-10 08:15:00 +02:00
Adrià 40aeb97d57
Merge pull request #1152 from alfalfa-star/perf/linux-direct-memory-import-chunks
perf(agc): share one dma-buf import per 64 MiB of Linux direct memory
2026-10-10 08:14:40 +02:00
Adrià dacb0cdd28
Merge pull request #2137 from Sanjaysrinivas/feat/mesh-wave32
fix(shader): support wave32 mesh programs
2026-10-10 08:13:11 +02:00
Adrià 9bb5619c83
Merge pull request #2045 from CouchRiv/fix-shader-div-fixup-flush
fix(shader): flush v_div_fixup_f32 src1 and src2 denormals
2026-10-10 08:12:41 +02:00
Adrià ccedc3a891
Merge pull request #1947 from oguzhanozfe/fix/audio-propagation-singular-path
fix(audio): recognize individual propagation path import
2026-10-10 08:12:21 +02:00
Adrià 692c397a6c
Merge pull request #1854 from Sanjaysrinivas/fix/shader-mode-registers
fix(shader): guard runtime MODE changes
2026-10-10 08:12:00 +02:00
Adrià 0f84feff1d
Merge pull request #2000 from hansjm10/fix/shader-f16-fma-single-rounding
fix(shader): round the f16 fused multiply-adds once
2026-10-10 08:08:00 +02:00
Adrià 473e64bc8c
Merge pull request #1860 from overlordxrz-source/feat/libkernel-shm-open
feat(libkernel): implement shm_open for anonymous objects
2026-10-10 08:07:24 +02:00
Adrià ffd80d7c6a
Merge pull request #2011 from CouchRiv/fix-shader-pk-minmax-clamp-dx10
fix(shader): clamp packed f16 min/max signaling NaN results to zero
2026-10-10 08:07:16 +02:00
turkishcuber a3186c59ef fix(libc): format guest wide strings in swprintf as 16-bit units
The padded, exact-fit and invalid-conversion swprintf checks come from #1512.

Co-Authored-By: Noface07 <yuvrajsoni7@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULF8vCbJFyzxVsW3SfiWC5
2026-10-10 08:04:44 +02:00
Adrià e0526f57cd
Merge pull request #1686 from Cloud-Multiplayer/feat/macos-write-watch
feat(libc): write watch on macOS hosts
2026-10-10 08:03:40 +02:00
Adrià 29b4429870
Merge pull request #1485 from Celegans12/feat/agc-10-11-11-unorm-color-targets
feat(agc): implement 10_11_11 unorm color targets through 32-bit uint attachments
2026-10-10 07:58:55 +02:00
Adrià a2236210c3
Merge pull request #1605 from QRMOE/fix/shader-bitfield-mask-overflow
fix(shader): truncate overflowing 32-bit bitfield masks
2026-10-10 07:58:20 +02:00
Dean 903863c974
Merge pull request #959 from JAB-dev/feat/ngs2-pan
feat(libSceNgs2.native): implement sceNgs2PanInit and sceNgs2PanGetVolumeMatrix
2026-10-10 18:53:48 +13:00
Dean 001124896d
Merge pull request #2470 from oneandonlydean/up639/cmask-gpu-clear
fix(agc): apply CMASK fast clears per tile
2026-10-10 18:36:56 +13:00
Adrià Franch 7dec9c9fd8 docs(technical-debt): record the unchanged-bytes baseline of storage write-back
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-10 07:36:34 +02:00
Dean 0949984e5e
Merge pull request #1945 from TacoCat055/docs/relinker-python-tests
docs: explain relinker Python test discovery
2026-10-10 18:36:32 +13:00
Dean c323d49386
Merge pull request #2052 from esatturan/fix/ajm-atrac9-gapless-segments
fix(ajm): decode an ATRAC9 run's whole input and follow gapless segments
2026-10-10 18:36:09 +13:00
Dean 14469b74e8
Merge pull request #964 from JAB-dev/fix/ngs2-unset-matrix-passthrough
fix(libSceNgs2.native): mix ports without set levels through the default channel map
2026-10-10 18:36:02 +13:00
Dean Galvin 9c3a35b867 fix(agc): apply CMASK fast clears per tile
A CMASK that was neither all fast-cleared nor all expanded threw, so a
title that fast clears a target and then draws over part of it before the
eliminate could not run past it.

The CMASK is now decoded tile by tile: one nibble per 8x8 tile in
1024x512 metablocks of 4 KiB, addressed with the pipe-aligned
SW_64KB_Z_X CMASK equation for 16 pipes (addrlib
GFX10_CMASK_SW_PATTERN, Gfx10Lib::HwlComputeCmaskAddrFromCoord). Code 0
stores CB_COLOR_CLEAR_WORD into the tile's texels, 0xF keeps them; any
other code, a cleared tile of a DCC target and any other CMASK swizzle
mode throw. Edge tiles are included and the CMASK is then stored as
expanded.

For a resident target whose CMASK is host-imported the clear is a
compute pass recorded in stream order: it reads the nibbles from the
import, stores the clear into the cleared tiles through a UINT view of
the image and fills the CMASK expanded, so nothing waits for pending GPU
writes of the CMASK. Invalid codes it reads set a bit that the next
materialization throws on. Otherwise the CPU reads the CMASK and stores
the cleared tiles into guest memory, or fills the resident image when
every tile is cleared. A CMASK nothing has stored over since it was
expanded is skipped.

The decode requires CB_COLOR_ATTRIB3 FMASK_SW_MODE SW_64KB_Z_X with
CMASK_PIPE_ALIGNED, a 4 KiB aligned writable CMASK and texels of at most
64 bits, and CMASK_BASE_EXT is part of the draw key.

Tests: CMASK sizes and nibble addresses against addrlib; decode
rejections and draw key coverage; CPU eliminate of full, partial,
out-of-range-nibble and DCC decompress cases and invalid codes. The new
agc_driver_cmask_fast_clear GPU test draws over fast-cleared and partly
fast-cleared linear and SW_64KB_R_X targets, eliminates partial, edge
and checkerboard CMASKs through the compute pass and checks that an
invalid code it reads throws.
2026-10-10 18:20:06 +13:00
Jan Šlégl 9376a0291a docs(shader): record the measured s_call_b64 and null s_swappc_b64 behaviour
Measured on RDNA2 (gfx1036) with tools/hw-oracle in wave32 and wave64:
s_call_b64 writes PC + 4 to the link pair and branches to
PC + 4 + signext(SIMM16) * 4, and s_setpc_b64 of the link returns;
s_swappc_b64 with SDST 125 branches and leaves a marker pair untouched, so
its decode as s_setpc_b64 matches, and with an SGPR destination the link is
PC + 4.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GLfKH7Sqe51wX254k1XsV
2026-10-10 06:46:53 +02:00
Dean ac57f46711
Merge pull request #2275 from mrk1987/fix/libkernel-rwlock-concurrent-first-lock
fix(libkernel): initialize guest rwlocks before they are shared
2026-10-10 17:46:25 +13:00
Dean e2ba429015
Merge pull request #2243 from NumberGuan/codex/protect-relinker-inputs
fix(relinker): protect executable inputs from output overwrites
2026-10-10 17:45:47 +13:00
Dean ea8f654350
Merge pull request #2178 from oneandonlydean/up639/resummarize-blits
fix(agc): draw nothing for resummarize draws without depth or color work
2026-10-10 17:44:46 +13:00
Dean b57e66fa60
Merge pull request #2152 from MathiasDevelopes/feat/videoout-pre-vblank-start-events
feat(libSceVideoOut): deliver pre-vblank start events
2026-10-10 17:44:23 +13:00
Dean 9ac075e8c0
Merge pull request #1926 from fisherjoey/fix/exit-teardown-order
fix(ajm, apr): keep AJM and APR state alive through static teardown
2026-10-10 17:42:42 +13:00
Dean de723ac54b
Merge pull request #1804 from gdrosa/fix/libc-guest-wide-printf
fix(libc): format guest wide printf arguments on Linux
2026-10-10 17:41:26 +13:00
Dean 5b6c778a95
Merge pull request #1769 from TideOPL/pr/stride0-raw-range
fix(agc): apply the raw OOB_SELECT range rules to zero-stride vertex buffers
2026-10-10 17:41:11 +13:00
Dean a8ce7b7e21
Merge pull request #1727 from SleglJan/feat/libkernel-socket-read-write
fix(libkernel): read and write guest sockets
2026-10-10 17:41:03 +13:00
Dean 70e66d8efa
Merge pull request #1688 from johnmaia/fix/agc-udmabuf-permission
fix(agc): name the reason when /dev/udmabuf cannot be opened
2026-10-10 17:40:48 +13:00
Dean 9fd45aa4fb
Merge pull request #1632 from MarcZX100/fix/amd-proprietary-subgroup-clock
fix(agc): detect AMD proprietary narrow clock
2026-10-10 17:40:02 +13:00
Dean 17874f1177
Merge pull request #2044 from CouchRiv/fix-agc-completion-label-pm4
fix(agc): store labels the GPU cannot reach in stream order
2026-10-10 17:16:19 +13:00
Adrià Franch 090a30ca93 docs(debt): end the 3D-on-2D image access line with a period
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-10 05:17:16 +02:00
Daan Dehing 70d190cdd5 fix(shader): bind 2D textures to 3D sample and load accesses as measured
A 3D image access bound to a 2D T# matched no runtime image mode and
threw "image descriptor is incompatible with the static runtime image
interface" (Sonic Origins, #2023). CouchRiv measured RDNA2 (gfx1036)
with the hardware oracle: image_sample_lz with dim 3D ignores r and
reads the (u,v) texel, and image_load reads the (x,y) texel when z is
0 and returns zero otherwise. Add a 2D mode for 3D accesses whose only
uses are those two forms, and make the load return zero for z != 0.
Every other access keeps throwing.

Fixes #2023

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 05:15:30 +02:00
Joey Fisher 78388c247e docs(debt): record the deliberately leaked AJM, APR and NGS2 state 2026-10-09 20:14:14 -06:00
overlordxrz-source e607b1ce4e feat(libkernel): implement shm_open for anonymous objects 2026-10-09 22:05:57 -04:00
Oguzhan Ozdemir 2e01ba2832 fix(audio): bind singular propagation path setter as unsupported 2026-10-10 03:50:02 +02:00
russhil 4a2e60546c feat(shader): emulate fragment barycentrics with a generated geometry stage
Without VK_KHR_fragment_shader_barycentric the recompiler dropped
v_interp_p1_f32 and made v_interp_p2_f32 read the attribute Vulkan
interpolated, but never wrote the I/J VGPRs: a pixel shader that read
them for anything else got 0, and v_interp_mov_f32 of P10/P20 (or P0 of
an interpolated input) needed PerVertexKHR and failed pipeline
validation.

The fallback translation now loads the I/J VGPRs and marks v_interp_p1
and v_interp_p2 with witnesses. After the front-end simplification
(SSA, folding, DCE, read-lane and masked-select elimination),
HostInterpolationChecker requires every p2 to read its J, and its p1's
I, from a barycentric of the parameter's kind, every p1 result to reach
only the matching p2 (through a write masked by the p2's EXEC, whose
inactive lanes keep the old register), no parameter read as raw
vertices and no slot shared by different interpolations. It then
lowers the witnesses to the host-interpolated attribute as before,
reruns DCE and masked-select elimination, and accepts the program only
when no barycentric read remains, so reusing the I/J VGPRs after
interpolating keeps host interpolation and the previous SPIR-V. Any other
program is translated with the barycentric path and marked as emulated:
its barycentrics become vec3 inputs (NoPerspective for the linear
weights) and its per-vertex parameters flat vec4[3] inputs, placed in
the free locations by LayoutBarycentricEmulation. The driver then
inserts a generated geometry stage between the vertex and fragment
shaders that copies the position and parameters, writes the one-hot
weights of each vertex and the three vertices' parameter values, so the
rasterizer interpolates the same weights the extension provides.

The stage needs geometryShader and a vertex shader before it;
tessellation, mesh and rect-list pipelines, other primitive types and
interfaces beyond 32 locations or the device's geometry limits throw.
CompiledShaderArtifact carries the emulation (shader disk cache format 21).

Hardware snaps window corners to 1/256 pixel before interpolating
(measured by yahya308 on an RTX 4070 Laptop and a Radeon 780M in #1547);
lavapipe snaps only for coverage (lp_rast.h FIXED_ORDER 8), so the test
accepts either reference per pixel at the original 1e-4 margin.

Sources:
- v_interp_p1_f32/v_interp_p2_f32/v_interp_mov_f32 semantics (P0,
  P10, P20, I/J): AMD RDNA2 ISA, "Parameter Interpolation".
- BaryCoordKHR/BaryCoordNoPerspKHR weights and PerVertexKHR vertex order:
  SPV_KHR_fragment_shader_barycentric, VK_KHR_fragment_shader_barycentric.
- Geometry shader triangle input order and provoking vertex: Vulkan
  specification, "Primitive Topologies" and "Geometry Shading".
- Interpolation decorations decided by the fragment input: Vulkan
  specification, "Interpolation Decorations".
- lavapipe interpolation: Mesa src/gallium/drivers/llvmpipe/lp_rast.h
  (FIXED_ORDER 8), lp_setup_tri.c (subpixel_snap for coverage only),
  lp_state_setup.c (init_args, plane setup from float positions).
2026-10-10 03:24:50 +02:00