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 dst0[.single_component_mask], dstUAV




[in] Contains the returned original counter value.


[in] A structured buffer UAV with the Count or Append flag.



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 dst0.

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:



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.



Minimum Shader Model

This instruction is supported in the following shader models:

Shader ModelSupported
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


Related topics

Shader Model 5 Assembly (DirectX HLSL)