59 Commits

Author SHA1 Message Date
Henrik Rydgård f60e27a9b7 Just some refactoring of the GPUStatistics struct, and more use of StringWriter 2026-05-29 14:40:31 +02:00
Henrik Rydgård 9218fe9b59 Rework the shutdown logic in the OpenGL backend. Eliminated race conditions. 2025-08-31 10:57:06 +02:00
Henrik Rydgård 45cf6d423e Buildfixes 2024-12-18 13:57:29 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Unknown W. Brackets 59fb374c38 softgpu: Small optimization to clut updates. 2023-04-16 10:16:06 -07:00
Unknown W. Brackets 88ba003f46 ThreadManager: Add a simple priority field.
Currently, not actually respected.
2023-02-02 17:08:24 -08:00
Unknown W. Brackets 3a6fa9b4ba ThreadManager: Don't allow reordering of queue.
Allowing a priority item is faster, but can cause confusion when you
expect things to run in the same sequence they're enqueued.
2023-01-14 16:35:01 -08:00
Unknown W. Brackets a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets 87fb9eef37 softgpu: Remove std::function usage.
Wanted to avoid coupling these, but don't like the std::function
construct/destructs showing in profiles...
2022-12-06 19:15:57 -08:00
Unknown W. Brackets 4d92533907 softgpu: Apply optimizations to states generically.
This is for optimizations we can only do when we know the vertex values.
2022-12-02 21:30:53 -08:00
Unknown W. Brackets 6bd0eec54d softgpu: Calc flags on state as we queue verts.
Might be some other ways, like doing this directly in a vertex reader.
Also am thinking about doing things regarding UVs or positions.

Flags not yet used, keeping separate for perf checks.
2022-12-02 21:28:50 -08:00
Henrik Rydgård fd110ef6a9 Merge pull request #16408 from unknownbrackets/jit-wx
softgpu: Fix compile hazard while running
2022-11-20 21:42:10 +01:00
Unknown W. Brackets 4d06400548 softgpu: Fix compile hazard while running.
This prevents any clearing of cache while other threads may be using
previously cached funcs, and avoids wx exclusive hazards.
2022-11-20 12:04:02 -08:00
Henrik Rydgård 250ea5e592 Merge pull request #16407 from unknownbrackets/jit-wx
In jits, protect and unprotect using better estimates
2022-11-20 20:39:04 +01:00
Unknown W. Brackets ce51942508 softgpu: Correct WX-exclusive platform hazards.
Should mainly affect BSD at this point.
2022-11-20 10:55:35 -08:00
Unknown W. Brackets 7e7eabf86a softgpu: Use threads on self-render if safe.
Some games, such as Prince of Persia, self-render 1:1 to colorize, rather
than to scale or blur.  We can still use threads in these cases.
2022-11-13 12:34:31 -08:00
Unknown W. Brackets 58a4376998 GPU: Normalize framebuf addresses.
In VRAM, always store without mirror.  In RAM, always store without
cache/kernel bits.
2022-10-02 21:28:53 -07:00
Unknown W. Brackets 24560eef5c softgpu: Avoid waiting for a thread to drain.
If we can, we want to keep the thread queues healthy, but not full.
Reduce the amount we push on a typical drain to avoid the Wait().
2022-09-24 20:01:00 -07:00
Henrik Rydgård d743bfac93 Merge pull request #16085 from unknownbrackets/softgpu-vert
softgpu: Cache reused indexed verts
2022-09-24 00:00:26 +02:00
Unknown W. Brackets 66b6dfd0a5 softgpu: Fix self-render detect in Ridge Racer.
When we flush we mark all pending writes zero, but we rely on this being
set to detect self-render.

TRANSFORM_ALL was wrong as well, sometimes clearing BINNER_RANGE.
2022-09-22 20:36:15 -07:00
Unknown W. Brackets 84a3f6de71 softgpu: Remove unnecessary state param.
Oops, meant to remove this when refactoring imm prims.
2022-09-22 18:18:49 -07:00
Unknown W. Brackets e2929fb395 softgpu: Skip flushing on no change.
Minor tweak, we sometimes try to flush even without anything to flush, and
were previously rechecking a lot of things.
2022-09-19 08:38:11 -07:00
Unknown W. Brackets 259abf79dd softgpu: Skip more triangles with equal verts.
Even if X is not equal, if all Y are equal, we can still skip.
This seems to happen more often than I expected with far away objects.

Skipping here avoids filling up the queue.
2022-09-19 08:37:47 -07:00
Unknown W. Brackets 596b07bd2e softgpu: Support fog and color1 on imm verts. 2022-09-18 06:16:26 -07:00
Unknown W. Brackets 167213c746 softgpu: Cache texture bufws at 16 bit.
Reducing the size of state a bit.
2022-09-12 21:57:00 -07:00
Unknown W. Brackets 5f2e20d8ca softgpu: Reduce some minor bin item field sizes. 2022-09-11 18:39:14 -07:00
Unknown W. Brackets 7a83f8bab5 softgpu: Use vertType prim override for flags.
These parameters are a real shame, was so clean before...
2022-09-06 22:20:45 -07:00
Unknown W. Brackets 88e8f95293 softgpu: Flush on transfer to pending tex read.
Potentially could use these for self-render, but so far we should be
detecting that so leaving it alone.
2022-08-20 23:22:21 -07:00
Henrik Rydgård eb765a80f8 Merge pull request #15411 from unknownbrackets/softgpu-range
softgpu: Apply region x2/y2 as a scissor
2022-02-20 21:42:00 +01:00
Unknown W. Brackets e3aabdc86c softgpu: Use region as a second scissor.
It's effectively a scissor in the common case of REGION1 being zero.
2022-02-20 12:01:35 -08:00
Unknown W. Brackets cc6491342e softgpu: Prepare dedicated rectangle path.
We're still sometimes using the slow rect-as-triangles path, let's do
something faster.  As a first step, just handle binning.
2022-02-20 09:38:51 -08:00
Unknown W. Brackets 1bc3acf2ed softgpu: Use a const for subpixel screenpos factor. 2022-02-19 21:03:49 -08:00
Unknown W. Brackets a66377fdf1 softgpu: Remove offset from screenpos.
This simplifies tighter calculations, and reduces the common magnitudes
we'll be dealing with.
2022-02-19 20:38:44 -08:00
Unknown W. Brackets 9ea5367a8c softgpu: Add dirty flags for rasterization state. 2022-01-23 08:08:41 -08:00
Unknown W. Brackets a27da25cd6 softgpu: Use dirty flags for render overlap checks. 2022-01-23 08:08:40 -08:00
Unknown W. Brackets 77db9c818f softgpu: Fix state race on screen offset.
Caused glitches in Motorstorm.
2022-01-23 08:08:40 -08:00
Henrik Rydgård b5e8c21042 Merge pull request #15334 from unknownbrackets/headless
Update pspautotests, require passing in GitHub Actions
2022-01-22 09:36:30 +01:00
Unknown W. Brackets ce0e872d37 softgpu: Define constexpr var for older C++. 2022-01-22 00:14:15 -08:00
Unknown W. Brackets c0c3f7284a softgpu: Avoid flush texturing from stride.
This generally detects overlap more accurately using a dirty rectangles
approach.  Also detects render to self much more accurately, including
with depth.
2022-01-20 18:39:01 -08:00
Unknown W. Brackets 55c11425e4 softgpu: Use persistent bin task state.
It's constant, so it's better to avoid the copying and allocation.  A
small win, but removes new from the profile.
2022-01-20 16:58:43 -08:00
Unknown W. Brackets 83adc44c2b softgpu: Heuristic to avoid over-draining.
Some games (i.e. VC3) benefit from an early drain, since they get more
done while processing more verts.  Others finish the draw quickly, and
then cause significant overhead in queueing new threads.

This attempts to balance the two, and improves Call of Duty and Blade
Dancer.
2022-01-16 21:09:28 -08:00
Unknown W. Brackets 1764111a4b softgpu: Reduce wasted memory. 2022-01-16 11:49:41 -08:00
Unknown W. Brackets cb5ac04d16 softgpu: Tune some queue sizes for perf.
Using a chunk of RAM for this, but mostly with many threads.
2022-01-16 11:27:43 -08:00
Unknown W. Brackets d95475e021 softgpu: Expose flush reasons/times in debug stats. 2022-01-16 11:27:42 -08:00
Unknown W. Brackets 2de7993dc5 softgpu: Decorate some stats for flushes. 2022-01-16 08:23:15 -08:00
Unknown W. Brackets cc155ec460 softgpu: Avoid texture/CLUT flush unless overlap.
Only need to flush here if there's some overlap in the target.
2022-01-16 08:22:13 -08:00
Unknown W. Brackets 9466dc6397 softgpu: Flush on offset changes. 2022-01-16 08:14:10 -08:00
Unknown W. Brackets d6fa301ab1 softgpu: Track CLUTs as states for binning.
This way we can have multiple CLUTs in process at once, which helps.
2022-01-16 08:14:09 -08:00
Unknown W. Brackets 18f2a45a6a softgpu: Allow binning across prim calls. 2022-01-16 00:49:49 -08:00
Henrik Rydgård 9bef900cd7 Merge pull request #15311 from unknownbrackets/softgpu-state
Avoid gstate references in rasterizerization
2022-01-16 09:40:25 +01:00