From e18d258fa09379f31ca4310fbbe9e1869581d49f Mon Sep 17 00:00:00 2001 From: riperiperi Date: Mon, 1 May 2023 20:05:12 +0100 Subject: GPU: Pre-emptively flush textures that are flushed often (to imported memory when available) (#4711) * WIP texture pre-flush Improve performance of TextureView GetData to buffer Fix copy/sync ordering Fix minor bug Make this actually work WIP host mapping stuff * Fix usage flags * message * Cleanup 1 * Fix rebase * Fix * Improve pre-flush rules * Fix pre-flush * A lot of cleanup * Use the host memory bits * Select the correct memory type * Cleanup TextureGroupHandle * Missing comment * Remove debugging logs * Revert BufferHandle _value access modifier * One interrupt action at a time. * Support D32S8 to D24S8 conversion, safeguards * Interrupt cannot happen in sync handle's lock Waitable needs to be checked twice now, but this should stop it from deadlocking. * Remove unused using * Address some feedback * Address feedback * Address more feedback * Address more feedback * Improve sync rules Should allow for faster sync in some cases. --- .../Synchronization/HostSyncFlags.cs | 30 ++++++++++++++++++++++ .../Synchronization/ISyncActionHandler.cs | 22 ++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/Ryujinx.Graphics.Gpu/Synchronization/HostSyncFlags.cs create mode 100644 src/Ryujinx.Graphics.Gpu/Synchronization/ISyncActionHandler.cs (limited to 'src/Ryujinx.Graphics.Gpu/Synchronization') diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/HostSyncFlags.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/HostSyncFlags.cs new file mode 100644 index 00000000..42666991 --- /dev/null +++ b/src/Ryujinx.Graphics.Gpu/Synchronization/HostSyncFlags.cs @@ -0,0 +1,30 @@ +using System; + +namespace Ryujinx.Graphics.Gpu.Synchronization +{ + /// + /// Modifier flags for creating host sync. + /// + [Flags] + internal enum HostSyncFlags + { + None = 0, + + /// + /// Present if host sync is being created by a syncpoint. + /// + Syncpoint = 1 << 0, + + /// + /// Present if the sync should signal as soon as possible. + /// + Strict = 1 << 1, + + /// + /// Present will force the sync to be created, even if no actions are eligible. + /// + Force = 1 << 2, + + StrictSyncpoint = Strict | Syncpoint + } +} diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/ISyncActionHandler.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/ISyncActionHandler.cs new file mode 100644 index 00000000..d470d2f0 --- /dev/null +++ b/src/Ryujinx.Graphics.Gpu/Synchronization/ISyncActionHandler.cs @@ -0,0 +1,22 @@ +namespace Ryujinx.Graphics.Gpu.Synchronization +{ + /// + /// This interface indicates that a class can be registered for a sync action. + /// + interface ISyncActionHandler + { + /// + /// Action to be performed when some synchronizing action is reached after modification. + /// Generally used to register read/write tracking to flush resources from GPU when their memory is used. + /// + /// True if the action is a guest syncpoint + /// True if the action is to be removed, false otherwise + bool SyncAction(bool syncpoint); + + /// + /// Action to be performed immediately before sync is created. + /// + /// True if the action is a guest syncpoint + void SyncPreAction(bool syncpoint) { } + } +} -- cgit v1.2.3