Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Functions

Functions encapsulate HLSL statements. This enables you to debug a set of functions and then reuse them across shaders or effects. You may want to create a function that encapsulates the functionality of a vertex shader, pixel shader or texture shader. Other times, you may want to write a helper function that performs some commonly used task, and then call that helper function from your shader function. The rules for writing shader functions for HLSL are very similar to writing C functions.

HLSL also has a number of built-in Intrinsic Functions (DirectX HLSL). Because all intrinsic functions are tested and performance optimized, it is good practice to use an intrinsic function where possible instead of creating your own function.

Related topics

Language Syntax (DirectX HLSL)

 

 

Community Additions

Show:
© 2014 Microsoft