#include #include struct derivativesInput { }; struct derivativesOutput { metal::float4 member [[color(0)]]; }; fragment derivativesOutput derivatives( metal::float4 foo [[position]] ) { metal::float4 x = metal::dfdx(foo); metal::float4 y = metal::dfdy(foo); metal::float4 z = metal::fwidth(foo); return derivativesOutput { (x + y) * z }; }