共用方式為


unroll (360 HLSL)

Note

This HLSL attribute is available only when developing for the Xbox 360.

Avoids flow-control constructs.

Syntax

[unroll(MaxIterationCount)]

Parameters

  • MaxIterationCount
    An integer that represents the iteration count. The MaxIterationCount parameter is optional. If it is omitted, the HLSL compiler automatically determines the iteration count.

Scope

Applies to for, while, and do-while statements.

Remarks

The iteration count can be any arbitrary expression and is handled much like inline microcode options. For example, the iteration count can be a function parameter. The HLSL compiler automatically inlines the function to resolve the parameter to a constant.

Examples

The following HLSL code snippet shows how to apply the unroll attribute.

float value = 0;
[unroll(3)]
while( value <= 5 )
{
  value ++;
}
    

See Also

Concepts

HLSL Attributes (Xbox 360)
Attribute Syntax
Attribute Categories

Reference

HLSL Attributes Reference (Xbox 360)