ID3D12Device4::CreateHeap1 method (d3d12.h)

Creates a heap (optionally for a protected session) that can be used with placed resources and reserved resources. Also see ID3D12Device::CreateHeap.

Syntax

HRESULT CreateHeap1(
  [in]            const D3D12_HEAP_DESC          *pDesc,
  [in, optional]  ID3D12ProtectedResourceSession *pProtectedSession,
  [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, optional] pProtectedSession

Type: ID3D12ProtectedResourceSession*

An optional pointer to an object that represents a session for content protection. If provided, this session indicates that the heap should be protected. You can obtain an ID3D12ProtectedResourceSession by calling ID3D12Device4::CreateProtectedResourceSession.

A heap with a protected session can't be created with the D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER flag.

[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

CreateHeap1 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
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Target Platform Windows
Header d3d12.h
Library d3d12.lib
DLL d3d12.dll