ret (sm4 - asm)

Return statement.

ret

 

Remarks

If within a subroutine, return to the instruction after the call. If not inside a subroutine, terminate program execution.

The following example shows how to use this instruction.

 
               ...
                call l3
                ...
                ret
                label l3
                    ...
                ret

Restrictions

  • ret can appear anywhere in a program, any number of times.
  • If a label instruction appears in a Shader, it must be preceded by a ret command that is not nested in any flow control statements.
  • If there are subroutines in a Shader, the last instruction in the Shader must be a ret.

This instruction applies to the following shader stages:

Vertex Shader Geometry Shader Pixel Shader
x x x

 

Minimum Shader Model

This function is supported in the following shader models.

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

 

Shader Model 4 Assembly (DirectX HLSL)