D3D12_RESOURCE_FLAGS enumeration (d3d12.h)

Defines constants that specify options for working with resources.

Syntax

typedef enum D3D12_RESOURCE_FLAGS {
  D3D12_RESOURCE_FLAG_NONE = 0,
  D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET = 0x1,
  D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL = 0x2,
  D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4,
  D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8,
  D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10,
  D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20,
  D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY = 0x40,
  D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY = 0x80,
  D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE = 0x100
} ;

Constants

 
D3D12_RESOURCE_FLAG_NONE
Value: 0
No options are specified.
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET
Value: 0x1
Allows a render target view to be created for the resource; and also enables the resource to transition into the state of D3D12_RESOURCE_STATE_RENDER_TARGET. Some adapter architectures allocate extra memory for textures with this flag to reduce the effective bandwidth during common rendering. This characteristic may not be beneficial for textures that are never rendered to, nor is it available for textures compressed with BC formats. Your application should avoid setting this flag when rendering will never occur.

The following restrictions and interactions apply:
D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL
Value: 0x2
Allows a depth stencil view to be created for the resource, as well as enables the resource to transition into the state of D3D12_RESOURCE_STATE_DEPTH_WRITE and/or D3D12_RESOURCE_STATE_DEPTH_READ. Most adapter architectures allocate extra memory for textures with this flag to reduce the effective bandwidth, and maximize optimizations for early depth-test. Your application should avoid setting this flag when depth operations will never occur.

The following restrictions and interactions apply:

  • Either the texture format must support depth stencil capabilities at the current feature level. Or, when the format is a typeless format, a format within the same typeless group must support depth stencil capabilities at the current feature level.

  • Can't be used with D3D12_RESOURCE_DIMENSION_BUFFER, 4KB alignment, D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS, D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, nor used with heaps that have D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES or D3D12_HEAP_FLAG_ALLOW_DISPLAY.

  • Precludes usage of WriteToSubresource and ReadFromSubresource.

  • Precludes GPU copying of a subregion. CopyTextureRegion must copy a whole subresource to or from resources with this flag.

D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS
Value: 0x4
Allows an unordered access view to be created for the resource, as well as enables the resource to transition into the state of D3D12_RESOURCE_STATE_UNORDERED_ACCESS. Some adapter architectures must resort to less efficient texture layouts in order to provide this functionality. If a texture is rarely used for unordered access, then it might be worth having two textures around and copying between them. One texture would have this flag, while the other wouldn't. Your application should avoid setting this flag when unordered access operations will never occur.

The following restrictions and interactions apply:
D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE
Value: 0x8
Disallows a shader resource view from being created for the resource, as well as disables the resource from transitioning into the state of D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE or D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE. Some adapter architectures gain bandwidth capacity for depth stencil textures when shader resource views are precluded. If a texture is rarely used for shader resources, then it might be worth having two textures around and copying between them. One texture would have this flag, while the other wouldn't. Your application should set this flag when depth stencil textures will never be used from shader resource views.

The following restrictions and interactions apply:

  • Must be used with D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL.

D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER
Value: 0x10
Allows the resource to be used for cross-adapter data, as well as those features enabled by D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS. Cross-adapter resources commonly preclude techniques that reduce effective texture bandwidth during usage, and some adapter architectures might require different caching behavior. Your application should avoid setting this flag when the resource data will never be used with another adapter.

The following restrictions and interactions apply:
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS
Value: 0x20
Allows a resource to be simultaneously accessed by multiple different queues, devices, or processes (for example, allows a resource to be used with ResourceBarrier transitions performed in more than one command list executing at the same time).

Simultaneous access allows multiple readers and one writer, as long as the writer doesn't concurrently modify the texels that other readers are accessing. Some adapter architectures can't leverage techniques to reduce effective texture bandwidth during usage.

However, your application should avoid setting this flag when multiple readers are not required during frequent, non-overlapping writes to textures. Use of this flag can compromise resource fences to perform waits, and prevent any compression being used with a resource.

The following restrictions and interactions apply:

  • Can't be used with D3D12_RESOURCE_DIMENSION_BUFFER; but buffers always have the properties represented by this flag.

  • Can't be used with MSAA textures.

  • Can't be used with D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL.

D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY
Value: 0x40
Specfies that this resource may be used only as a decode reference frame. It may be written to or read only by the video decode operation.

D3D12_VIDEO_DECODE_TIER_1 and D3D12_VIDEO_DECODE_TIER_2 may report D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_REFERENCE_ONLY_ALLOCATIONS_REQUIRED in the D3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT structure configuration flag. If that happens, then your application must allocate reference frames with the D3D12_RESOURCE_FLAGS::D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY resource flag.

D3D12_VIDEO_DECODE_TIER_3 must not set the [D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_REFERENCE_ONLY_ALLOCATIONS_REQUIRED]
(../d3d12video/ne-d3d12video-d3d12_video_decode_configuration_flags) configuration flag, and must not require the use of this resource flag.
D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY
Value: 0x80
Specfies that this resource may be used only as an encode reference frame. It may be written to or read only by the video encode operation.
D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE
Value: 0x100
Reserved for future use. Don't use.

Requires the DirectX 12 Agility SDK 1.7 or later. Indicates that a buffer is to be used as a raytracing acceleration structure.

Remarks

This enum is used by the Flags member of the D3D12_RESOURCE_DESC.

Requirements

Requirement Value
Header d3d12.h

See also