diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-03-17 01:43:05 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-04-22 17:36:19 +0200 |
commit | b752faf2d3aae882a1a35a3aec393ef5765c035f (patch) | |
tree | 84089c7f583cb8d2e2a44821d0e0a25d70d3ed50 /src/video_core/renderer_vulkan/vk_fence_manager.h | |
parent | QueryCache: Implement Async Flushes. (diff) | |
download | yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar.gz yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar.bz2 yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar.lz yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar.xz yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.tar.zst yuzu-b752faf2d3aae882a1a35a3aec393ef5765c035f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_fence_manager.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_fence_manager.h b/src/video_core/renderer_vulkan/vk_fence_manager.h new file mode 100644 index 000000000..30651e9c7 --- /dev/null +++ b/src/video_core/renderer_vulkan/vk_fence_manager.h @@ -0,0 +1,74 @@ +// Copyright 2020 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <memory> + +#include "video_core/fence_manager.h" +#include "video_core/renderer_vulkan/wrapper.h" + +namespace Core { +class System; +} + +namespace VideoCore { +class RasterizerInterface; +} + +namespace Vulkan { + +class VKBufferCache; +class VKDevice; +class VKQueryCache; +class VKScheduler; +class VKTextureCache; + +class InnerFence : public VideoCommon::FenceBase { +public: + explicit InnerFence(const VKDevice& device, VKScheduler& scheduler, u32 payload, + bool is_stubbed); + explicit InnerFence(const VKDevice& device, VKScheduler& scheduler, GPUVAddr address, + u32 payload, bool is_stubbed); + ~InnerFence(); + + void Queue(); + + bool IsSignaled() const; + + void Wait(); + +private: + bool IsEventSignalled() const; + + const VKDevice& device; + VKScheduler& scheduler; + vk::Event event; + u64 ticks = 0; +}; +using Fence = std::shared_ptr<InnerFence>; + +using GenericFenceManager = + VideoCommon::FenceManager<Fence, VKTextureCache, VKBufferCache, VKQueryCache>; + +class VKFenceManager final : public GenericFenceManager { +public: + explicit VKFenceManager(Core::System& system, VideoCore::RasterizerInterface& rasterizer, + const VKDevice& device, VKScheduler& scheduler, + VKTextureCache& texture_cache, VKBufferCache& buffer_cache, + VKQueryCache& query_cache); + +protected: + Fence CreateFence(u32 value, bool is_stubbed) override; + Fence CreateFence(GPUVAddr addr, u32 value, bool is_stubbed) override; + void QueueFence(Fence& fence) override; + bool IsFenceSignaled(Fence& fence) override; + void WaitFence(Fence& fence) override; + +private: + const VKDevice& device; + VKScheduler& scheduler; +}; + +} // namespace Vulkan |