diff options
| author | 2022-01-03 20:31:51 -0500 | |
|---|---|---|
| committer | 2022-01-03 20:47:26 -0500 | |
| commit | c17938f96ba9a3f2571387b21328743db8050250 (patch) | |
| tree | 23c8280d1aaf458a1abbad272e8facc3bd58eb36 | |
| parent | Revert "Merge pull request #7668 from ameerj/fence-stop-token" (diff) | |
| download | yuzu-c17938f96ba9a3f2571387b21328743db8050250.tar.gz yuzu-c17938f96ba9a3f2571387b21328743db8050250.tar.xz yuzu-c17938f96ba9a3f2571387b21328743db8050250.zip | |
gpu: Add shut down method to synchronize threads before destruction
Diffstat (limited to '')
| -rw-r--r-- | src/core/core.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index aa96f709b..3f9a7f44b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -317,6 +317,8 @@ struct System::Impl { | |||
| 317 | is_powered_on = false; | 317 | is_powered_on = false; |
| 318 | exit_lock = false; | 318 | exit_lock = false; |
| 319 | 319 | ||
| 320 | gpu_core->NotifyShutdown(); | ||
| 321 | |||
| 320 | services.reset(); | 322 | services.reset(); |
| 321 | service_manager.reset(); | 323 | service_manager.reset(); |
| 322 | cheat_engine.reset(); | 324 | cheat_engine.reset(); |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 8788f5148..44fda27ef 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -312,6 +312,12 @@ struct GPU::Impl { | |||
| 312 | cpu_context->MakeCurrent(); | 312 | cpu_context->MakeCurrent(); |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | void NotifyShutdown() { | ||
| 316 | std::unique_lock lk{sync_mutex}; | ||
| 317 | shutting_down.store(true, std::memory_order::relaxed); | ||
| 318 | sync_cv.notify_all(); | ||
| 319 | } | ||
| 320 | |||
| 315 | /// Obtain the CPU Context | 321 | /// Obtain the CPU Context |
| 316 | void ObtainContext() { | 322 | void ObtainContext() { |
| 317 | cpu_context->MakeCurrent(); | 323 | cpu_context->MakeCurrent(); |
| @@ -859,6 +865,10 @@ void GPU::Start() { | |||
| 859 | impl->Start(); | 865 | impl->Start(); |
| 860 | } | 866 | } |
| 861 | 867 | ||
| 868 | void GPU::NotifyShutdown() { | ||
| 869 | impl->NotifyShutdown(); | ||
| 870 | } | ||
| 871 | |||
| 862 | void GPU::ObtainContext() { | 872 | void GPU::ObtainContext() { |
| 863 | impl->ObtainContext(); | 873 | impl->ObtainContext(); |
| 864 | } | 874 | } |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 500411176..3188b83ed 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -232,6 +232,9 @@ public: | |||
| 232 | /// core timing events. | 232 | /// core timing events. |
| 233 | void Start(); | 233 | void Start(); |
| 234 | 234 | ||
| 235 | /// Performs any additional necessary steps to shutdown GPU emulation. | ||
| 236 | void NotifyShutdown(); | ||
| 237 | |||
| 235 | /// Obtain the CPU Context | 238 | /// Obtain the CPU Context |
| 236 | void ObtainContext(); | 239 | void ObtainContext(); |
| 237 | 240 | ||