Plasma Engine  2.0
Loading...
Searching...
No Matches
FencePoolDX11.h
1#pragma once
2
3#include <RendererDX11/RendererDX11DLL.h>
4
5#include <Foundation/Time/Timestamp.h>
6
7struct ID3D11Query;
9
10
11class PL_RENDERERDX11_DLL plFencePoolDX11
12{
13public:
14 static void Initialize(plGALDeviceDX11* pDevice);
15 static void DeInitialize();
16
17 static ID3D11Query* RequestFence();
18 static void ReclaimFence(ID3D11Query*& ref_pFence);
19
20 static void InsertFence(ID3D11Query* pFence);
21 static plEnum<plGALAsyncResult> GetFenceResult(ID3D11Query* pFence, plTime timeout = plTime::MakeZero());
22
23private:
24 static plHybridArray<ID3D11Query*, 4> s_Fences;
25 static plGALDeviceDX11* s_pDevice;
26};
27
28
29class PL_RENDERERDX11_DLL plFenceQueueDX11
30{
31public:
32 plFenceQueueDX11(plAllocator* pAllocator);
34
35 plGALFenceHandle GetCurrentFenceHandle();
36 plGALFenceHandle SubmitCurrentFence();
37 plEnum<plGALAsyncResult> GetFenceResult(plGALFenceHandle hFence, plTime timeout = plTime::MakeZero());
38
39private:
40 void FlushReadyFences();
41 plEnum<plGALAsyncResult> WaitForNextFence(plTime timeout = plTime::MakeZero());
42
43private:
44 struct PendingFence
45 {
46 ID3D11Query* m_pFence = nullptr;
47 plGALFenceHandle m_hFence = {};
48 };
49 plDeque<PendingFence> m_PendingFences;
50 plUInt64 m_uiCurrentFenceCounter = 1;
51 plUInt64 m_uiReachedFenceCounter = 0;
52};
Base class for all memory allocators.
Definition Allocator.h:23
Definition Deque.h:270
Definition FencePoolDX11.h:12
Definition FencePoolDX11.h:30
The DX11 device implementation of the graphics abstraction layer.
Definition DeviceDX11.h:32
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