-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderTargetTexture.h
More file actions
44 lines (33 loc) · 1.28 KB
/
Copy pathRenderTargetTexture.h
File metadata and controls
44 lines (33 loc) · 1.28 KB
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
36
37
38
39
40
41
42
43
44
#pragma once
#include <d3d12.h>
#include <wrl/client.h>
#include "SimpleMath.h"
class RenderTargetTexture
{
public:
RenderTargetTexture();
~RenderTargetTexture();
bool Create(ID3D12Device* device, UINT width, UINT height,
DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM,
const DirectX::SimpleMath::Vector4& clearColor = DirectX::SimpleMath::Vector4(0.1f, 0.1f, 0.1f, 1.0f));
void Release();
bool Resize(ID3D12Device* device, UINT width, UINT height);
D3D12_CPU_DESCRIPTOR_HANDLE GetRTV() const { return rtvHandle; }
D3D12_GPU_DESCRIPTOR_HANDLE GetSRV() const { return srvHandle.gpu; }
ID3D12Resource* GetResource() const { return texture.Get(); }
UINT GetWidth() const { return width; }
UINT GetHeight() const { return height; }
const DirectX::SimpleMath::Vector4& GetClearColor() const { return clearColor; }
void SetClearColor(const DirectX::SimpleMath::Vector4& color) { clearColor = color; }
private:
Microsoft::WRL::ComPtr<ID3D12Resource> texture;
struct DescriptorHandles {
D3D12_CPU_DESCRIPTOR_HANDLE cpu;
D3D12_GPU_DESCRIPTOR_HANDLE gpu;
};
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle;
DescriptorHandles srvHandle;
UINT width = 0;
UINT height = 0;
DirectX::SimpleMath::Vector4 clearColor;
};