SD0108
On this page

SD0108

Core code

smoothstep with constant edge0 >= edge1 (undefined in GLSL ES)

The registry text and every compiler message on these pages are the compiler's own English.

Example

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
const g = smoothstep(0.8, 0.2, uv.x)
return vec4(g, g, g, 1.)
}

compile() does not run the lint rules. diagnose() from typeshade/dev does, on the module compile() returns, and reports:

SD0108 warning: smoothstep(0.8, 0.2, …) in fn 'main' — edge0 >= edge1 is undefined in GLSL ES

How to fix it

The registry's hint: write 1 − smoothstep(lo, hi, x) instead of reversing the edges

The same program, corrected. It compiles with no diagnostic, and diagnose() no longer reports the code.

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
const g = 1. - smoothstep(0.2, 0.8, uv.x)
return vec4(g, g, g, 1.)
}

See also

Source

Where the compiler raises this code at commit 26de7be8, one line per file:

Edit this page Report a problem