D3D12_HEAP_FLAGS Enumeration

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,
  D3D12_HEAP_FLAG_SHARED,
  D3D12_HEAP_FLAG_DENY_BUFFERS,
  D3D12_HEAP_FLAG_ALLOW_DISPLAY,
  D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER,
  D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES,
  D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES,
  D3D12_HEAP_FLAG_HARDWARE_PROTECTED,
  D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH,
  D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS,
  D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES,
  D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS,
  D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES,
  D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES
} ;

Constants

D3D12_HEAP_FLAG_NONE No options are specified.
D3D12_HEAP_FLAG_SHARED The heap is shared. Refer to Shared Heaps.
D3D12_HEAP_FLAG_DENY_BUFFERS The heap isn't allowed to contain buffers.
D3D12_HEAP_FLAG_ALLOW_DISPLAY The heap is allowed to contain swap-chain surfaces.
D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER The heap is allowed to share resources across adapters. Refer to Shared Heaps.
D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES The heap is not allowed to store Render Target (RT) and/or Depth-Stencil (DS) textures.
D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES 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 Unsupported. Do not use.
D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH The heap supports MEM_WRITE_WATCH functionality, which causes the system to track the pages that are written to in the commited 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
D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES 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 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 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 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

   
Header d3d12.h

See Also

CD3DX12_HEAP_DESC

Core Enumerations

Descriptor Heaps