summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorameerj <aj662@drexel.edu>2020-10-29 19:16:45 +0100
committerameerj <aj662@drexel.edu>2020-10-29 19:16:45 +0100
commit362020613672e9b260552807a3edf8cb58c23dee (patch)
tree86c8fca5bbc8f900faf85da9557f199d41019faf /src/video_core/shader
parentMerge pull request #4781 from german77/GChotplug (diff)
downloadyuzu-362020613672e9b260552807a3edf8cb58c23dee.tar
yuzu-362020613672e9b260552807a3edf8cb58c23dee.tar.gz
yuzu-362020613672e9b260552807a3edf8cb58c23dee.tar.bz2
yuzu-362020613672e9b260552807a3edf8cb58c23dee.tar.lz
yuzu-362020613672e9b260552807a3edf8cb58c23dee.tar.xz
yuzu-362020613672e9b260552807a3edf8cb58c23dee.tar.zst
yuzu-362020613672e9b260552807a3edf8cb58c23dee.zip
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/async_shaders.cpp17
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() {
}
void AsyncShaders::AllocateWorkers() {
- // Max worker threads we should allow
- constexpr u32 MAX_THREADS = 4;
- // Deduce how many threads we can use
- const u32 threads_used = std::thread::hardware_concurrency() / 4;
- // Always allow at least 1 thread regardless of our settings
- const auto max_worker_count = std::max(1U, threads_used);
- // Don't use more than MAX_THREADS
- const auto num_workers = std::min(max_worker_count, MAX_THREADS);
+ // Use at least one thread
+ u32 num_workers = 1;
+
+ // Deduce how many more threads we can use
+ const u32 thread_count = std::thread::hardware_concurrency();
+ if (thread_count >= 8) {
+ // Increase async workers by 1 for every 2 threads >= 8
+ num_workers += 1 + (thread_count - 8) / 2;
+ }
// If we already have workers queued, ignore
if (num_workers == worker_threads.size()) {