只能用在片段着色器。
w = fwidth(uv);
w.x = abs(dFdx(uv).x);
w.y = abs(dFdy(uv).y);
genType fwidth( genType p);
genType fwidthCoarse( genType p);
genType fwidthFine( genType p);
p
Specifies the expression of which to take the partial derivative.
Available only in the fragment shader, these functions return the sum of the absolute derivatives in x and y using local differencing for the input argument p. fwidth is equivalent to abs(dFdx(p)) + abs(dFdy(p)) . fwidthCoarse is equivalent to abs(dFdxCoarse(p)) + abs(dFdyCoarse(p)) . fwidthFine is equivalent to abs(dFdxFine(p)) + abs(dFdyFine(p)) .