Plasma Engine  2.0
Loading...
Searching...
No Matches
FencePoolVulkan.h
1#pragma once
2
3#include <RendererVulkan/RendererVulkanDLL.h>
4#include <Foundation/Time/Timestamp.h>
5#include <vulkan/vulkan.hpp>
6
19class PL_RENDERERVULKAN_DLL plFencePoolVulkan
20{
21public:
22 static void Initialize(vk::Device device);
23 static void DeInitialize();
24
25 static vk::Fence RequestFence();
26 static void ReclaimFence(vk::Fence& fence);
27
28private:
29 static plHybridArray<vk::Fence, 4> s_Fences;
30 static vk::Device s_device;
31};
32
33
34// #TODO_VULKAN extend to support multiple queues.
35class PL_RENDERERVULKAN_DLL plFenceQueueVulkan
36{
37public:
40
41 plGALFenceHandle GetCurrentFenceHandle();
42 void FenceSubmitted(vk::Fence vkFence);
43 void FlushReadyFences();
44 plEnum<plGALAsyncResult> GetFenceResult(plGALFenceHandle hFence, plTime timeout = plTime::MakeZero());
45
46private:
47 plEnum<plGALAsyncResult> WaitForNextFence(plTime timeout = plTime::MakeZero());
48
49private:
50 struct PendingFence
51 {
52 vk::Fence m_vkFence;
53 plGALFenceHandle m_hFence;
54 };
55 plDeque<PendingFence> m_PendingFences;
56 plUInt64 m_uiCurrentFenceCounter = 1;
57 plUInt64 m_uiReachedFenceCounter = 0;
58 vk::Device m_device;
59};
Definition Deque.h:270
Simple pool for fences.
Definition FencePoolVulkan.h:20
Definition FencePoolVulkan.h:36
The Vulkan device implementation of the graphics abstraction layer.
Definition DeviceVulkan.h:58
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42