summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AsyncShaderCompiler.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-03-19 09:16:53 +0100
committerGitHub <noreply@github.com>2018-03-19 09:16:53 +0100
commit98b4716902576e17277ea5727aaf1193c494bdfa (patch)
tree6b1ad3fc902c9c9ecdfcb31663b21e72f72d97de /Source/Core/VideoCommon/AsyncShaderCompiler.cpp
parent0c0a3424839541a03cbf5eb426ce8e5578329414 (diff)
parent93865b327f97399d7b166cbce739685749de083a (diff)
Merge pull request #6442 from stenzek/async-compiler-priority
ShaderCache: Implement compile priority
Diffstat (limited to 'Source/Core/VideoCommon/AsyncShaderCompiler.cpp')
-rw-r--r--Source/Core/VideoCommon/AsyncShaderCompiler.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/AsyncShaderCompiler.cpp b/Source/Core/VideoCommon/AsyncShaderCompiler.cpp
index 30c78a1ef3..755f105942 100644
--- a/Source/Core/VideoCommon/AsyncShaderCompiler.cpp
+++ b/Source/Core/VideoCommon/AsyncShaderCompiler.cpp
@@ -20,7 +20,7 @@ AsyncShaderCompiler::~AsyncShaderCompiler()
ASSERT(!HasWorkerThreads());
}
-void AsyncShaderCompiler::QueueWorkItem(WorkItemPtr item)
+void AsyncShaderCompiler::QueueWorkItem(WorkItemPtr item, u32 priority)
{
// If no worker threads are available, compile synchronously.
if (!HasWorkerThreads())
@@ -31,7 +31,7 @@ void AsyncShaderCompiler::QueueWorkItem(WorkItemPtr item)
else
{
std::lock_guard<std::mutex> guard(m_pending_work_lock);
- m_pending_work.push_back(std::move(item));
+ m_pending_work.emplace(priority, std::move(item));
m_worker_thread_wake.notify_one();
}
}
@@ -219,8 +219,9 @@ void AsyncShaderCompiler::WorkerThreadRun()
while (!m_pending_work.empty() && !m_exit_flag.IsSet())
{
m_busy_workers++;
- WorkItemPtr item(std::move(m_pending_work.front()));
- m_pending_work.pop_front();
+ auto iter = m_pending_work.begin();
+ WorkItemPtr item(std::move(iter->second));
+ m_pending_work.erase(iter);
pending_lock.unlock();
if (item->Compile())