Commit Graph
50459 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 b62bcc9e12 Vulkan: Allow it on Motorola's PowerVR BXM-8-256 phones with any driver
The entry hid the Vulkan option on those (Moto G54 and similar) with drivers before 0x005d9576, for the crash
in #18681. Vulkan is the default there, and works on a G54 with that driver. The list is only used on Mac
now, so it and its check are only built there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 23:05:36 +01:00
Henrik RydgårdandClaude Opus 5.5 5a5c11f984 Headless: Print the number of pipelines created
Vulkan and Metal pipelines, and OpenGL programs, including those precompiled from the shader cache. Benchmark
times include the compiles, so this shows when two builds differ in how many they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 23:05:36 +01:00
Henrik RydgårdandClaude Opus 5.5 77e417e59f CrossSIMD: Make the Store functions const
They only write to the destination.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 23:05:36 +01:00
Henrik Rydgård c68f43c731 Merge pull request #22911 from hrydgard/texcache-index
TextureCache: Find the textures a block transfer overlaps through a flat index
2026-11-04 19:28:05 +01:00
Henrik Rydgård 9366aa7dc2 Merge pull request #22933 from hrydgard/more-ui-work
Fix a bunch of UI bugs
2026-11-04 19:12:03 +01:00
Henrik RydgårdandClaude Opus 5.5 324f608a94 TextureCache: Keep the range index and the map together in a TexCacheMap
The map is only handed out const, and entries only come and go through Insert(), Erase(), Release(), Clear()
and SetBufw(), which keep the index in step. Before, every place that changed cache_ had to update the index
by hand, and one that didn't would leave a dangling pointer for the next block transfer to write through.
A new entry now gets the fields its range needs before it goes in, and the slot of one going to the
secondary cache is erased right away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:59:56 +01:00
Henrik RydgårdandClaude Opus 5.5 3863e2f90f TextureCache: Find the textures a block transfer overlaps through a flat index
Invalidate() runs for every block transfer, and walked the cache_ map from 1 MB before the address,
setting a flag on the few textures that overlap. MX vs. ATV Untamed does about a thousand a second,
each walking about 380 of its 745 textures to find six, and its one 1 MB texture means a tighter bound
on texture size wouldn't help.

Now an array of the textures' address ranges sits next to cache_, sorted by address, with textures
over 64 KB in a short list of their own, so a search only starts 64 KB back. It's updated wherever
an entry enters or leaves cache_ (including the moves to and from secondCache_) or changes its bufw.
It marks the same textures as the map walk did (compared on every call in MX vs. ATV, Wipeout Pure,
God of War: Chains of Olympus and Tekken 6). In MX on a Cortex-A53, Invalidate() went from 889
samples to 27.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:42:49 +01:00
Henrik Rydgård 9e972e0dd3 GameInfoCache: Parse the game ID out of save data. nice to display. 2026-11-04 18:29:51 +01:00
Henrik Rydgård 6baa0a9805 Fix issue in game tab settings with increase/decrease size. 2026-11-04 18:19:15 +01:00
Henrik Rydgård d0b271820a Make SasAudio addresses clickable 2026-11-04 18:14:33 +01:00
Henrik Rydgård 029d9582a0 Visual fixes on pause screen 2026-11-04 18:07:50 +01:00
Henrik Rydgård b5f91caae4 Windows app (not headless): Inform the user of bad command line parameters, but proceed. 2026-11-04 18:07:29 +01:00
Henrik Rydgård 3ca6ab6a79 Fix ImDebugger font screwup 2026-11-04 18:07:17 +01:00
Henrik Rydgård 9e78ef5677 Misc UI and cmdline parse work 2026-11-04 17:58:18 +01:00
Henrik RydgårdandClaude Opus 5.5 00e03ba9b4 NpAuth: Parse tickets in GetTicketParam the way the PSP does
The length (4 to 0x10000), the param number, the version (2.1 or 3.0) and
the body section type are checked in that order, and param 11 is never
found. Then the params are walked from the start, each one written to the
buffer as it goes, until the one asked for. A param that doesn't fit, or
whose type isn't the one that slot always has, fails with PARSER_FAILED and
leaves the previous value in the buffer. Numbers are read at full size
whatever length the param gives. All as in net/npauth/ticketparam.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:12:47 +01:00
Henrik RydgårdandClaude Opus 5.5 874c090824 sceHttp: Number ids per kind like the PSP, and check which calls take which
Templates, connections and requests each get their own numbers, with the
kind in the top byte (1, 0x01000001, 0x02000001), and a new object takes the
lowest free number. Resolve settings only apply to templates, the other
timeouts to templates and connections, and the response calls fail with
BEFORE_SEND until a send has succeeded. Deleting a connection that still has
requests fails, and CreateRequest no longer rejects unknown methods. Deleting
a header that isn't there returns NOT_FOUND. All as in net/http/ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:10:49 +01:00
Henrik RydgårdandClaude Opus 5.5 c5a51c084c VR: Don't reject a saved Vulkan backend before OpenXR is up
The config is validated before OpenXR is initialized, and VulkanMayBeAvailable
said no in VR until it was, so a saved Vulkan setting was always replaced by
the default ("Backend 3 not enabled"). Only say no once OpenXR is up without
Vulkan support. app-android checks again after initializing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 14:21:24 +01:00
Henrik Rydgård 3bc60270ea Merge pull request #22931 from hrydgard/parseuri-hardware-tests
sceParseUri: Rewrite the parser against hardware, and implement sceUriUnescape
2026-11-04 14:20:10 +01:00
Henrik Rydgård 148e9c82d2 Merge pull request #22930 from hrydgard/vblank-timing
sceDisplay/sceCtrl: Charge the vblank interrupt's and ctrl peeks' CPU time, as measured on hardware
2026-11-04 14:19:29 +01:00
Henrik RydgårdandClaude Opus 5.5 5a1d143ac2 VR: Restart in-process when changing the backend
A graphics restart recreates the activity, but on VR devices onDestroy
called System.exit, so the app just quit. The XR instance (created for the
old activity), the GL session (entered once per process) and the controller
input (bound to the first session) all outlived the activity.

Now the native shutdown takes OpenXR down (ShutdownVR: renderer, session,
instance), the new activity sets it up again, and the exit is skipped for
restarts. Input is created per session, which also keeps the controllers
working when Vulkan recreates its session with the graphics context. The
passthrough layer is destroyed with the renderer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:49:24 +01:00
Henrik RydgårdandClaude Opus 5.5 249b653962 VR: Fix inverted depth and GL gamma, keep the flat screen upright
- Depth was inverted on both backends: the VR shader replaced Z with the
  game's clip-space Z after the viewport transform, skipping its Z scale.
  Since the viewport transform moved into the shader, that's wrong. Replace
  it before the transform instead, as libretro already did.
- GL eye buffers are sRGB, and GLES encoded our sRGB colors again (too
  bright). Disable the encoding with GL_EXT_sRGB_write_control.
- Keep the flat screen upright instead of tilting it to the head's pitch at
  recenter time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:48:32 +01:00
Henrik RydgårdandClaude Opus 5.5 abe2203657 VR: Port the skyplane hack and VRForce to Vulkan
The Vulkan version edits the frame's steps in PreprocessSteps, like the GL
one does at replay: the first pass that doesn't sample another framebuffer
clears to the fog color, and indexed draws without depth test are dropped.

The shader generator test also builds the vertex shaders with the VR
uniforms now, for Vulkan and GLSL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:47:22 +01:00
Henrik RydgårdandClaude Opus 5.5 a81e6d61c9 VR: Run OpenXR on Vulkan, with both eyes in one multiview pass
The XR swapchain (one image layer per eye) replaces the main swapchain as a
VulkanPresentation, and the backbuffer pass is multiview in VR. The emu
thread begins each XR frame before NativeFrame, the render thread ends it
after submitting. VR uniforms (lens projection, right eye view, HUD scale)
follow the base uniform block on Vulkan, recomputed for every draw since
they depend on the draw being 2D and on the head pose. VR now defaults to
Vulkan.

On the Quest the swapchain is plain UNORM: a mutable sRGB one viewed as
UNORM showed snow along edges in its compositor. Poses that aren't valid
(no tracking yet) become identity, so layers aren't rejected.

See docs/vr-openxr-vulkan.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:46:39 +01:00
Henrik Rydgård 7b2860ec42 Add icon for VR settings 2026-11-04 11:41:53 +01:00
Henrik Rydgård ac31417b71 Merge pull request #22928 from hrydgard/softgpu-zero-normals
SoftGPU: Light zero normals by the sign of the last Bezier patch
2026-11-04 11:31:21 +01:00
Henrik RydgårdandClaude Opus 5.5 adba2ed1af NpAuth: Return the ticket param asked for, and write only what fits of a ticket
sceNpAuthGetTicketParam started reading after the body section, so it
copied the footer, and it concatenated the params before the one asked for
instead of returning that one. Like JPCSP, it now walks the params from the
start of the body and returns the value of the requested one (ints and
dates converted to PSP endianness, strings up to 255 bytes).

sceNpAuthGetTicket wrote its whole 248 byte ticket whatever the buffer
length. It now copies what fits, and still returns the ticket's size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 11:19:44 +01:00
Henrik RydgårdandClaude Opus 5.5 f6118a7978 sceHttp: Stop ids shifting on delete, check request types
- sceHttp ids were vector indices that shifted down on every delete, and
  the request calls cast any object to HTTPRequest. Deletes now leave an
  empty slot, and request calls check the type. A null header name or
  value no longer goes into a std::string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 11:15:25 +01:00
Henrik RydgårdandClaude Opus 5 96cda92669 sceParseUri: rewrite the parser against hardware, and implement sceUriUnescape
Nothing tested sceParseUri, and it showed. Measured on a real PSP by the new
net/parseuri tests:

- A URI without "//" was rejected outright, so mailto:, urn:, about: and even
  file:///tmp/x all failed. They parse fine; that is what noSlash is for.
- A fragment ended up appended to the path, because the code looked for "#"
  inside the query rather than the whole remainder.
- An empty path came back as "/", because Url insists on one.
- Ports take at most five digits and at most the value 65536, which wraps to
  zero; anything longer or larger is refused. A host runs while the characters
  are alphanumeric, dot or dash, so an underscore or a bracketed IPv6 address
  falls through to the path.
- The three error codes are real and specific - 80433060 bad URI, 804331FE no
  output pointer, 80433022 work area too small - where everything returned -1.
  Leaving out either area is a size query that succeeds.

So sceUriParse no longer goes through the Url class, which is built for HTTP and
has nowhere to put a fragment.

sceUriEscape kept the wrong two characters: hardware leaves "*" alone and escapes
"~", which is the other way round from RFC 3986. It also fills what it can before
reporting a buffer too small, and leaves the length output alone when it does.

sceUriUnescape was a null entry, so calling it got "library not linked". It is
implemented, including the odd positive return value - one per plain character
and five per escape - that the hardware hands back.

Also lists the two exports libparse_uri.prx has that we did not know about, so a
game calling one is named in the log rather than appearing as a bare NID.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-04 11:11:20 +01:00
Henrik RydgårdandClaude Opus 5.5 201e1be9ef SoftGPU: Light zero normals by the sign of the last Bezier patch
The GE keeps the sign of the z of the last Bezier patch's normal at its last
corner (flipped by patch facing, 0 when sideways or degenerate), and lights a
normal that is exactly zero as that sign times (1,1,1) in model space
(ppsspp-re geprobe exp226-253). Normals the tessellation generates don't take
it. Nayuta no Kiseki and Zettai Zetsumei Toshi 3 rely on it.

Frame dump playback draws a flat +z patch after INIT, as the PSP replayer does
before each replay, so both start from +1.

A run's chunks read the sign and the generated-normals flag, so changing either
waits for the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 11:07:23 +01:00
Henrik Rydgård c0479ac6f2 Merge pull request #22926 from hrydgard/libretro-depth-raster
libretro: Add the Lens flare occlusion (depth raster) option
2026-11-04 11:02:45 +01:00
Henrik RydgårdandClaude Opus 5.5 7af0b9d432 test.py: threads/scheduling/alarmcosts passes now
The test checks ranges instead of rounding on hardware's noise.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 10:41:00 +01:00
Henrik RydgårdandClaude Opus 5.5 58c009c07e Add the display/vblankphase and ctrl/peekcost tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 10:40:53 +01:00
Henrik RydgårdandClaude Opus 5.5 c7efd845b8 sceCtrl: Peeking costs more the more samples it copies
~2us plus ~0.2us per sample on hardware, 15us for 64 (pspautotests
ctrl/peekcost). We charged a flat 1.5us.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 10:40:42 +01:00
Henrik RydgårdandClaude Opus 5.5 5702b0f511 sceDisplay: Charge the vblank interrupt's CPU time, and count lines from 0
On hardware the vblank interrupt comes as the last line (285) ends, and
hcount wraps to 0 inside it. It takes ~66us of CPU from whatever runs, or
~78us with a handler, which runs ~29us in. It releases the vblank waiters
after the handlers, and they get the CPU once it's done: ~81us after it,
~91us with a handler, ~3us later for each extra waiter. The vblank ends
~818us after it (pspautotests display/vblankphase).

We charged nothing and released waiters from a separate event 48us after
the vblank, and hcount started at 1 because user code rarely sees line 0:
the interrupt takes most of it. Now the interrupt carries those costs, the
waiters are released inside it, hcount runs 0-285 over the real frame
length, and a thread that waits for the vblank pays the ~6us that makes
waiters take turns ~12us apart, as on hardware.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 10:40:41 +01:00
Henrik RydgårdandClaude Opus 5.5 e199241906 libretro: Add the Lens flare occlusion (depth raster) option
The app's iDepthRasterMode: Auto, Low, Off or Always on. Its default depends on the device (Low on
Android and iOS, Off without SIMD), which a core option can't express, so "Default" picks that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:30:47 +01:00
Henrik Rydgård 8f83f1ea16 Merge pull request #22925 from hrydgard/dualsrc-fallback
GPU: Write the stencil as alpha without dual source blending where the blend allows
2026-11-04 08:40:09 +01:00
Henrik Rydgård a2001917b2 Merge pull request #22919 from hrydgard/pvr-clip-cull-distance
Vulkan: Don't use cull distances on PowerVR
2026-11-04 01:02:06 +01:00
Henrik Rydgård 62d8696d5f Merge pull request #22914 from hrydgard/ignored-fault-storm
MemFault: Stop ignoring bad accesses after 1000 in one frame
2026-11-04 01:01:41 +01:00
Henrik RydgårdandClaude Opus 5.5 2027130763 GPU: Write the stencil as alpha without dual source blending where the blend allows
When the color blend uses the src alpha and the stencil has to be written as alpha, both need the alpha
output, so it took dual source blending, and without it the alpha came out wrong. Where the src alpha is
only in the src factor (SRCALPHA or INVSRCALPHA, with DSTALPHA, INVDSTALPHA or a fixed color for the
dst), the shader now applies the src factor (REPLACE_BLEND_PRE_SRC), which leaves the alpha output for
the stencil on every GPU. That's WipEout Pure's additive glows, among others. On a Mac (MoltenVK), none
of the 1,141 dumps in the frame dump collection change with dual source blending on. With it off,
God of War's black squares and one of WipEout Pure's shield dumps now match its render exactly, and
two more WipEout Pure dumps come closer (3,631 -> 2,793 and 4,642 -> 4,163 pixels off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:56:16 +01:00
Henrik RydgårdandClaude Opus 5.5 a41186c3b0 Vulkan: Don't use cull distances on PowerVR
On a BXM-8-256 (Moto G54), a vertex shader that writes both clip and cull distances doesn't get culled,
while either one alone works. Geometry the PSP culls got drawn: the ground in DBZ Tenkaichi Tag Team,
scenery in Monster Hunter 3rd. With cull distances off, those draws get clipped and culled on the CPU
instead, and the frame dumps match a desktop GPU's render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:28:32 +01:00
Henrik Rydgård aad016741c Merge pull request #22918 from hrydgard/claude-heredoc-hook
Agents: Refuse Bash heredocs with backslashes on Windows
2026-11-04 00:27:37 +01:00
Henrik Rydgård 4ea2f6506f Merge pull request #22916 from hrydgard/depth-raster-skip-list-end-wait
Depth raster: Wait for it before GE callbacks instead of at every list end
2026-11-04 00:07:02 +01:00
Henrik RydgårdandClaude Opus 5.5 e1deb5665c Depth raster: Wait for it before GE callbacks instead of at every list end
Since a37e1f3660, the CPU waits for the depth rasterizer every time a display list ends, because Syphon
Filter reads its depth buffer for the light flares right after. It reads it in the list's GE interrupt
callback though, and so do Wipeout Pure and Resistance: Retribution. On hardware the drawing is done
when that runs, so that's where to wait now, letting the worker overlap with the CPU until then.
sceGeDrawSync and sceGeListSync wait as before.

With interpreter loads from the depth buffer counted and the worker slowed down by 10-50 ms a batch,
no read in Syphon Filter: Logan's Shadow, Wipeout, Resistance or Midnight Club: L.A. Remix landed while
it was busy. Without any wait, nearly all of Syphon Filter's, Wipeout's and Resistance's did.

L.A. Rush reads its depth buffer only after sceGeDrawSync, and the new compat flag
DepthRasterNoCallbackWait skips the callback wait for it.

10 emulated seconds on a Moto G54 (two Cortex-A78, six A55):

  Wipeout Pure     7.24 s -> 6.50 s
  Resistance      17.98 s -> 13.26 s
  Midnight Club    8.75 s -> 8.01 s
  L.A. Rush        5.95 s -> 4.76 s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 23:32:11 +01:00
Henrik Rydgård 7164fce7c4 Merge pull request #22897 from hrydgard/adhoc-ptp-segments
Ad hoc relay: Deliver back-to-back PTP sends about 1 ms apart
2026-11-03 23:09:50 +01:00
Henrik RydgårdandClaude Opus 5.5 92fbf32e19 Ad hoc relay: Iterate the PTP block queue instead of indexing it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 22:03:18 +01:00
Henrik Rydgård 723732ca67 Merge pull request #22913 from hrydgard/firmware-model-check
Warn when the installed firmware is for a different PSP model
2026-11-03 21:45:39 +01:00
Henrik Rydgård b86023c60c Merge pull request #22915 from hrydgard/texture-pack-saf-case
Replacement: Don't index packs on Android's shared storage to ignore case
2026-11-03 21:45:11 +01:00
Henrik RydgårdandClaude Opus 5.5 2742a6374a MemFault: Stop ignoring bad accesses after 1000 in one frame
An ignored bad access takes microseconds of host time and no emulated
cycles, so a guest looping over a bad pointer stretched a single emulated
frame out for seconds. On Android the emulator only checks for exit between
frames, so destroying the surface waited on it until the app hit an ANR.
Play reports show the render loop inside the fault handler when that happens.

Past the limit, the access is treated like one that can't be ignored: the
core stops with the memory exception, which notes why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:03:13 +01:00
Henrik RydgårdandClaude Opus 5.5 06f19c6473 Replacement: Don't index packs on Android's shared storage to ignore case
Looking for a file whose name differs in case lists the whole pack on
the first miss. For a pack behind a content URI, that's one content
resolver query per directory, which in a big pack takes long enough
that a Play report hit an ANR: the surface was destroyed while the
render loop sat in the texture cache's destructor, waiting for a load
blocked on the index. Shared storage already ignores case, so the index
couldn't find anything there anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:03:13 +01:00
Henrik Rydgård caa91b54b5 Merge pull request #22912 from hrydgard/pvr-dynamic-ubo-crash
Vulkan: Work around a PowerVR crash when a vertex shader doesn't read the lights UBO
2026-11-03 19:56:02 +01:00