Commit Graph
293 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 93f57a4f38 GPU: Delete copy operations on classes that own resources
These own GPU objects, memory or refcounts in their destructors (or assert
there that they were torn down), so a copy would double-free. Nothing copies
them today; this keeps it that way. The manager base classes cover every
backend's subclass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-29 10:33:32 -06:00
Henrik RydgårdandClaude Opus 5.5 507bb0801b GE: Complete lists dropped on error, flush before immediate draws
- A list dropped for a bad pc or a GE error stayed RUNNING: its ID was never
  freed and sceGeListSync on it never returned. Complete it like a finished
  one.
- FlushImm switches to through mode and another vertex decoder, so flush the
  queued draws first even when the immediate flags match.
- Clear leftover temporary GE breakpoints when setting or clearing the next
  break, so a step that never got there doesn't trip later.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-29 10:33:32 -06:00
Henrik RydgårdandClaude Opus 5.5 8f66065f53 GPU: Add a clear cost, disabled for now
Full-screen clears measured on a PSP (pspautotests gpu/timing/blittiming):
0.49ms on a 16-bit framebuffer whatever is cleared, 0.69ms on 8888, 1.02ms on
8888 with depth. Charging them may help games that spin hard on an empty
screen, but it's off (chargeClearTime) until tried on some. The video blit
cost moves into the same function, now EstimateFillCycles.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-25 17:18:42 -06:00
Henrik RydgårdandClaude Opus 5.5 242ef0a984 GPU: Track video frames in GPUCommon, so they expire for the blit cost too
The blit cost remembered only the last buffer a decoder wrote into, forever.
Move the texture cache's video list (with its ageing out a few flips after
the last write) into GPUCommon, so the texture cache, the blit cost and
SoftGPU all share one. That also counts both of a double-buffered player's
frames, which exposed that a clear drawn with texturing still enabled was
being charged as a blit - skip clears and draws without texture coordinates.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-25 17:00:11 -06:00
Henrik RydgårdandClaude Opus 5.5 a0b812bc31 Charge hardware-measured time for movie decode, colour conversion and blit
Movie players like the one in Star Wars: Lethal Alliance present every decoded
frame after a single vblank wait, with no clock or timestamp check, so the
frame rate depends on decode, CSC, ATRAC decode and the GE blit adding up to
more than a vblank. We charged nearly nothing for any of them, so such movies
ran at 60 fps until the ringbuffer's slack ran out.

Costs measured on a PSP with a copy of that player (pspautotests
video/mpeg/playertiming), for a 480x272 frame:

- sceVideocodecDecode: 3.4ms (sceMpegAvcDecode 5.8ms less sceMpegAvcCsc 2.4ms)
- sceMpegBaseCscAvc: 2.4ms, was a flat 4ms
- sceAudiocodecDecode, ATRAC3+ only: 2.5ms per frame
- GE: 9.7ms for a through-mode rectangle blit from a decoded video frame,
  charged by area, only for textures in the buffer a decoder last wrote.

GE time also now carries across stall address updates. Before, a list sent
in stalled chunks only had its last chunk's time counted, so sceGeDrawSync
returned 39us after a blit that takes 9.7ms. This affects every game that
builds its lists incrementally, so GE-timing-sensitive games need checking.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-25 15:23:08 -06:00
Henrik RydgårdandClaude Opus 5 4aef060293 Carry "this is video" across block copies
videos_ only learns about the CSC output, so the texture we actually draw is
just an ordinary 512x512 8888 texture whose contents happen to be different
every frame: hash, miss, throw it in the secondary cache, rebuild, forever.

So track the copy. NotifyVideoCopy marks the destination as video when the
source is, and the copy funnels call it: sceDmacMemcpy, sceKernelMemcpy, and
the four replaced memcpy/memmove variants. It sits outside their "is either
side VRAM" gate, since a RAM-to-RAM copy of a frame is still a frame.

Being a video texture also gets it forced linear filtering and keeps it out of
texture upscaling, which is what you want for a video either way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-22 16:10:28 -06:00
Henrik RydgårdandClaude Fable 5.1 a36d09daac sceGe: what callbacks see, and a full GE reset on sceKernelLoadExec
From another pass over ge.prx against our code, each checked on a PSP with
gpu/ge/callbackstate except the last:

- A list's context is restored after its finish callback, which sees the
  state the list left. We restored at the FINISH, before it. Now that nothing
  runs until InterruptEnd(), that's where it happens.
- sceGeSaveContext/RestoreContext only fail while the GE is executing. It's
  stopped during a finish callback and a SUSPEND signal callback, however
  much is queued, so they work there. We said busy whenever a list existed.
- sceGeListDeQueue emptying the queue doesn't turn completed lists into
  nothing, only sceGeDrawSync does. CheckDrawSync() is gone.
- The "break in progress" flag that makes sceGeContinue only requeue the
  list is cleared by an interrupt that follows the break at once, so it's
  only seen from a callback or with interrupts off. Ours lasted until the
  next GE interrupt of any kind.
- sceKernelLoadExec restarts the GE driver, which begins by zeroing every
  register and matrix. Reinitialize() now does too, so a program started that
  way finds the same GE as one booted directly, rather than its launcher's.
  Not testable on hardware: nothing after the restart can report back.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-21 13:21:03 -06:00
Henrik Rydgård 18a9de3eca Move AdvanceVerts to GPUStateCache 2026-07-14 15:28:21 +02:00
Henrik Rydgård 1b2f87bf1a Rename GPUgstate to GEState 2026-07-02 20:34:09 +02:00
Henrik Rydgård d0f4e5c2d1 Visualize bounding boxes in ImGe debugger by drawing their corners 2026-06-03 13:46:30 +02:00
Henrik Rydgård 0dc6e36d19 Delete redundant implementation of vertex preview in SoftGpu 2026-06-02 15:43:11 +02:00
Henrik Rydgård bb573e6e0c Well, it builds, but doesn't work yet. 2026-06-02 12:33:53 +02:00
Henrik Rydgård a317890c08 Remove the GPUDebugInterface class
Just a pointless extra layer in the class hiearchy, making it
unnecessarily hard to modify the interface.

Might as well hit GPUCommon directly.
2026-06-02 11:15:08 +02:00
Henrik Rydgård 0b47955c64 Delete geometry shader culling support. Is mostly replaced, and will be fully replaced with software transform. 2026-05-30 19:07:59 +02:00
Henrik Rydgård 5cfbf50111 Keep updated products of view*proj and world*view*proj matrices. Use to simplify bbox culling. 2026-05-21 19:18:32 +02:00
Henrik Rydgård e71ffc59a6 Remove unnecessary IsStarted method 2026-02-17 10:18:08 +01:00
Henrik Rydgård eb234a1563 Finish the split. Greatly simplifies the render code in EmuScreen. 2026-02-08 10:46:16 +01:00
Henrik Rydgård f01aaeafb1 Split CopyDisplayToOutput in preparation for the next step 2026-02-08 01:06:32 +01:00
Henrik Rydgård 991d7bdfab VertexDecoder: Refactor away lowerbound/upperbound parameters 2026-02-05 13:26:17 +01:00
Henrik Rydgård d9ba20ce99 Add sanity checks in GPU::PerformMemoryCopy and GPU::PerformMemorySet
Part of #21055
2026-01-01 14:43:14 +01:00
Henrik Rydgård 0cab218877 Rework InstallZipScreen to work in portrait 2025-11-23 21:24:29 +01:00
Henrik Rydgård 7853881210 GPU header cleanup: Avoid including GPUCommon.h in some places 2025-11-23 20:37:37 +01:00
Henrik Rydgård 67010ff2af Split the display layout config between landscape and portrait orientations 2025-11-05 12:49:51 +01:00
Henrik Rydgård 8fb132b5a8 Inline a function that was only used in one place. 2025-11-04 13:35:45 +01:00
Henrik Rydgård 9293afa1c0 Cleanup 2025-05-15 10:32:07 +02:00
Henrik Rydgård 3e0fea509d Improve sanity checks for vertex ranges in GPU 2025-05-14 09:39:14 +02:00
Henrik Rydgård 95cf9c2e28 Just some constification 2025-03-03 13:59:42 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård ee297e974d Move more code into SoftwareTransformCommon, cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård db13c09c41 Add break-on-count (with rudimentary UI), break on block transfer 2024-12-17 11:24:07 +01:00
Henrik Rydgård e1e9047de2 Some renaming 2024-12-17 09:56:46 +01:00
Henrik Rydgård 96cab3f267 Rework the log manager to be more robust 2024-12-16 12:33:58 +01:00
Henrik Rydgård dda3ddf6b0 Simplifications 2024-12-15 16:09:42 +01:00
Henrik Rydgård 54d18bb343 Lift some more debugging functionality into GPUCommon 2024-12-15 14:03:05 +01:00
Henrik Rydgård 11dbae3457 Remove the "DispatchFlush" mechanism, not convinced it's a win 2024-12-15 13:42:05 +01:00
Henrik Rydgård 4223bcfae1 Move the ownership of GPU breakpoints to GPUCommon 2024-12-15 12:51:37 +01:00
Henrik Rydgård 638607d29a Refactor: Make GPUCommon own the framedump "recorder". 2024-12-15 12:07:44 +01:00
Henrik Rydgård 9e019ae246 Remove the notion of the GPU debugger being "Active". Now it's automatic. 2024-12-15 11:12:53 +01:00
Henrik Rydgård 6baaa2607a GE debugger: Cleaner resume from steps. Fixes GE debugging in God of War. 2024-12-13 20:36:31 +01:00
Henrik Rydgård 9a3cc7546b One more bit of simplification 2024-12-13 19:35:40 +01:00
Henrik Rydgård 7643d38700 Inline InterpretList into ProcessDLQueue. Makes it easier to understand the flow. 2024-12-13 19:29:06 +01:00
Henrik Rydgård a858032e46 Remove obsolete accounting for time spent stepping the GE (we no longer block) 2024-12-12 18:54:46 +01:00
Henrik Rydgård c756842b7b Im Ge debugger: Gray out disabled state (state that belongs to disabled features) 2024-12-10 16:38:36 +01:00
Henrik Rydgård c842e3f137 Fix discrepancy between stepping and running across frame endings. Add some more menu options in the ImDebugger 2024-12-10 01:06:04 +01:00
Henrik Rydgård 5f83e48280 Move the ge debugger window back out from GPUCommon 2024-12-06 09:50:00 +01:00
Henrik Rydgård 2c8e78408b Add basic vertex data viewer (with the same flaws as the old one) 2024-12-06 09:29:12 +01:00
Henrik Rydgård 51ae6ce898 Small simplification 2024-12-05 10:55:19 +01:00
Henrik Rydgård 474e7acf54 Hook up the new (bare-bones) ImGui debug window to GPU stepping, fix stepping. 2024-12-05 00:51:59 +01:00
Henrik Rydgård 9ed8d8871e Ge stepping without wait: Tex/Prim stepping works. Draw/Single have issues. 2024-12-05 00:36:48 +01:00
Henrik Rydgård c25e6b3933 Add "Split syscall" mechanism 2024-12-05 00:05:39 +01:00