dpdx()
Function in Builtins
dpdx(x): the screen-space partial derivative of x along the X axis, component-wise.
import { dpdx } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
const dpdx: <K extends FloatKey>(x: ReadonlyNode<K>) => Node<K>Parameters
xReadonlyNode<K>
Return value
Node<K>
Exceptions
SD0109Like fwidth it exists only on the GPU and only in a fragment shader; the fragment-only-builtin lint rule reports SD0109 elsewhere.
Description
Like fwidth it exists only on the GPU (the CPU evaluation returns 0) and only in a
fragment shader; the fragment-only-builtin lint rule reports SD0109 elsewhere. Spelled
dpdx on WGSL and dFdx on GLSL ES 3.00; dpdy is the Y-axis partner.
Targets
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Supported |
|
| GLSL ES 3.00 (WebGL2) | Supported |
|
| CPU oracle | Stub | The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with |
In the guide
See also
Source
src/core/ir/node.ts, line 2243, at commit 26de7be8