MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / create

Method create

Source/Falcor/Core/API/Shared/D3D12DescriptorHeap.cpp:44–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42D3D12DescriptorHeap::~D3D12DescriptorHeap() = default;
43
44ref<D3D12DescriptorHeap> D3D12DescriptorHeap::create(
45 Device* pDevice,
46 D3D12_DESCRIPTOR_HEAP_TYPE type,
47 uint32_t descCount,
48 bool shaderVisible
49)
50{
51 FALCOR_ASSERT(pDevice);
52 pDevice->requireD3D12();
53 ID3D12Device* pD3D12Device = pDevice->getNativeHandle().as<ID3D12Device*>();
54
55 uint32_t chunkCount = (descCount + kDescPerChunk - 1) / kDescPerChunk;
56 ref<D3D12DescriptorHeap> pHeap = ref<D3D12DescriptorHeap>(new D3D12DescriptorHeap(pDevice, type, chunkCount, shaderVisible));
57 D3D12_DESCRIPTOR_HEAP_DESC desc = {};
58
59 desc.Flags = shaderVisible ? D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE : D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
60 desc.Type = type;
61 desc.NumDescriptors = chunkCount * kDescPerChunk;
62 if (FAILED(pD3D12Device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&pHeap->mApiHandle))))
63 {
64 FALCOR_THROW("Failed to create descriptor heap");
65 }
66
67 pHeap->mCpuHeapStart = pHeap->mApiHandle->GetCPUDescriptorHandleForHeapStart();
68 if (shaderVisible)
69 pHeap->mGpuHeapStart = pHeap->mApiHandle->GetGPUDescriptorHandleForHeapStart();
70
71 return pHeap;
72}
73
74D3D12DescriptorHeap::GpuHandle D3D12DescriptorHeap::getBaseGpuHandle() const
75{

Callers

nothing calls this directly

Calls 2

requireD3D12Method · 0.80
getNativeHandleMethod · 0.45

Tested by

no test coverage detected