D3D12_HEAP_FLAGS enumeration (d3d12.h)

Specifies heap options, such as whether the heap can contain textures, and whether resources are shared across adapters.

Syntax

typedef enum D3D12_HEAP_FLAGS {
  D3D12_HEAP_FLAG_NONE = 0,
  D3D12_HEAP_FLAG_SHARED = 0x1,
  D3D12_HEAP_FLAG_DENY_BUFFERS = 0x4,
  D3D12_HEAP_FLAG_ALLOW_DISPLAY = 0x8,
  D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20,
  D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40,
  D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80,
  D3D12_HEAP_FLAG_HARDWARE_PROTECTED = 0x100,
  D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH = 0x200,
  D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS = 0x400,
  D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT = 0x800,
  D3D12_HEAP_FLAG_CREATE_NOT_ZEROED = 0x1000,
  D3D12_HEAP_FLAG_TOOLS_USE_MANUAL_WRITE_TRACKING,
  D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0,
  D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xc0,
  D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44,
  D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84
} ;

Constants

 
D3D12_HEAP_FLAG_NONE
Value: 0
No options are specified.
D3D12_HEAP_FLAG_SHARED
Value: 0x1
The heap is shared. Refer to Shared Heaps.
D3D12_HEAP_FLAG_DENY_BUFFERS
Value: 0x4
The heap isn't allowed to contain buffers.
D3D12_HEAP_FLAG_ALLOW_DISPLAY
Value: 0x8
The heap is allowed to contain swap-chain surfaces.
D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER
Value: 0x20
The heap is allowed to share resources across adapters. Refer to Shared Heaps. A protected session cannot be mixed with resources that are shared across adapters.
D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES
Value: 0x40
The heap is not allowed to store Render Target (RT) and/or Depth-Stencil (DS) textures.
D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES
Value: 0x80
The heap is not allowed to contain resources with D3D12_RESOURCE_DIMENSION_TEXTURE1D, D3D12_RESOURCE_DIMENSION_TEXTURE2D, or D3D12_RESOURCE_DIMENSION_TEXTURE3D unless either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL are present. Refer to D3D12_RESOURCE_DIMENSION and D3D12_RESOURCE_FLAGS.
D3D12_HEAP_FLAG_HARDWARE_PROTECTED
Value: 0x100
Unsupported. Do not use.
D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH
Value: 0x200
The heap supports MEM_WRITE_WATCH functionality, which causes the system to track the pages that are written to in the committed memory region. This flag can't be combined with the D3D12_HEAP_TYPE_DEFAULT or D3D12_CPU_PAGE_PROPERTY_UNKNOWN flags. Applications are discouraged from using this flag themselves because it prevents tools from using this functionality.
D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS
Value: 0x400
Ensures that atomic operations will be atomic on this heap's memory, according to components able to see the memory.

Creating a heap with this flag will fail under either of these conditions.
- The heap type is D3D12_HEAP_TYPE_DEFAULT, and the heap can be visible on multiple nodes, but the device does not support D3D12_CROSS_NODE_SHARING_TIER_3.
- The heap is CPU-visible, but the heap type is not D3D12_HEAP_TYPE_CUSTOM.

Note that heaps with this flag might be a limited resource on some systems.
D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT
Value: 0x800
The heap is created in a non-resident state and must be made resident using ID3D12Device::MakeResident or ID3D12Device3::EnqueueMakeResident.

By default, the final step of heap creation is to make the heap resident, so this flag skips this step and allows the application to decide when to do so.
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED
Value: 0x1000
Allows the OS to not zero the heap created. By default, committed resources and heaps are almost always zeroed upon creation. This flag allows this to be elided in some scenarios. However, it doesn't guarantee it. For example, memory coming from other processes still needs to be zeroed for data protection and process isolation. This can lower the overhead of creating the heap.
D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES
Value: 0
The heap is allowed to store all types of buffers and/or textures. This is an alias; for more details, see "Aliases" in the Remarks section.
D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS
Value: 0xc0
The heap is only allowed to store buffers. This is an alias; for more details, see "Aliases" in the Remarks section.
D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES
Value: 0x44
The heap is only allowed to store non-RT, non-DS textures. This is an alias; for more details, see "Aliases" in the Remarks section.
D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES
Value: 0x84
The heap is only allowed to store RT and/or DS textures. This is an alias; for more details, see "Aliases" in the Remarks section.

Remarks

This enum is used by the following API items:

The following heap flags must be used with ID3D12Device::CreateHeap, but will be set automatically for implicit heaps created by ID3D12Device::CreateCommittedResource. Adapters that only support heap tier 1 must set two out of the three following flags.
Value Description
D3D12_HEAP_FLAG_DENY_BUFFERS The heap isn't allowed to contain resources with D3D12_RESOURCE_DIMENSION_BUFFER (which is a D3D12_RESOURCE_DIMENSION enumeration constant).
D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES The heap isn't allowed to contain resources with D3D12_RESOURCE_DIMENSION_TEXTURE1D, D3D12_RESOURCE_DIMENSION_TEXTURE2D, or D3D12_RESOURCE_DIMENSION_TEXTURE3D together with either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL. (The latter two items are D3D12_RESOURCE_FLAGS enumeration constants.)
D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES The heap isn't allowed to contain resources with D3D12_RESOURCE_DIMENSION_TEXTURE1D, D3D12_RESOURCE_DIMENSION_TEXTURE2D, or D3D12_RESOURCE_DIMENSION_TEXTURE3D unless D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET and D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL are absent.

Aliases

Adapters that support heap tier 2 or greater are additionally allowed to set none of the above flags. Aliases for these flags are available for applications that prefer thinking only of which resources are supported.

The following aliases exist, so be careful when doing bit-manipulations:

  • D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0 and is only supported on heap tier 2 and greater.
  • D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES
  • D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES
  • D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES

Displayable heaps

Displayable heaps are most commonly created by the swapchain for presentation, to enable scanning out to a monitor.

Displayable heaps are specified with the D3D12_HEAP_FLAG_ALLOW_DISPLAY member of the D3D12_HEAP_FLAGS enum.

Applications may create displayable heaps outside of a swapchain; but cannot actually present with them. This flag is not supported by CreateHeap and can only be used with CreateCommittedResource with D3D12_HEAP_TYPE_DEFAULT.

Additional restrictions to the D3D12_RESOURCE_DESC apply to the resource created with displayable heaps.

  • The format must not only be supported by the device, but must be supported for scan-out. Refer to the use of the D3D12_FORMAT_SUPPORT1_DISPLAY member of D3D12_FORMAT_SUPPORT1.
  • Dimension must be D3D12_RESOURCE_DIMENSION_TEXTURE2D.
  • Alignment must be 0.
  • ArraySize may be either 1 or 2.
  • MipLevels must be 1.
  • SampleDesc must have Count set to 1 and Quality set to 0.
  • Layout must be D3D12_TEXTURE_LAYOUT_UNKNOWN.
  • D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL and D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER are invalid flags.

Requirements

Requirement Value
Header d3d12.h

See also

CD3DX12_HEAP_DESC

Core Enumerations

Descriptor Heaps