[vk_query_cache] add soft recover for GetQueryResults=VK_TIMEOUT

This commit is contained in:
xbzk 2026-04-25 18:27:45 -03:00
parent ff4fd9aa39
commit e62b1417fd
3 changed files with 30 additions and 2 deletions

View file

@ -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();
}

View file

@ -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,22 @@ public:
switch (query_result) {
case VK_SUCCESS:
return;
case VK_TIMEOUT: {
static std::atomic<u32> soft_fault_count{0};
const u32 n = soft_fault_count.fetch_add(1, std::memory_order_relaxed) + 1;
LOG_WARNING(Render_Vulkan,
"GetQueryResults VK_TIMEOUT #{}: pool={} start={} size={}",
n, 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);
}
}

View file

@ -223,7 +223,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) {