dpdx
On this page

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

x ReadonlyNode<K>

Return value

Node<K>

Exceptions

SD0109

Like 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

TargetSupportNotes
WGSL (WebGPU) Supported

dpdx(x).

GLSL ES 3.00 (WebGL2) Supported

dFdx(x).

CPU oracle Stub

The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with { gpuStubs: true }, which returns a placeholder.

In the guide

See also

Source

src/core/ir/node.ts, line 2243, at commit 26de7be8

Edit this page Report a problem