retc (sm4 - asm)

Conditional return.

retc{_z|_nz} src0.select_component
Item Description
src0
[in] The register to test the condition against.

Remarks

If within a subroutine, this instruction conditionally returns to the instruction after the call. If not inside a subroutine, this instruction terminates program execution.

The following example shows how to use this instruction.

           ...
           call l3
           ...
           ret
           label l3
               ...
               retc_nz r0.x  // If any bit in r0.x is nonzero, then return
               retc_z  r1.x  // If all bits in r0.x are zero, then return.
               ...
           ret

Restrictions

  • retc can appear anywhere in a program, any number of times.
  • The last instruction in a main program or subroutine cannot be a retc_z or retc_nz. Instead, the unconditional ret can be used.
  • The 32-bit register supplied by src0 is tested at a bit level. If any bit is nonzero, ret_nz will return. If all bits are zero, retc_z will return.

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)