From 2bb40c122db784ce4fcedf47bdf13cd4cc7ef32f Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 25 Mar 2016 16:36:21 -0500 Subject: [PATCH] Vulkan util Fence class --- src/xenia/ui/vulkan/vulkan_util.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/xenia/ui/vulkan/vulkan_util.h b/src/xenia/ui/vulkan/vulkan_util.h index fcf9e4f8f..ca93c4c2d 100644 --- a/src/xenia/ui/vulkan/vulkan_util.h +++ b/src/xenia/ui/vulkan/vulkan_util.h @@ -25,6 +25,32 @@ namespace xe { namespace ui { namespace vulkan { +class Fence { + public: + Fence(VkDevice device) : device_(device) { + VkFenceCreateInfo fence_info; + fence_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; + fence_info.pNext = nullptr; + fence_info.flags = 0; + vkCreateFence(device, &fence_info, nullptr, &fence_); + } + ~Fence() { + vkDestroyFence(device_, fence_, nullptr); + fence_ = nullptr; + } + + VkResult status() const { + return vkGetFenceStatus(device_, fence_); + } + + VkFence fence() const { return fence_; } + operator VkFence() const { return fence_; } + + private: + VkDevice device_; + VkFence fence_ = nullptr; +}; + struct Version { uint32_t major; uint32_t minor;