MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / Init

Method Init

SampleFramework12/v1.00/Graphics/GraphicsTypes.cpp:28–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void DescriptorHeap::Init(ID3D12Device* device, uint64 numDescriptors, D3D12_DESCRIPTOR_HEAP_TYPE heapType, bool shaderVisible)
29{
30 Shutdown();
31 Assert_(numDescriptors > 0);
32
33 NumDescriptors = numDescriptors;
34 HeapType = heapType;
35 ShaderVisible = shaderVisible;
36 if(heapType == D3D12_DESCRIPTOR_HEAP_TYPE_RTV || heapType == D3D12_DESCRIPTOR_HEAP_TYPE_DSV)
37 ShaderVisible = false;
38
39 DeadList.Init(numDescriptors);
40 for(uint64 i = 0; i < numDescriptors; ++i)
41 DeadList[i] = uint32(i);
42
43 D3D12_DESCRIPTOR_HEAP_DESC heapDesc = { };
44 heapDesc.NumDescriptors = uint32(numDescriptors);
45 heapDesc.Type = heapType;
46 heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
47 if(ShaderVisible)
48 heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
49
50 DXCall(device->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&Heap)));
51
52 CPUStart = Heap->GetCPUDescriptorHandleForHeapStart();
53 if(ShaderVisible)
54 GPUStart = Heap->GetGPUDescriptorHandleForHeapStart();
55
56 DescriptorSize = device->GetDescriptorHandleIncrementSize(heapType);
57}
58
59void DescriptorHeap::Shutdown()
60{

Callers 1

InitializeMethod · 0.45

Calls 3

DXCallFunction · 0.85
Win32CallFunction · 0.85
ShutdownFunction · 0.70

Tested by

no test coverage detected