ID3D12Device::CreateHeap method

Creates a heap that can be used with placed resources and reserved resources.


HRESULT CreateHeap(
  const D3D12_HEAP_DESC *pDesc,
  REFIID                riid,
  void                  **ppvHeap



Type: const D3D12_HEAP_DESC*

A pointer to a D3D12_HEAP_DESC structure that describes the heap.



The globally unique identifier (GUID) for the heap interface. This is an input parameter. The REFIID, or GUID, of the interface to the heap can be obtained by using the __uuidof() macro. For example, __uuidof(ID3D12Heap) will get the GUID of the interface to a heap. riid is, most commonly, the GUID for ID3D12Heap, but it may be any GUID for any interface. If the resource object does not support the interface for the specified GUID, creation will fail with E_NOINTERFACE.


Type: void**

A pointer to a memory block that receives a pointer to the heap. ppvHeap can be NULL, to enable capability testing. When ppvHeap is NULL, no object will be created and S_FALSE will be returned when pDesc is valid.

Return Value


This method returns E_OUTOFMEMORY if there is insufficient memory to create the heap. See Direct3D 12 Return Codes for other possible return values.


CreateHeap creates a heap that can be used with placed resources and reserved resources. Before releasing the final reference on the heap, the application must ensure that the GPU will no longer read or write to this heap. Placed resource objects will hold a reference on the heap they are created on, but reserved resources will not hold a reference for each mapping made to a heap.


Target Platform Windows
Header d3d12.h
Library D3D12.lib
DLL D3D12.dll

See Also


Shared Heaps