D3D12_RESOURCE_STATES Enumeration

Specifies the state of a resource regarding how the resource is being used.

Syntax

typedef enum D3D12_RESOURCE_STATES {
  D3D12_RESOURCE_STATE_COMMON,
  D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER,
  D3D12_RESOURCE_STATE_INDEX_BUFFER,
  D3D12_RESOURCE_STATE_RENDER_TARGET,
  D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
  D3D12_RESOURCE_STATE_DEPTH_WRITE,
  D3D12_RESOURCE_STATE_DEPTH_READ,
  D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
  D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
  D3D12_RESOURCE_STATE_STREAM_OUT,
  D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT,
  D3D12_RESOURCE_STATE_COPY_DEST,
  D3D12_RESOURCE_STATE_COPY_SOURCE,
  D3D12_RESOURCE_STATE_RESOLVE_DEST,
  D3D12_RESOURCE_STATE_RESOLVE_SOURCE,
  D3D12_RESOURCE_STATE_GENERIC_READ,
  D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE,
  D3D12_RESOURCE_STATE_PRESENT,
  D3D12_RESOURCE_STATE_PREDICATION,
  D3D12_RESOURCE_STATE_VIDEO_DECODE_READ,
  D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
  D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ,
  D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE,
  D3D12_RESOURCE_STATE_VIDEO_ENCODE_READ,
  D3D12_RESOURCE_STATE_VIDEO_ENCODE_WRITE
} ;

Constants

D3D12_RESOURCE_STATE_COMMON Applications should only transition to this state for accessing a resource across different graphics engine types.

Specifically, a resource must be in the COMMON state before being used on a COPY queue (when previous used on DIRECT/COMPUTE), and before being used on DIRECT/COMPUTE (when previously used on COPY). This restriction does not exist when accessing data between DIRECT and COMPUTE queues.

The COMMON state can be used for all usages on a Copy queue using the implicit state transitions. For more information, in Synchronization and Multi-Engine, find "common".

Additionally, textures must be in the COMMON state for CPU access to be legal, assuming the texture was created in a CPU-visible heap in the first place.

D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER A subresource must be in this state when it is accessed by the 3D pipeline as a vertex buffer or constant buffer. This is a read-only state.
D3D12_RESOURCE_STATE_INDEX_BUFFER A subresource must be in this state when it is accessed by the 3D pipeline as an index buffer. This is a read-only state.
D3D12_RESOURCE_STATE_RENDER_TARGET The resource is used as a render target. A subresource must be in this state when it is rendered to or when it is cleared with ID3D12GraphicsCommandList::ClearRenderTargetView. This is a write-only state. To read from a render target as a shader resource the resource must be in either D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE or D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE.
D3D12_RESOURCE_STATE_UNORDERED_ACCESS The resource is used for unordered access. A subresource must be in this state when it is accessed by the 3D pipeline via an unordered access view. A subresource must also be in this state when it is cleared with ID3D12GraphicsCommandList::ClearUnorderedAccessViewInt or ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat. This is a read/write state.
D3D12_RESOURCE_STATE_DEPTH_WRITE DEPTH_WRITE is a state which is mutually exclusive with other states. It should be used for ID3D12GraphicsCommandList::ClearDepthStencilView when the flags (see D3D12_CLEAR_FLAGS) indicate a given subresource should be cleared (otherwise the subresource state doesn't matter), or when using it in a writable depth stencil view (see D3D12_DSV_FLAGS) when the PSO has depth write enabled (see D3D12_DEPTH_STENCIL_DESC).
D3D12_RESOURCE_STATE_DEPTH_READ DEPTH_READ is a state which can be combined with other states. It should be used when the subresource is in a read-only depth stencil view, or when the DepthEnable parameter of D3D12_DEPTH_STENCIL_DESC is false. It can be combined with other read states (for example, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE), such that the resource can be used for the depth or stencil test, and accessed by a shader within the same draw call. Using it when depth will be written by a draw call or clear command is invalid.
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE The resource is used with a shader other than the pixel shader. A subresource must be in this state before being read by any stage (except for the pixel shader stage) via a shader resource view. You can still use the resource in a pixel shader with this flag as long as it also has the flag D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE set. This is a read-only state.
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE The resource is used with a pixel shader. A subresource must be in this state before being read by the pixel shader via a shader resource view. This is a read-only state.
D3D12_RESOURCE_STATE_STREAM_OUT The resource is used with stream output. A subresource must be in this state when it is accessed by the 3D pipeline as a stream-out target. This is a write-only state.
D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT The resource is used as an indirect argument. Subresources must be in this state when they are used as the argument buffer passed to the indirect drawing method ID3D12GraphicsCommandList::ExecuteIndirect. This is a read-only state.
D3D12_RESOURCE_STATE_COPY_DEST The resource is used as the destination in a copy operation. Subresources must be in this state when they are used as the destination of copy operation, or a blt operation. This is a write-only state.
D3D12_RESOURCE_STATE_COPY_SOURCE The resource is used as the source in a copy operation. Subresources must be in this state when they are used as the source of copy operation, or a blt operation. This is a read-only state.
D3D12_RESOURCE_STATE_RESOLVE_DEST The resource is used as the destination in a resolve operation.
D3D12_RESOURCE_STATE_RESOLVE_SOURCE The resource is used as the source in a resolve operation.
D3D12_RESOURCE_STATE_GENERIC_READ This is the required starting state for upload heaps. Applications should generally avoid this state when possible, and instead transition resources to only the actually-used states.
D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE
D3D12_RESOURCE_STATE_PRESENT Synonymous with D3D12_RESOURCE_STATE_COMMON.
D3D12_RESOURCE_STATE_PREDICATION The resource is used for Predication.
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ The resource is used to read compressed video data during video decoding; that is, the resource is used as the source in a decode operation.
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE The resource is used to write decompressed video data during video decoding; that is, the resource is used as the destination in a decode operation.
D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ The resource is used to read video data during video processing; that is, the resource is used as the source in a processing operation such as video encoding (compression).
D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE The resource is used to write video data during video processing; that is, the resource is used as the destination in a processing operation such as video encoding (compression).
D3D12_RESOURCE_STATE_VIDEO_ENCODE_READ
D3D12_RESOURCE_STATE_VIDEO_ENCODE_WRITE

Remarks

This enum is used by the following methods:

Requirements

   
Header d3d12.h

See Also

Core Enumerations

Using Resource Barriers to Synchronize Resource States in Direct3D 12