diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2021-04-02 23:05:55 +0100 |
|---|---|---|
| committer | riperiperi <rhy3756547@hotmail.com> | 2021-04-18 17:33:59 +0100 |
| commit | a0aa09912cb8f35ae06834b08308a128886f207f (patch) | |
| tree | b1175d7dc58b22e8b6e638c8663a706d96890f19 /Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs | |
| parent | 20d560e3f925e387c9c28705a120202ca38abd8b (diff) | |
Use event to wake the main thread on task completion
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs index cc1b322b..ff48fab0 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCompileTask.cs @@ -1,5 +1,6 @@ using Ryujinx.Graphics.GAL; using System; +using System.Threading; using System.Threading.Tasks; namespace Ryujinx.Graphics.Gpu.Shader @@ -17,6 +18,16 @@ namespace Ryujinx.Graphics.Gpu.Shader private IProgram _program; private ShaderCompileTaskCallback _action; + private AutoResetEvent _taskDoneEvent; + + /// <summary> + /// Create a new shader compile task, with an event to signal whenever a subtask completes. + /// </summary> + /// <param name="taskDoneEvent">Event to signal when a subtask completes</param> + public ShaderCompileTask(AutoResetEvent taskDoneEvent) + { + _taskDoneEvent = taskDoneEvent; + } /// <summary> /// Check the completion status of the shader compile task, and run callbacks on step completion. @@ -58,6 +69,8 @@ namespace Ryujinx.Graphics.Gpu.Shader _programsTask = task; _action = action; + + task.ContinueWith(task => _taskDoneEvent.Set()); } /// <summary> |
