What does the "in" do in a function's parameter?

What does the “in” do in a function’s parameter?
For example:

//With "in"
inline float4 UnityWorldToClipPos( in float3 pos )
{
    return mul(UNITY_MATRIX_VP, float4(pos, 1.0));
}
//Without "in"
inline float4 UnityWorldToClipPos( float3 pos ) 
{
    return mul(UNITY_MATRIX_VP, float4(pos, 1.0));
}

Nothing. All function variables default to in. You can optionally use out or inout, but any variable that doesn’t define an input modifier uses in implicitly.

Same with inline btw, all functions are inline. There is no other type of function in HLSL.

1 Like