summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2020-08-11 13:26:23 -0400
committerGravatar Morph2020-08-12 09:23:34 -0400
commite0ff98dd34d8180b7c2efc2142c40be83fd84725 (patch)
treedf18e28fed5fbb24ebc4c125674669f6d6b63abe
parentMerge pull request #4497 from lioncash/freezer-alg (diff)
downloadyuzu-e0ff98dd34d8180b7c2efc2142c40be83fd84725.tar.gz
yuzu-e0ff98dd34d8180b7c2efc2142c40be83fd84725.tar.xz
yuzu-e0ff98dd34d8180b7c2efc2142c40be83fd84725.zip
gl_shader_cache: Use std::max() for determining num_workers
Does not allocate more threads than available in the host system for boot-time shader compilation and always allocates at least 1 thread if hardware_concurrency() returns 0.
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index be71e1733..eb49a36bf 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -403,7 +403,7 @@ void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading,
403 } 403 }
404 }; 404 };
405 405
406 const auto num_workers{static_cast<std::size_t>(std::thread::hardware_concurrency() + 1ULL)}; 406 const std::size_t num_workers{std::max(1U, std::thread::hardware_concurrency())};
407 const std::size_t bucket_size{transferable->size() / num_workers}; 407 const std::size_t bucket_size{transferable->size() / num_workers};
408 std::vector<std::unique_ptr<Core::Frontend::GraphicsContext>> contexts(num_workers); 408 std::vector<std::unique_ptr<Core::Frontend::GraphicsContext>> contexts(num_workers);
409 std::vector<std::thread> threads(num_workers); 409 std::vector<std::thread> threads(num_workers);