ubfe (sm5 - asm)

Given a range of bits in a number, shift those bits to the LSB and set remaining bits to 0.

ubfe dest[.mask], src0[.swizzle], src1[.swizzle], src2[.swizzle]
Item Description
dest
[in] Contains the results of the instruction.
src0
[in] The LSB 5 bits provide the bitfield width (0-31).
src1
[in] The LSB 5 bits of src1 provide the bitfield offset (0-31).
src2
[in] The number to shift.

Remarks

 
        Given width, offset:
                if( width == 0 )
                {
                    dest = 0
                }
                else if( width + offset < 32 )
                {
                    shl dest, src2, 32-(width+offset)
                    ushr dest, dest, 32-width
                }
                else
                {
                    ushr dest, src2, offset
                }

Use this instruction to unpack unsigned integers or flags.

This instruction applies to the following shader stages:

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)