forked from megayuchi/D3D12Lecture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
D3D12ResourceManager.h
36 lines (28 loc) · 1.36 KB
/
D3D12ResourceManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
class CD3D12ResourceManager
{
ID3D12Device5* m_pD3DDevice = nullptr;
ID3D12CommandQueue* m_pCommandQueue = nullptr;
ID3D12CommandAllocator* m_pCommandAllocator = nullptr;
ID3D12GraphicsCommandList* m_pCommandList = nullptr;
HANDLE m_hFenceEvent = nullptr;
ID3D12Fence* m_pFence = nullptr;
UINT64 m_ui64FenceValue = 0;
void CreateFence();
void CleanupFence();
void CreateCommandList();
void CleanupCommandList();
UINT64 Fence();
void WaitForFenceValue();
void Cleanup();
public:
BOOL Initialize(ID3D12Device5* pD3DDevice);
HRESULT CreateVertexBuffer(UINT SizePerVertex, DWORD dwVertexNum, D3D12_VERTEX_BUFFER_VIEW* pOutVertexBufferView, ID3D12Resource **ppOutBuffer, void* pInitData);
HRESULT CreateIndexBuffer(DWORD dwIndexNum, D3D12_INDEX_BUFFER_VIEW* pOutIndexBufferView, ID3D12Resource **ppOutBuffer, void* pInitData);
void UpdateTextureForWrite(ID3D12Resource* pDestTexResource, ID3D12Resource* pSrcTexResource);
BOOL CreateTexture(ID3D12Resource** ppOutResource, UINT Width, UINT Height, DXGI_FORMAT format, const BYTE* pInitImage);
BOOL CreateTextureFromFile(ID3D12Resource** ppOutResource, D3D12_RESOURCE_DESC* pOutDesc, const WCHAR* wchFileName);
BOOL CreateTexturePair(ID3D12Resource** ppOutResource, ID3D12Resource** ppOutUploadBuffer, UINT Width, UINT Height, DXGI_FORMAT format);
CD3D12ResourceManager();
~CD3D12ResourceManager();
};