diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/shader/async_shaders.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp index aabd62c5c..39cc3b869 100644 --- a/src/video_core/shader/async_shaders.cpp +++ b/src/video_core/shader/async_shaders.cpp | |||
| @@ -20,14 +20,15 @@ AsyncShaders::~AsyncShaders() { | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void AsyncShaders::AllocateWorkers() { | 22 | void AsyncShaders::AllocateWorkers() { |
| 23 | // Max worker threads we should allow | 23 | // Use at least one thread |
| 24 | constexpr u32 MAX_THREADS = 4; | 24 | u32 num_workers = 1; |
| 25 | // Deduce how many threads we can use | 25 | |
| 26 | const u32 threads_used = std::thread::hardware_concurrency() / 4; | 26 | // Deduce how many more threads we can use |
| 27 | // Always allow at least 1 thread regardless of our settings | 27 | const u32 thread_count = std::thread::hardware_concurrency(); |
| 28 | const auto max_worker_count = std::max(1U, threads_used); | 28 | if (thread_count >= 8) { |
| 29 | // Don't use more than MAX_THREADS | 29 | // Increase async workers by 1 for every 2 threads >= 8 |
| 30 | const auto num_workers = std::min(max_worker_count, MAX_THREADS); | 30 | num_workers += 1 + (thread_count - 8) / 2; |
| 31 | } | ||
| 31 | 32 | ||
| 32 | // If we already have workers queued, ignore | 33 | // If we already have workers queued, ignore |
| 33 | if (num_workers == worker_threads.size()) { | 34 | if (num_workers == worker_threads.size()) { |