mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-09 23:57:59 +00:00
[vk_threads] post loss handling minor improvements
This commit is contained in:
parent
a19510fba9
commit
f758aa1300
|
|
@ -16,6 +16,7 @@
|
|||
#include <queue>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/thread.h"
|
||||
#include "video_core/delayed_destruction_ring.h"
|
||||
|
|
@ -214,7 +215,12 @@ private:
|
|||
if (!current_fence->IsStubbed()) {
|
||||
WaitFence(current_fence);
|
||||
}
|
||||
PopAsyncFlushes();
|
||||
try {
|
||||
PopAsyncFlushes();
|
||||
} catch (const std::exception& e) {
|
||||
LOG_CRITICAL(Render_Vulkan, "GPUFencingThread: exception in PopAsyncFlushes: {}", e.what());
|
||||
throw;
|
||||
}
|
||||
for (auto& operation : current_operations) {
|
||||
operation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <thread>
|
||||
|
||||
#include <ranges>
|
||||
#include "common/logging.h"
|
||||
#include "common/settings.h"
|
||||
#include "video_core/renderer_vulkan/vk_master_semaphore.h"
|
||||
#include "video_core/vulkan_common/vulkan_device.h"
|
||||
|
|
@ -221,7 +222,18 @@ void MasterSemaphore::WaitThread(std::stop_token token) {
|
|||
wait_queue.pop();
|
||||
}
|
||||
|
||||
fence.Wait();
|
||||
const VkResult wait_result = fence.Wait();
|
||||
if (wait_result == VK_ERROR_DEVICE_LOST) {
|
||||
LOG_CRITICAL(Render_Vulkan,
|
||||
"Fence wait returned VK_ERROR_DEVICE_LOST on infinite wait (driver GPU hang).");
|
||||
device.ReportLoss();
|
||||
return;
|
||||
}
|
||||
if (wait_result != VK_SUCCESS) {
|
||||
LOG_CRITICAL(Render_Vulkan, "Fence wait failed: result={}",
|
||||
static_cast<int>(wait_result));
|
||||
vk::Check(wait_result);
|
||||
}
|
||||
fence.Reset();
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
|
|
@ -74,10 +75,20 @@ public:
|
|||
switch (query_result) {
|
||||
case VK_SUCCESS:
|
||||
return;
|
||||
case VK_TIMEOUT: {
|
||||
LOG_WARNING(Render_Vulkan,
|
||||
"VK_TIMEOUT pool={} start={} size={}. Attempting to get over...",
|
||||
index, start, size);
|
||||
std::fill_n(&host_results[start], size, 0ULL);
|
||||
return;
|
||||
}
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
device.ReportLoss();
|
||||
[[fallthrough]];
|
||||
default:
|
||||
LOG_CRITICAL(Render_Vulkan,
|
||||
"GetQueryResults failed: result={} pool={} start={} size={}",
|
||||
static_cast<int>(query_result), index, start, size);
|
||||
throw vk::Exception(query_result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,16 @@ void Scheduler::WorkerThread(std::stop_token stop_token) {
|
|||
// Perform the work, tracking whether the chunk was a submission
|
||||
// before executing.
|
||||
const bool has_submit = work->HasSubmit();
|
||||
work->ExecuteAll(current_cmdbuf, current_upload_cmdbuf);
|
||||
try {
|
||||
work->ExecuteAll(current_cmdbuf, current_upload_cmdbuf);
|
||||
} catch (const vk::Exception& e) {
|
||||
LOG_CRITICAL(Render_Vulkan, "VulkanWorker: vk::Exception in ExecuteAll: result={}",
|
||||
static_cast<int>(e.GetResult()));
|
||||
throw;
|
||||
} catch (const std::exception& e) {
|
||||
LOG_CRITICAL(Render_Vulkan, "VulkanWorker: exception in ExecuteAll: {}", e.what());
|
||||
throw;
|
||||
}
|
||||
|
||||
// If the chunk was a submission, reallocate the command buffer.
|
||||
if (has_submit) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue