1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-02 04:29:14 +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");
DxvkCsChunkRef chunk;
while (!m_stopped.load()) {
{ std::unique_lock<std::mutex> lock(m_mutex);
if (chunk) {
if (--m_chunksPending == 0)
m_condOnSync.notify_one();
try {
while (!m_stopped.load()) {
{ std::unique_lock<std::mutex> lock(m_mutex);
if (chunk) {
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) {
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 (chunk)
chunk->executeAll(m_context.ptr());
}
if (chunk)
chunk->executeAll(m_context.ptr());
} catch (const DxvkError& e) {
Logger::err("Exception on CS thread!");
Logger::err(e.message());
}
}