MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / DX11TextureDS

Method DX11TextureDS

GTE/Graphics/DX11/DX11TextureDS.cpp:17–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17DX11TextureDS::DX11TextureDS(ID3D11Device* device, TextureDS const* texture)
18 :
19 DX11Texture2(texture),
20 mDSView(nullptr)
21{
22 // Specify the texture description.
23 D3D11_TEXTURE2D_DESC desc;
24 desc.Width = texture->GetWidth();
25 desc.Height = texture->GetHeight();
26 desc.MipLevels = 1;
27 desc.ArraySize = 1;
28 desc.Format = GetDepthResourceFormat(static_cast<DXGI_FORMAT>(texture->GetFormat()));
29 desc.SampleDesc.Count = 1;
30 desc.SampleDesc.Quality = 0;
31 desc.Usage = D3D11_USAGE_DEFAULT;
32 desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
33 desc.CPUAccessFlags = D3D11_CPU_ACCESS_NONE;
34 desc.MiscFlags = (texture->IsShared() ?
35 D3D11_RESOURCE_MISC_SHARED : D3D11_RESOURCE_MISC_NONE);
36 if (texture->IsShaderInput())
37 {
38 desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
39 }
40
41 // Create the texture. Depth-stencil textures are not initialized by
42 // system memory data.
43 ID3D11Texture2D* dxTexture = nullptr;
44 DX11Log(device->CreateTexture2D(&desc, nullptr, &dxTexture));
45 mDXObject = dxTexture;
46
47 // Create a view of the texture.
48 CreateDSView(device);
49
50 // Create a shader resource view if the depth-stencil is to be used as an
51 // input to shaders.
52 if (texture->IsShaderInput())
53 {
54 CreateDSSRView(device);
55 }
56
57 // Create a staging texture if requested.
58 if (texture->GetCopy() != Resource::Copy::NONE)
59 {
60 CreateStaging(device, desc);
61 }
62}
63
64DX11TextureDS::DX11TextureDS(ID3D11Device* device, DX11TextureDS const* dxSharedTexture)
65 :

Callers

nothing calls this directly

Calls 8

IsSharedMethod · 0.80
IsShaderInputMethod · 0.80
CreateSharedDXObjectMethod · 0.80
GetWidthMethod · 0.45
GetHeightMethod · 0.45
GetFormatMethod · 0.45
GetCopyMethod · 0.45
GetTextureMethod · 0.45

Tested by

no test coverage detected