ID3D12Device::CreateHeap method (d3d12.h)

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

Syntax

HRESULT CreateHeap(
  [in]            const D3D12_HEAP_DESC *pDesc,
  [in]            REFIID                riid,
  [out, optional] void                  **ppvHeap
);

Parameters

[in] pDesc

Type: const D3D12_HEAP_DESC*

A pointer to a constant D3D12_HEAP_DESC structure that describes the heap.

[in] riid

Type: REFIID

A reference to the globally unique identifier (GUID) of the heap interface to return in ppvHeap.

While riidResource is most commonly the GUID of ID3D12Heap, it may be the GUID of any interface. If the resource object doesn't support the interface for this GUID, then creation fails with E_NOINTERFACE.

[out, optional] ppvHeap

Type: void**

An optional pointer to a memory block that receives the requested interface pointer to the created heap object.

ppvHeap can be nullptr, to enable capability testing. When ppvHeap is nullptr, no object is created, and S_FALSE is returned when pDesc is valid.

Return value

Type: HRESULT

If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Return value Description
E_OUTOFMEMORY There is insufficient memory to create the heap.

See Direct3D 12 return codes for other possible return values.

Remarks

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

Before releasing the final reference on the heap, your application must ensure that the GPU will no longer read or write to this heap.

A placed resource object holds a reference on the heap it is created on; but a reserved resource doesn't hold a reference for each mapping made to a heap.

Requirements

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

See also

ID3D12Device

Shared heaps