ID3D12DebugCommandList1::AssertResourceState method (d3d12sdklayers.h)

Validates that the given state matches the state of the subresource, assuming the state of the given subresource is known during recording of a command list (e.g. the resource was transitioned earlier in the same command list recording). If the state is not yet known this method sets the known state for further validation later in the same command list recording.

Syntax

BOOL AssertResourceState(
  [in] ID3D12Resource *pResource,
       UINT           Subresource,
       UINT           State
);

Parameters

[in] pResource

Type: ID3D12Resource*

Specifies the ID3D12Resource to check.

Subresource

Type: UINT

The index of the subresource to check. This can be set to an index, or D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES.

State

Type: UINT

Specifies the state to check for. This can be one or more D3D12_RESOURCE_STATES flags Or'ed together.

Return value

Type: BOOL

This method returns true if the tracked state of the resource or subresource matches the specified state, false otherwise.

Remarks

Since execution of command lists occurs sometime after recording, the state of a resource often cannot be known during command list recording. AssertResourceState gives an application developer the ability to impose an assumed state on a resource or subresource at a fixed recording point in a command list.

Often the state of a resource or subresource can either be known due to a previous barrier or inferred-by-use (for example, was used in an earlier call to CopyBufferRegion) during command list recording. In such cases AssertResourceState can produce a debug message if the given state does not match the known or assumed state.

This API is for debug validation only and does not affect the actual runtime or GPU state of the resource.

Requirements

Requirement Value
Target Platform Windows
Header d3d12sdklayers.h

See also

ID3D12DebugCommandList1