1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-02 22:29:16 +01:00

[dxvk] Catch exceptions of type DxvkError on CS thread

This commit is contained in:
Philip Rebohle 2020-10-07 16:29:07 +02:00
parent 0b011ea361
commit 1863c6e81c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -134,31 +134,36 @@ namespace dxvk {
env::setThreadName("dxvk-cs"); env::setThreadName("dxvk-cs");
DxvkCsChunkRef chunk; DxvkCsChunkRef chunk;
while (!m_stopped.load()) { try {
{ std::unique_lock<std::mutex> lock(m_mutex); while (!m_stopped.load()) {
if (chunk) { { std::unique_lock<std::mutex> lock(m_mutex);
if (--m_chunksPending == 0) if (chunk) {
m_condOnSync.notify_one(); if (--m_chunksPending == 0)
m_condOnSync.notify_one();
chunk = DxvkCsChunkRef();
}
chunk = DxvkCsChunkRef(); if (m_chunksQueued.size() == 0) {
m_condOnAdd.wait(lock, [this] {
return (m_chunksQueued.size() != 0)
|| (m_stopped.load());
});
}
if (m_chunksQueued.size() != 0) {
chunk = std::move(m_chunksQueued.front());
m_chunksQueued.pop();
}
} }
if (m_chunksQueued.size() == 0) { if (chunk)
m_condOnAdd.wait(lock, [this] { chunk->executeAll(m_context.ptr());
return (m_chunksQueued.size() != 0)
|| (m_stopped.load());
});
}
if (m_chunksQueued.size() != 0) {
chunk = std::move(m_chunksQueued.front());
m_chunksQueued.pop();
}
} }
} catch (const DxvkError& e) {
if (chunk) Logger::err("Exception on CS thread!");
chunk->executeAll(m_context.ptr()); Logger::err(e.message());
} }
} }