dpdxCoarse
Function
A screen-space derivative estimates how a value changes between neighbouring fragment invocations along the x axis.
Related names in other languages
These related operations can differ in arguments, support, and semantics. The foreign names are not accepted TypeShade aliases. Check the target forms and restrictions.
- GLSL:
dFdx
Compare examples
Compare a constant field with a linear ramp. The result measures change per pixel, not the field value.
Model assumptionsf(px, py) = a × px + b × py + c
Example 1a = 0; b = 0; c = 5
5555 - Result
0
Example 2a = 0.25; b = 0; c = 0
00.2500.25 - Result
0.25
Example 3a = 0.25; b = -0.5; c = 1
11.250.50.75 - Result
0.25
The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.
When to use it
Use it to estimate a pixel footprint, recover a surface gradient, or control filtering.
Inputs and limits
The model uses an affine field, so coarse and fine estimates agree. Nonlinear fields can differ. Derivatives require fragment-stage uniform control flow; GLSL ES chooses its own granularity.
For shader input rules and precision, consult WGSL and GLSL ES 3.00.
Related functions
- WGSL
dpdxCoarse(a)- GLSL ES 3.00
dFdx(a)
The signature, the sentence and any message are the compiler's own text at commit af54ddad5.
The partial derivative of x with respect to the window x coordinate, computed at the coarser granularity.
Syntax
declare function dpdxCoarse(a0: f32): f32declare function dpdxCoarse<V extends vec2 | vec3 | vec4>(a0: V): Vdeclare function dpdxCoarse<T extends Numeric>(a0: T): TA signature may name a type the ambient file declares for its own use. These are those declarations.
Numerictype Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u
Parameters
A parameter named by position (a0, a1) carries a name the ambient file generates. A call passes its arguments in order and names none of them.
-
a0f32VT
Return value
f32VT
Description
Fragment stage only; dFdx on GLSL, which picks its own granularity; the CPU oracle returns zero.
Targets
- WGSL
-
dpdxCoarse(a) - GLSL ES 3.00
-
dFdx(a)