diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-04-01 01:27:44 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-04-01 02:32:07 +0200 |
commit | d85ca0ab33a90285b7120a8a85aa4de1680f4ae7 (patch) | |
tree | 881f1c9cb0d4ea25a06e515c695ff0e5bd9856a1 | |
parent | renderer_vulkan/wrapper: Add instance handle (diff) | |
download | yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar.gz yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar.bz2 yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar.lz yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar.xz yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.tar.zst yuzu-d85ca0ab33a90285b7120a8a85aa4de1680f4ae7.zip |
-rw-r--r-- | src/video_core/renderer_vulkan/wrapper.cpp | 11 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/wrapper.h | 25 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp index 2e743e926..1ec7a542d 100644 --- a/src/video_core/renderer_vulkan/wrapper.cpp +++ b/src/video_core/renderer_vulkan/wrapper.cpp @@ -409,4 +409,15 @@ DebugCallback Instance::TryCreateDebugCallback( return DebugCallback(messenger, handle, *dld); } +std::vector<VkCheckpointDataNV> Queue::GetCheckpointDataNV(const DeviceDispatch& dld) const { + if (!dld.vkGetQueueCheckpointDataNV) { + return {}; + } + u32 num; + dld.vkGetQueueCheckpointDataNV(queue, &num, nullptr); + std::vector<VkCheckpointDataNV> checkpoints(num); + dld.vkGetQueueCheckpointDataNV(queue, &num, checkpoints.data()); + return checkpoints; +} + } // namespace Vulkan::vk diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h index 8eb31e77d..a4077136b 100644 --- a/src/video_core/renderer_vulkan/wrapper.h +++ b/src/video_core/renderer_vulkan/wrapper.h @@ -559,4 +559,29 @@ public: DebugCallback TryCreateDebugCallback(PFN_vkDebugUtilsMessengerCallbackEXT callback) noexcept; }; +class Queue { +public: + /// Construct an empty queue handle. + constexpr Queue() noexcept = default; + + /// Construct a queue handle. + constexpr Queue(VkQueue queue, const DeviceDispatch& dld) noexcept : queue{queue}, dld{&dld} {} + + /// Returns the checkpoint data. + /// @note Returns an empty vector when the function pointer is not present. + 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 { + return dld->vkQueuePresentKHR(queue, &present_info); + } + +private: + VkQueue queue = nullptr; + const DeviceDispatch* dld = nullptr; +}; + } // namespace Vulkan::vk |