Direct3D 12 - Allowed Resource States per Queue

By Vilem Otte

directx, rendering

Depending on the command queue type, there are certain limitations to what resource states are allowed. Let's also keep in mind that any state transition under given queue should be valid under it. There are 3 main types of command queues - direct (D3D12_COMMAND_LIST_TYPE_DIRECT), compute (D3D12_COMMAND_LIST_TYPE_COMPUTE), bundle (D3D12_COMMAND_LIST_TYPE_BUNDLE) and copy (D3D12_COMMAND_LIST_TYPE_COPY). Depending on which one is used, different resource states (and transitions of those) is allowed.

The allowed lists are following:

Copy

  • D3D12_RESOURCE_STATE_COMMON
  • D3D12_RESOURCE_STATE_COPY_DEST
  • D3D12_RESOURCE_STATE_COPY_SOURCE

Compute

  • D3D12_RESOURCE_STATE_COMMON
  • D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER
  • D3D12_RESOURCE_STATE_UNORDERED_ACCESS
  • D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE
  • D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT
  • D3D12_RESOURCE_STATE_COPY_DEST
  • D3D12_RESOURCE_STATE_COPY_SOURCE

Graphics

  • 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_RAYTRACING_ACCELERATION_STRUCTURE
  • D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE
  • D3D12_RESOURCE_STATE_GENERIC_READ
  • D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE
  • 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

Detailed information about states is available at https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_resource_states

Skye Cuillin

Notes for Skye Cuillin game engine - the implementation relies on using proper context Context vs. ComputeContext vs. GraphicsContext - which map to copy, compute and direct. Non-allowed state transition is reported in Debug mode within output when D3D12 debugging layer is enabled.

v0.0.65