SD0108
이 페이지에서

SD0108

코어 코드

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

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

예제

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()은 린트 규칙을 돌리지 않습니다. typeshade/dev의 diagnose()가 compile()이 돌려준 모듈에 린트 규칙을 돌려 다음을 알립니다.

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

고치는 법

레지스트리의 힌트: write 1 − smoothstep(lo, hi, x) instead of reversing the edges

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일되고, diagnose()도 더는 이 코드를 알리지 않습니다.

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.)
}

함께 보기

소스

커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

이 페이지 편집 문제 보고