| 42 | D3D12DescriptorHeap::~D3D12DescriptorHeap() = default; |
| 43 | |
| 44 | ref<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 | |
| 74 | D3D12DescriptorHeap::GpuHandle D3D12DescriptorHeap::getBaseGpuHandle() const |
| 75 | { |
nothing calls this directly
no test coverage detected