imm_atomic_consume (sm5 - asm)

Atomically decrement the hidden 32-bit counter stored with a Count or Append unordered access view (UAV), returning the new value.

imm_atomic_consume dest[.single_component_mask], dstUAV
Item Description
dest
[in] Contains the returned original counter value.
dstUAV
[in] A structured buffer UAV with the Count or Append flag.

Remarks

See imm_atomic_alloc for a discussion about the validity of the returned count value depending on whether the UAV is Count or Append. The same applies for imm_atomic_consume.

imm_atomic_consume does an atomic decrement of the counter value, returning the new value to dest.

There is no clamping of the count, so it wraps on underflow.

The same shader cannot attempt both imm_atomic_alloc and imm_atomic_consume on the same UAV. Further, the GPU cannot allow multiple shader invocations to mix imm_atomic_alloc and imm_atomic_consume on the same UAV.

This instruction applies to the following shader stages:

Vertex Hull Domain Geometry Pixel Compute
X X

Because UAVs are available at all shader stages for Direct3D 11.1, this instruction applies to all shader stages for the Direct3D 11.1 runtime, which is available starting with Windows 8.

Vertex Hull Domain Geometry Pixel Compute
X X X X X X

Minimum Shader Model

This instruction is supported in the following shader models:

Shader Model Supported
Shader Model 5 yes
Shader Model 4.1 no
Shader Model 4 no
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

Shader Model 5 Assembly (DirectX HLSL)