diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-02-14 17:11:32 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-02-14 22:44:26 +0100 |
commit | 0ffdd0a68367770a42455c2a523766d3d57210d1 (patch) | |
tree | 979f19d79897bd924e406c13a177617aeddee415 /src/video_core/renderer_vulkan/vk_resource_manager.h | |
parent | vk_resource_manager: Implement VKFenceWatch (diff) | |
download | yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar.gz yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar.bz2 yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar.lz yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar.xz yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.tar.zst yuzu-0ffdd0a68367770a42455c2a523766d3d57210d1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_resource_manager.h | 23 |
1 files changed, 23 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 5345ba46e..c8759f779 100644 --- a/src/video_core/renderer_vulkan/vk_resource_manager.h +++ b/src/video_core/renderer_vulkan/vk_resource_manager.h @@ -4,6 +4,8 @@ #pragma once +#include <cstddef> +#include <memory> #include <vector> #include "video_core/renderer_vulkan/declarations.h" @@ -116,4 +118,25 @@ private: VKFence* fence{}; ///< Fence watching this resource. nullptr when the watch is free. }; +/** + * The resource manager handles all resources that can be protected with a fence avoiding + * driver-side or GPU-side concurrent usage. Usage is documented in VKFence. + */ +class VKResourceManager final { +public: + explicit VKResourceManager(const VKDevice& device); + ~VKResourceManager(); + + /// Commits a fence. It has to be sent to a queue and released. + VKFence& CommitFence(); + +private: + /// Allocates new fences. + void GrowFences(std::size_t new_fences_count); + + const VKDevice& device; ///< Device handler. + std::size_t fences_iterator = 0; ///< Index where a free fence is likely to be found. + std::vector<std::unique_ptr<VKFence>> fences; ///< Pool of fences. +}; + } // namespace Vulkan |