diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-19 17:16:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 17:16:19 +0100 |
commit | 787552f832e19824b5a1dfb9ef90ee3af3140548 (patch) | |
tree | 0016e0ad9840c5342484e05688711d8a18c1b3a3 /src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |
parent | Merge pull request #12036 from FernandoS27/you-should-have-more-than-one-towel (diff) | |
parent | Vulkan: Be more generous with pipeline workers for Android (diff) | |
download | yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar.gz yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar.bz2 yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar.lz yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar.xz yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.tar.zst yuzu-787552f832e19824b5a1dfb9ef90ee3af3140548.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 22bf8cc77..16ad8d625 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -263,6 +263,22 @@ Shader::RuntimeInfo MakeRuntimeInfo(std::span<const Shader::IR::Program> program info.y_negate = key.state.y_negate != 0; return info; } + +size_t GetTotalPipelineWorkers() { + const size_t max_core_threads = + std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL; +#ifdef ANDROID + // Leave at least a few cores free in android + constexpr size_t free_cores = 3ULL; + if (max_core_threads <= free_cores) { + return 1ULL; + } + return max_core_threads - free_cores; +#else + return max_core_threads; +#endif +} + } // Anonymous namespace size_t ComputePipelineCacheKey::Hash() const noexcept { @@ -294,11 +310,8 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device texture_cache{texture_cache_}, shader_notify{shader_notify_}, use_asynchronous_shaders{Settings::values.use_asynchronous_shaders.GetValue()}, use_vulkan_pipeline_cache{Settings::values.use_vulkan_driver_pipeline_cache.GetValue()}, -#ifdef ANDROID - workers(1, "VkPipelineBuilder"), -#else - workers(std::max(std::thread::hardware_concurrency(), 2U) - 1, "VkPipelineBuilder"), -#endif + workers(device.HasBrokenParallelShaderCompiling() ? 1ULL : GetTotalPipelineWorkers(), + "VkPipelineBuilder"), serialization_thread(1, "VkPipelineSerialization") { const auto& float_control{device.FloatControlProperties()}; const VkDriverId driver_id{device.GetDriverID()}; |