71 Commits
Author SHA1 Message Date
LibretroAdmin 7af2120cc3 MMIO handlers as plain C data
A handling method and the handler it becomes are a struct: kind, the
value or pointer and mask of the simple kinds, and for a complex one a
C function called with a word of context. Registering copies it in;
nothing is allocated, constructed or destroyed (the handler arrays are
the system's zeroed pages), where every handler was a heap object with
std::functions, thousands of them per boot.

The size converters are C functions whose context is the handler(s):
to smaller the high part, the low part being the next; to larger the
larger handler with the shift in its low bits. The devices' lambdas take
the context in place of what they captured (an index, a mask, a
register; EXI's channel, through member functions), and the JITs call
the function directly: the emitters' std::function trampolines are gone.
2026-11-09 18:35:17 +01:00
LibretroAdmin 407a632adc Core, VideoCommon: replace the per-frame locks with atomics
CPU: the state machine drops its two mutexes and two condition
variables.  The state is one atomic word, which the JIT still reads in
place; PowerDown sticks through a CAS.  The CPU thread marks itself
active and then rechecks for a pause or a state change, and a pausing
thread stores its request and then waits for the flag to drop, a
Dekker pair, so neither misses the other.  Waits park on eventcounts.
A step request and its Event travel as one exchanged pointer, pending
jobs are an MPSC stack run in order, and SetStepping and PauseAndLock
still run one at a time, through a claimed flag.

Core: the recursive core mutex goes.  Stop moves the state with a CAS,
and PauseAndLock pairs are already serialized by the CPU's claim.  Host
jobs are an MPSC stack the host thread moves, in order, into its own
queue, which keeps HostDispatchJobs re-entrant.  RunOnCPUThread waits
on a Common::Event instead of a binary semaphore, and OneShotEvent is
removed.

State: the transferable shared mutex that counted save tasks is a
counter and an eventcount; the slot readers and the flush hook wait for
it to reach zero.  TransferableSharedMutex is removed.  WaitableFlag
parks on an eventcount.

PixelEngine: the token, its interrupt flags and the raised-event flag
are one atomic word; the video thread merges into it and schedules the
event only on the edge, the CPU thread takes the flags with a CAS.
Savestates keep the old fields.

VertexLoaderManager: the loader map is a fixed set of buckets, each a
list pushed with a CAS and read without a lock by the main and the
preprocessing thread; two threads making the same loader keep one.

AsyncShaderCompiler: the pending queue is the video thread's own.  It
hands the most urgent items to two slots per worker, and finished items
come back on an MPSC stack, so neither side takes a lock.

OSD messages are posted to an MPSC stack and taken in by the video
thread when it draws; a screenshot request is one exchanged string.

Also removed, being unreachable: the surface change and resize requests
nothing sends (and the swap mutex guarding them), the ImGui keyboard
and mouse input nothing feeds (and the ImGui mutex, as only the video
thread touches the context now), ClearMessages, and the libretro Vulkan
WaitForPresentation with its mutex and condition variable.
2026-11-05 20:11:27 +01:00
LibretroAdmin e4aed234da Remove NetPlay
The core never creates a NetPlay client or server; only the standalone
frontends did. Drop NetPlay with what only it used: the traversal
client, ENet, the QoS session, the NetPlay config layer and settings,
the chat and golf overlays, the netplay index, the save sync plumbing
in BootSessionData and WiiRoot, the disc sync hashes, and the Android
app's netplay feature and JNI bindings.
2026-11-05 13:00:19 +01:00
Lioncache a23cf2121d VideoCommon/PixelEngine: Generify lock guards
We don't need to specify the type of the mutex being passed in.
2023-12-22 14:19:29 -05:00
Lioncache 0505f057ca VideoCommon/PixelEngine: Remove global system accessor in UpdateInterrupts()
Now that the system instance is passed through, this is no longer necessary.
2023-12-22 14:19:29 -05:00
Lioncache e539dbba4c VideoCommon/PixelEngine: Passthrough system instance in constructor
Simplifies the interface in terms of usage
2023-12-22 14:19:26 -05:00
Scott Mansell 99d3e489ea Move BoundingBox out of RenderBase
They were essentially just pass-though methods
2023-01-31 19:41:24 +13:00
Admiral H. Curtiss 74e1577a2c HW/ProcessorInterface: Refactor to class, move to Core::System. 2023-01-04 03:00:10 +01:00
Admiral H. Curtiss 725bd64ec2 VideoCommon: De-globalize PixelShaderManager class. 2022-12-27 20:13:24 +01:00
Admiral H. Curtiss c486baffe6 VideoCommon/PixelEngine: Pass Core::System to methods. 2022-12-11 21:57:30 +01:00
Admiral H. Curtiss ec8aaf1f30 VideoCommon/PixelEngine: Refactor to class, move to Core::System. 2022-12-11 21:57:19 +01:00
Admiral H. Curtiss 5624dd6d39 VideoCommon/Fifo: Refactor to class, move to Core::System. 2022-12-10 17:16:19 +01:00
Admiral H. Curtiss c9558ecb4c CoreTiming: Refactor to class. 2022-11-27 03:47:12 +01:00
Admiral H. Curtiss 0a6fdb9c13 HW: Pass System to MMIO handlers. 2022-11-23 05:52:21 +01:00
Admiral H. Curtiss a36a5c1308 CoreTiming: Pass Core::System to Events. 2022-11-06 17:54:58 +01:00
Pokechu22 e8221d7948 Common/PointerWrap: Remove DoPOD
This was added in 385d8e2b15, but became somewhat redundant with Do in 4c7bbd96e4, and completely redundant now that std::is_trivially_copyable_v is well-supported.
2022-10-06 11:25:36 -07:00
Pokechu22 8882eb040a PixelEngine: Convert to BitField and enum class 2022-03-29 15:34:43 -07:00
Pokechu22 45b8ebeb25 PixelEngine: Remove old comment
This comment was added in 76d24f2c0d (the link was updated in 5799824b22, but both are dead now).  An archived version is at https://web.archive.org/web/20090830050441/http://developer.nvidia.com/object/General_FAQ.html#t6 but it's about the number of available texture units, which doesn't seem relevant to PixelEngine.
2022-03-29 15:34:43 -07:00
Admiral H. Curtiss d8825f5635 Config: Port dual core setting to new config system. 2022-01-09 21:29:11 +01:00
Scott Mansell f5c550e9cb Delay singlecore gpu interrupts
Fixes Bomberman Jetters in single core mode.

When single core mode pauses the CPU to execute the GPU
FIFO it greedily executes the whole thing. Before this commit,
Finish and Token interrupts would happen instantly, not even
taking into account how long the current FIFO window has
taken to execute. The interrupts would be effectively backdated
to the start of this execution window.

This commit does two things: It pipes the current FIFO window
execution time though to the interrupt scheduling and it enforces
a minimum delay of 500 cycles before an interrupt will be fired.
2021-11-25 11:11:01 +13:00
Techjar 1161af8059 VideoCommon: Abstract bounding box
This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
2021-10-04 15:51:24 -04:00
Pierre Bourdon e149ad4f0a treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Sepalani ce8004c9c1 Lint: End of namespace 2021-06-07 12:55:52 +04:00
Lioncash 3d9b2aa005 VideoCommon: Migrate over to fmt
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05:00
Lioncash 2c9ec6cb8a VideoCommon/BoundingBox: Move PixelShaderManager::SetBoundingBoxActive() calls into Enable()/Disable()
Now that we have an actual interface to manage things, we can stop
duplicating the calls to to the pixel shader manager and remove the
need to remember to actually do so when disabling or enabling the
bounding box.
2019-12-05 11:57:58 -05:00
Lioncash 9bd533ebe4 VideoCommon/BoundingBox: Make interface for querying bounding box data
Rather than expose the bounding box members directly, we can instead
provide an interface for code to use. This makes it nicer to transition
from global data, as the interface function names are already in
place.
2019-12-05 11:48:42 -05:00
Lioncash f6e3a39c0e CommandProcessor: Remove unnecessary include
Gets rid of some indirect inclusion.
2017-09-02 13:34:21 -04:00
Stenzek 7d78cf0f6f ShaderGen: Implement pixel ubershaders 2017-07-30 17:43:59 +10:00
degasus ba1decf7bc PixelEngine: Use a DirectRead for the token.
No need to call a std::function, and a few games poll this value very often.
2017-01-27 07:49:47 +01:00
BhaaL 23d99f2f2c specify custom brace style to fix unions
BreakBeforeBraces: Allman apparently includes all styles,
except for AfterUnion (which is false) when using clang-format -dump-config
2017-01-05 12:55:13 +01:00
aldelaro5 f0aa9b3751 Reorganise a ton of logs level
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-10-01 15:50:28 -04:00
EmptyChaos aa16282516 Core: Change CoreTiming event key from int to EventType*
Replace 'int' keys with something that carries type information.
Performance is neutral.
2016-09-03 14:55:44 +10:00
Jules Blok 9fb6f93ca1 PixelEngine: Add missing static specifier for s_token_finish_mutex. 2016-09-01 17:28:48 +02:00
Léo Lam c1184957a5 Run clang-format on missed files
`clang-format`s files that lint missed because of the bug. Fortunately,
not much.
2016-08-11 21:14:39 +02:00
JosJuice 3443a10030 CoreTiming: Merge ScheduleEvent variants into one function
Now Core::IsCPUThread() only gets called once when using the AnyThread
variant. Also, I think the enum approach makes calling code clearer.
2016-08-11 12:45:57 +02:00
degasus 82bdc4ef86 PixelEngine: Delay token updates by events.
To still get a speedup, mark if already an event is queued.
If so, don't raise a new event.
2016-08-10 13:24:57 +02:00
degasus a051db9792 PixelEngine: Cleanup PE Token.
This also affects the behavior a bit, it should now fit better to the one of the commonly more used PE Finish flag.
2016-08-10 10:07:53 +02:00
degasus 367e1b4d4c PixelEngine: Drop write-only variables. 2016-08-10 10:07:53 +02:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Scott Mansell 5e50c37c13 Alternative fix: promote cycleslate to an s64 everywhere.
Also changed a few functions to be static.
2016-04-10 02:13:06 +12:00
Lioncash 32ce2be2bf Fifo: Make g_use_deterministic_gpu_thread a TU-local variable 2016-01-25 05:24:03 -05:00
Lioncash d9fec92628 VideoCommon: Header cleanup
Also remedies places where the video backends and core rely on things
being indirectly included.
2016-01-17 20:11:45 -05:00
degasus 5f244abf28 Fifo: Create a "Fifo" namespace. 2016-01-12 23:28:26 +01:00
degasus c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00
comex 9c63b78397 Fix indeterminism in GPU thread mode. 2015-06-06 02:14:06 -04:00
Lioncash 1ba3b4e7ac CommandProcessor: Replace volatile usages with atomics
Also remove said variables from being globals.
2015-05-27 03:53:29 -04:00
Lioncash ec03196267 PixelEngine: Replace volatile usages with atomics
Also removes two unused volatile variables.
2015-05-27 02:39:55 -04:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Ingve Skåra 5799824b22 Fix dead link 2015-05-01 21:42:50 +02:00