dcl_uav_structured (sm5 - asm)

Declare an unordered access view (UAV) for use by a shader.

dcl_uav_structured[_glc] dstUAV, structByteStride
Item Description
dstUAV
[in] The UAV.
structByteStride
[in] The size of the structure in bytes.

Remarks

dstUAV is a u# register declared as a reference to an UnorderedAccessView of a structured buffer with the specified stride that must be bound to UAV slot # at the API.

The contents of the structure have no type; operations performed on the memory may implicitly interpret the data as having a type.

structByteStride is the size of the structure in bytes in the buffer being declared. This value must be greater than zero. structByteStride is of type uint, and must be a multiple of 4.

Instructions that reference a structured u# take a 2D address, where the first component picks [struct], and the second component picks [offset within struct, in aligned bytes].

The _glc flag means for"globally coherent". The absence of _glc means the UAV is being declared only as "group coherent" in the compute shader, or "locally coherent" in a single pixel shader invocation.

The _opc flag is the order preserving counter. It indicates that if a UAV is bound to slot # (u#), it must have been created with the COUNTER flag. This means that imm_atomic_alloc or imm_atomic_consume operations in the shader manipulate a counter whose values can be used in the shader as a permanent reference to a location in the UAV. Data cannot be reordered after the shader is over.

The absence of the _opc flag means that if the shader usesimm_atomic_alloc or imm_atomic_consume instructions and a UAV is bound to slot # (u), it must have been created with the APPEND flag, which provides a counter that does not guarantee order is preserved after the shader invocation.

If the _opc flag is absent and the shader does not contain imm_atomic_alloc or imm_atomic_consume instructions, a UAV bound to slot # (u) is permitted to have been created with the COUNTER flag (the counter will go unused by this shader), no flag (no counter), but not with the APPEND flag.

Note

cs_4_0 and cs_4_1 supports dcl_tgsm_structured, but not dcl_tgsm_raw.

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

Note

This instruction is supported in cs_4_0 and cs_4_1.

Shader Model 5 Assembly (DirectX HLSL)