Export (0) Print
Expand All

reduceTempRegUsage (HLSL)

Bb313986.note(en-us,XNAGameStudio.31).gifNote
This HLSL attribute is available only when developing for the Xbox 360.

Restricts temporary register usage to the number of registers specified. Generates a compiler warning if unsuccessful.

Syntax

[reduceTempRegUsage(n)]

Parameters

n
Integer that represents the maximum number of temporary registers.

Scope

Applies to functions. The reduceTempRegUsage attribute is ignored on any function except the shader entry point that is currently being compiled.

Remarks

If the HLSL compiler is unable to restrict temporary registers to the number specified by the reduceTempRegUsage attribute, the HLSL compiler reports a warning and then compiles by using the number of temporary registers as close as possible to the number specified.

Note that the maxtempreg attribute also restricts temporary register usage. However, the maxtempreg attribute reports an error and fails to compile if it is unable to restrict temporary registers to the number specified.

Examples

The following HLSL code snippet demonstrates how to apply the reduceTempRegUsage attribute and the maxtempreg attribute. This example specifies that the compiler should never allocate more than 32 registers for temporary usage, but should try to stay as close to 12 registers as possible. If the compiler exceeds an allocation of 12 registers, it displays a warning. However, if the compiler exceeds 32 registers, it displays an error and fails to compile the shader.

[maxtempreg(32)]
[reduceTempRegUsage(12)]
float4 main ( float4 in )
{
// ...
}
    

Community Additions

ADD
Show:
© 2014 Microsoft