mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 18:27:33 +01:00
renderer_vulkan: Catch device losses in more places
This commit is contained in:
parent
7e4a132a77
commit
16105c6a66
@ -113,8 +113,19 @@ u64 HostCounter::BlockingQuery() const {
|
|||||||
if (ticks >= cache.Scheduler().Ticks()) {
|
if (ticks >= cache.Scheduler().Ticks()) {
|
||||||
cache.Scheduler().Flush();
|
cache.Scheduler().Flush();
|
||||||
}
|
}
|
||||||
return cache.Device().GetLogical().GetQueryResult<u64>(
|
u64 data;
|
||||||
query.first, query.second, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
|
const VkResult result = cache.Device().GetLogical().GetQueryResults(
|
||||||
|
query.first, query.second, 1, sizeof(data), &data, sizeof(data),
|
||||||
|
VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
|
||||||
|
switch (result) {
|
||||||
|
case VK_SUCCESS:
|
||||||
|
return data;
|
||||||
|
case VK_ERROR_DEVICE_LOST:
|
||||||
|
cache.Device().ReportLoss();
|
||||||
|
[[fallthrough]];
|
||||||
|
default:
|
||||||
|
throw vk::Exception(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
@ -166,7 +166,15 @@ void VKScheduler::SubmitExecution(VkSemaphore semaphore) {
|
|||||||
submit_info.pCommandBuffers = current_cmdbuf.address();
|
submit_info.pCommandBuffers = current_cmdbuf.address();
|
||||||
submit_info.signalSemaphoreCount = semaphore ? 1 : 0;
|
submit_info.signalSemaphoreCount = semaphore ? 1 : 0;
|
||||||
submit_info.pSignalSemaphores = &semaphore;
|
submit_info.pSignalSemaphores = &semaphore;
|
||||||
device.GetGraphicsQueue().Submit(submit_info, *current_fence);
|
switch (const VkResult result = device.GetGraphicsQueue().Submit(submit_info, *current_fence)) {
|
||||||
|
case VK_SUCCESS:
|
||||||
|
break;
|
||||||
|
case VK_ERROR_DEVICE_LOST:
|
||||||
|
device.ReportLoss();
|
||||||
|
[[fallthrough]];
|
||||||
|
default:
|
||||||
|
vk::Check(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKScheduler::AllocateNewContext() {
|
void VKScheduler::AllocateNewContext() {
|
||||||
|
@ -567,12 +567,8 @@ public:
|
|||||||
/// Construct a queue handle.
|
/// Construct a queue handle.
|
||||||
constexpr Queue(VkQueue queue, const DeviceDispatch& dld) noexcept : queue{queue}, dld{&dld} {}
|
constexpr Queue(VkQueue queue, const DeviceDispatch& dld) noexcept : queue{queue}, dld{&dld} {}
|
||||||
|
|
||||||
/// Returns the checkpoint data.
|
VkResult Submit(Span<VkSubmitInfo> submit_infos, VkFence fence) const noexcept {
|
||||||
/// @note Returns an empty vector when the function pointer is not present.
|
return dld->vkQueueSubmit(queue, submit_infos.size(), submit_infos.data(), fence);
|
||||||
std::vector<VkCheckpointDataNV> GetCheckpointDataNV(const DeviceDispatch& dld) const;
|
|
||||||
|
|
||||||
void Submit(Span<VkSubmitInfo> submit_infos, VkFence fence) const {
|
|
||||||
Check(dld->vkQueueSubmit(queue, submit_infos.size(), submit_infos.data(), fence));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult Present(const VkPresentInfoKHR& present_info) const noexcept {
|
VkResult Present(const VkPresentInfoKHR& present_info) const noexcept {
|
||||||
@ -734,18 +730,11 @@ public:
|
|||||||
dld->vkResetQueryPoolEXT(handle, query_pool, first, count);
|
dld->vkResetQueryPoolEXT(handle, query_pool, first, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetQueryResults(VkQueryPool query_pool, u32 first, u32 count, std::size_t data_size,
|
VkResult GetQueryResults(VkQueryPool query_pool, u32 first, u32 count, std::size_t data_size,
|
||||||
void* data, VkDeviceSize stride, VkQueryResultFlags flags) const {
|
void* data, VkDeviceSize stride, VkQueryResultFlags flags) const
|
||||||
Check(dld->vkGetQueryPoolResults(handle, query_pool, first, count, data_size, data, stride,
|
noexcept {
|
||||||
flags));
|
return dld->vkGetQueryPoolResults(handle, query_pool, first, count, data_size, data, stride,
|
||||||
}
|
flags);
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T GetQueryResult(VkQueryPool query_pool, u32 first, VkQueryResultFlags flags) const {
|
|
||||||
static_assert(std::is_trivially_copyable_v<T>);
|
|
||||||
T value;
|
|
||||||
GetQueryResults(query_pool, first, 1, sizeof(T), &value, sizeof(T), flags);
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user