summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan/vk_resource_manager.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-02-14 17:06:05 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-02-14 22:44:26 +0100
commitaa0b6babdad588d176fc67784f9905709845aa07 (patch)
treed8be258cecf13218af5283ef2fd8e04eab7fbc76 /src/video_core/renderer_vulkan/vk_resource_manager.h
parentvk_resource_manager: Implement VKFence (diff)
downloadyuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar.gz
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar.bz2
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar.lz
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar.xz
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.tar.zst
yuzu-aa0b6babdad588d176fc67784f9905709845aa07.zip
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_resource_manager.h')
-rw-r--r--src/video_core/renderer_vulkan/vk_resource_manager.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_resource_manager.h b/src/video_core/renderer_vulkan/vk_resource_manager.h
index aa52007c8..5345ba46e 100644
--- a/src/video_core/renderer_vulkan/vk_resource_manager.h
+++ b/src/video_core/renderer_vulkan/vk_resource_manager.h
@@ -86,4 +86,34 @@ private:
bool is_used = false; ///< The fence has been commited but it has not been checked to be free.
};
+/**
+ * A fence watch is used to keep track of the usage of a fence and protect a resource or set of
+ * resources without having to inherit VKResource from their handlers.
+ */
+class VKFenceWatch final : public VKResource {
+public:
+ explicit VKFenceWatch();
+ ~VKFenceWatch();
+
+ /// Waits for the fence to be released.
+ void Wait();
+
+ /**
+ * Waits for a previous fence and watches a new one.
+ * @param new_fence New fence to wait to.
+ */
+ void Watch(VKFence& new_fence);
+
+ /**
+ * Checks if it's currently being watched and starts watching it if it's available.
+ * @returns True if a watch has started, false if it's being watched.
+ */
+ bool TryWatch(VKFence& new_fence);
+
+ void OnFenceRemoval(VKFence* signaling_fence) override;
+
+private:
+ VKFence* fence{}; ///< Fence watching this resource. nullptr when the watch is free.
+};
+
} // namespace Vulkan