call (HLSL)

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

Prevents inlining of a function.






Applies to function definitions and function calls.


By default, all user-defined HLSL functions are inlined by the HLSL compiler on Xbox 360. Use the call attribute to turn off inlining and decrease the amount of microcode emitted by the HLSL compiler.

You can use the call attribute to control inlining either when the function is defined or when a function is called.

  • If applied to a function definition, the function will not be inlined anywhere.
  • If applied to a function call, the function will not be inlined during the current call, but might be inlined elsewhere.


The following HLSL code snippet demonstrates how to apply the call attribute.

// This function will not be inlined.
float4 ComputePosition1 ()

// This function will be inlined wherever possible.
float4 ComputePosition2 ()

float4 main () : POSITION
  // ComputePosition1 will not be inlined.
  // ComputePosition2 will be inlined at this specific call site.
  float4 pos = ComputePosition1() + ComputePosition2();
  // ComputePosition2 will not be inlined at this specific call site.
  return pos + ComputePosition2();

Community Additions