-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTexture3D.h
More file actions
26 lines (20 loc) · 857 Bytes
/
Texture3D.h
File metadata and controls
26 lines (20 loc) · 857 Bytes
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
#pragma once
#include <stdint.h>
#include <d3d11.h>
#include <wrl/client.h>
extern Microsoft::WRL::ComPtr<ID3D11Device> g_device;
extern Microsoft::WRL::ComPtr<ID3D11DeviceContext> g_immediateContext;
// Simple Texture3D class.
struct Texture3D
{
Texture3D() = default;
Texture3D(DXGI_FORMAT format, uint32_t W, uint32_t H, uint32_t D)
{
g_device->CreateTexture3D(&CD3D11_TEXTURE3D_DESC(format, W, H, D, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS, D3D11_USAGE_DEFAULT, 0, 0), nullptr, &m_texture);
g_device->CreateShaderResourceView(m_texture.Get(), nullptr, &m_srv);
g_device->CreateUnorderedAccessView(m_texture.Get(), nullptr, &m_uav);
}
Microsoft::WRL::ComPtr<ID3D11Texture3D> m_texture;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_srv;
Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView> m_uav;
};