MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / Texture2DArray

Class Texture2DArray

TombEngine/Renderer/Graphics/Texture2DArray.h:14–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 using Microsoft::WRL::ComPtr;
13
14 class Texture2DArray : public TextureBase
15 {
16 public:
17
18 std::vector<ComPtr<ID3D11RenderTargetView>> RenderTargetView;
19 ComPtr<ID3D11Texture2D> Texture;
20 std::vector<ComPtr<ID3D11DepthStencilView>> DepthStencilView;
21 ComPtr<ID3D11Texture2D> DepthStencilTexture;
22 int Resolution;
23 D3D11_VIEWPORT Viewport;
24
25 Texture2DArray() : Resolution(0), Viewport({}) {};
26
27 Texture2DArray(Texture2DArray&& other) noexcept
28 : TextureBase(std::move(other)),
29 RenderTargetView(std::move(other.RenderTargetView)),
30 Texture(std::move(other.Texture)),
31 DepthStencilView(std::move(other.DepthStencilView)),
32 DepthStencilTexture(std::move(other.DepthStencilTexture)),
33 Resolution(other.Resolution), Viewport(other.Viewport),
34 _vramSize(other._vramSize)
35 {
36 other._vramSize = 0;
37 }
38
39 Texture2DArray& operator=(Texture2DArray&& other) noexcept
40 {
41 if (this != &other)
42 {
43 if (_vramSize > 0)
44 VRAMTracker::Get().Remove(VRAMCategory::RenderTarget, _vramSize);
45
46 TextureBase::operator=(std::move(other));
47 RenderTargetView = std::move(other.RenderTargetView);
48 Texture = std::move(other.Texture);
49 DepthStencilView = std::move(other.DepthStencilView);
50 DepthStencilTexture = std::move(other.DepthStencilTexture);
51 Resolution = other.Resolution;
52 Viewport = other.Viewport;
53 _vramSize = other._vramSize;
54 other._vramSize = 0;
55 }
56 return *this;
57 }
58
59 Texture2DArray(const Texture2DArray&) = delete;
60 Texture2DArray& operator=(const Texture2DArray&) = delete;
61
62 Texture2DArray(ID3D11Device* device, int resolution, int count, DXGI_FORMAT colorFormat, DXGI_FORMAT depthFormat)
63 : Resolution(resolution)
64 {
65 DepthStencilView.resize(count);
66 RenderTargetView.resize(count);
67 D3D11_TEXTURE2D_DESC desc = {};
68 desc.Width = resolution;
69 desc.Height = resolution;
70 desc.MipLevels = 1;
71 desc.ArraySize = count;

Callers 1

InitializeScreenMethod · 0.85

Calls 2

operator=Function · 0.85
RemoveMethod · 0.45

Tested by

no test coverage detected