summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-07-27 13:15:38 +1000
committerStenzek <stenzek@gmail.com>2017-07-30 17:43:59 +1000
commitc8f31656cb1c5f5e3c83a5b977fd822e987cb596 (patch)
tree533941c3211604f5550bffb9b56930c141efd6ae /Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
parente17efb1d8dcff32e7db915a53dc95df0bf329692 (diff)
VideoBackends: Support a different number of threads for precompiling
At runtime, we only really want a single shader compiler thread. However, for initial boots, we can use a higher number to speed things up.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index 6cdc240ce6..e2d201e9b7 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -607,17 +607,8 @@ void ProgramShaderCache::Init()
// on the main thread the first time they are used, causing stutter. Nouveau has been
// reported to crash if draw calls are invoked on the shared context threads. For now,
// disable asynchronous compilation on Mesa.
- if (!DriverDetails::HasBug(DriverDetails::BUG_SHARED_CONTEXT_SHADER_COMPILATION) &&
- g_ActiveConfig.GetShaderCompilerThreads() > 0)
- {
+ if (!DriverDetails::HasBug(DriverDetails::BUG_SHARED_CONTEXT_SHADER_COMPILATION))
s_async_compiler = std::make_unique<SharedContextAsyncShaderCompiler>();
- s_async_compiler->StartWorkerThreads(g_ActiveConfig.GetShaderCompilerThreads());
- if (!s_async_compiler->HasWorkerThreads())
- {
- // No point using the async compiler without workers.
- s_async_compiler.reset();
- }
- }
// Read our shader cache, only if supported and enabled
if (g_ogl_config.bSupportsGLSLCache && g_ActiveConfig.bShaderCache)
@@ -630,7 +621,19 @@ void ProgramShaderCache::Init()
last_uber_entry = nullptr;
if (g_ActiveConfig.CanPrecompileUberShaders())
+ {
+ if (s_async_compiler)
+ s_async_compiler->ResizeWorkerThreads(g_ActiveConfig.GetShaderPrecompilerThreads());
PrecompileUberShaders();
+ }
+
+ if (s_async_compiler)
+ {
+ // No point using the async compiler without workers.
+ s_async_compiler->ResizeWorkerThreads(g_ActiveConfig.GetShaderCompilerThreads());
+ if (!s_async_compiler->HasWorkerThreads())
+ s_async_compiler.reset();
+ }
}
void ProgramShaderCache::RetrieveAsyncShaders()