diff options
| author | 2020-07-28 05:07:24 -0400 | |
|---|---|---|
| committer | 2020-07-28 05:08:27 -0400 | |
| commit | e8f22730d1eb1db328b3be080985b4da770acb3a (patch) | |
| tree | 738d114d2798c08512fa040e2f9d8e2c0dda06a8 | |
| parent | Merge pull request #4437 from lioncash/ptr (diff) | |
| download | yuzu-e8f22730d1eb1db328b3be080985b4da770acb3a.tar.gz yuzu-e8f22730d1eb1db328b3be080985b4da770acb3a.tar.xz yuzu-e8f22730d1eb1db328b3be080985b4da770acb3a.zip | |
renderer_opengl: Use 1/4 of all threads for async shader compilation
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 03e82c599..cb284db77 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -178,16 +178,11 @@ RasterizerOpenGL::RasterizerOpenGL(Core::System& system, Core::Frontend::EmuWind | |||
| 178 | 178 | ||
| 179 | if (device.UseAsynchronousShaders()) { | 179 | if (device.UseAsynchronousShaders()) { |
| 180 | // Max worker threads we should allow | 180 | // Max worker threads we should allow |
| 181 | constexpr auto MAX_THREADS = 2u; | 181 | constexpr u32 MAX_THREADS = 4; |
| 182 | // Amount of threads we should reserve for other parts of yuzu | 182 | // Deduce how many threads we can use |
| 183 | constexpr auto RESERVED_THREADS = 6u; | 183 | const u32 threads_used = std::thread::hardware_concurrency() / 4; |
| 184 | // Get the amount of threads we can use(this can return zero) | ||
| 185 | const auto cpu_thread_count = | ||
| 186 | std::max(RESERVED_THREADS, std::thread::hardware_concurrency()); | ||
| 187 | // Deduce how many "extra" threads we have to use. | ||
| 188 | const auto max_threads_unused = cpu_thread_count - RESERVED_THREADS; | ||
| 189 | // Always allow at least 1 thread regardless of our settings | 184 | // Always allow at least 1 thread regardless of our settings |
| 190 | const auto max_worker_count = std::max(1u, max_threads_unused); | 185 | const auto max_worker_count = std::max(1U, threads_used); |
| 191 | // Don't use more than MAX_THREADS | 186 | // Don't use more than MAX_THREADS |
| 192 | const auto worker_count = std::min(max_worker_count, MAX_THREADS); | 187 | const auto worker_count = std::min(max_worker_count, MAX_THREADS); |
| 193 | async_shaders.AllocateWorkers(worker_count); | 188 | async_shaders.AllocateWorkers(worker_count); |