WebGPU.rocks Logo

Derivative built-in functions

Partial Derivatives

fn dpdx(e: T) -> T

Returns the partial derivative of e with respect to window x coordinates. The result is the same as either dpdxFine(e) or dpdxCoarse(e).

fn dpdxCoarse(e: T) -> T

Returns the partial derivative of e with respect to window x coordinates using local differences. This may result in fewer unique positions that dpdxFine(e).

fn dpdxFine(e: T) -> T

Returns the partial derivative of e with respect to window x coordinates.

fn dpdy(e: T) -> T

Returns the partial derivative of e with respect to window y coordinates. The result is the same as either dpdyFine(e) or dpdyCoarse(e).

fn dpdyCoarse(e: T) -> T

Returns the partial derivative of e with respect to window y coordinates using local differences. This may result in fewer unique positions that dpdyFine(e).

fn dpdyFine(e: T) -> T

Returns the partial derivative of e with respect to window y coordinates.

fn fwidth(e: T) -> T

Returns abs(dpdx(e)) + abs(dpdy(e)).

fn fwidthCoarse(e: T) -> T

Returns abs(dpdxCoarse(e)) + abs(dpdyCoarse(e)).

fn fwidthFine(e: T) -> T

Returns abs(dpdxFine(e)) + abs(dpdyFine(e)).