summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <aj662@drexel.edu>2020-08-05 18:53:26 +0200
committerameerj <aj662@drexel.edu>2020-08-16 18:02:22 +0200
commit1b829fbd7a36f9c2b553b04aa39bdf8135d30458 (patch)
treeb843deb06496541b1e611832ddf54c4492f0849c /src
parentAddress feedback, add shader compile notifier, update setting text (diff)
downloadyuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar.gz
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar.bz2
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar.lz
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar.xz
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.tar.zst
yuzu-1b829fbd7a36f9c2b553b04aa39bdf8135d30458.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp12
-rw-r--r--src/video_core/shader/async_shaders.cpp13
-rw-r--r--src/video_core/shader/async_shaders.h2
4 files changed, 14 insertions, 23 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index cb284db77..4af5824cd 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -177,15 +177,7 @@ RasterizerOpenGL::RasterizerOpenGL(Core::System& system, Core::Frontend::EmuWind
}
if (device.UseAsynchronousShaders()) {
- // 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 worker_count = std::min(max_worker_count, MAX_THREADS);
- async_shaders.AllocateWorkers(worker_count);
+ async_shaders.AllocateWorkers();
}
}
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 720802ad5..936f76195 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -405,17 +405,7 @@ RasterizerVulkan::RasterizerVulkan(Core::System& system, Core::Frontend::EmuWind
wfi_event{device.GetLogical().CreateNewEvent()}, async_shaders{renderer} {
scheduler.SetQueryCache(query_cache);
if (device.UseAsynchronousShaders()) {
- // The following is subject to move into the allocate workers method, to be api agnostic
-
- // Max worker threads we should allow
- constexpr u32 MAX_THREADS = 4;
- // Deduce how many threads we can use
- const auto 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 worker_count = std::min(max_worker_count, MAX_THREADS);
- async_shaders.AllocateWorkers(worker_count);
+ async_shaders.AllocateWorkers();
}
}
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp
index ea813d506..6a1b8999c 100644
--- a/src/video_core/shader/async_shaders.cpp
+++ b/src/video_core/shader/async_shaders.cpp
@@ -19,9 +19,18 @@ AsyncShaders::~AsyncShaders() {
KillWorkers();
}
-void AsyncShaders::AllocateWorkers(std::size_t num_workers) {
+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);
+
// If we're already have workers queued or don't want to queue workers, ignore
- if (num_workers == worker_threads.size() || num_workers == 0) {
+ if (num_workers == worker_threads.size()) {
return;
}
diff --git a/src/video_core/shader/async_shaders.h b/src/video_core/shader/async_shaders.h
index 7c10bd63f..5b58dd9bd 100644
--- a/src/video_core/shader/async_shaders.h
+++ b/src/video_core/shader/async_shaders.h
@@ -62,7 +62,7 @@ public:
~AsyncShaders();
/// Start up shader worker threads
- void AllocateWorkers(std::size_t num_workers);
+ void AllocateWorkers();
/// Clear the shader queue and kill all worker threads
void FreeWorkers();