diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/GpuContext.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/GpuContext.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/GpuContext.cs b/Ryujinx.Graphics.Gpu/GpuContext.cs index bdbf77a6..b62b5f3a 100644 --- a/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -1,9 +1,11 @@ +using Ryujinx.Common.Configuration; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Gpu.Engine; using Ryujinx.Graphics.Gpu.Engine.GPFifo; using Ryujinx.Graphics.Gpu.Memory; using Ryujinx.Graphics.Gpu.Synchronization; using System; +using System.Threading; namespace Ryujinx.Graphics.Gpu { @@ -13,6 +15,16 @@ namespace Ryujinx.Graphics.Gpu public sealed class GpuContext : IDisposable { /// <summary> + /// Event signaled when the host emulation context is ready to be used by the gpu context. + /// </summary> + public ManualResetEvent HostInitalized { get; } + + /// <summary> + /// Event signaled when the gpu context is ready to be used. + /// </summary> + public ManualResetEvent ReadyEvent { get; } + + /// <summary> /// Host renderer. /// </summary> public IRenderer Renderer { get; } @@ -79,6 +91,22 @@ namespace Ryujinx.Graphics.Gpu Window = new Window(this); _caps = new Lazy<Capabilities>(Renderer.GetCapabilities); + + HostInitalized = new ManualResetEvent(false); + ReadyEvent = new ManualResetEvent(false); + } + + /// <summary> + /// Initialize the GPU emulation context. + /// </summary> + /// <param name="logLevel">The log level required.</param> + public void Initialize(GraphicsDebugLevel logLevel) + { + HostInitalized.WaitOne(); + + Renderer.Initialize(logLevel); + Methods.ShaderCache.Initialize(); + ReadyEvent.Set(); } /// <summary> @@ -113,6 +141,8 @@ namespace Ryujinx.Graphics.Gpu Methods.TextureManager.Dispose(); Renderer.Dispose(); GPFifo.Dispose(); + HostInitalized.Dispose(); + ReadyEvent.Dispose(); } } }
\ No newline at end of file |