fwidth()
함수, 내장 함수 분류
fwidth(x): abs(dpdx(x)) + abs(dpdy(x)), the screen-space derivative magnitude, component-wise.
import { fwidth } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const fwidth: <K extends FloatKey>(x: ReadonlyNode<K>) => Node<K>매개변수
xReadonlyNode<K>
반환값
Node<K>
예외
SD0109It exists only on the GPU and only in a fragment shader; the fragment-only-builtin lint rule, which runs at every emit, reports SD0109 when it appears in a vertex or compute stage.
설명
fwidth(x): abs(dpdx(x)) + abs(dpdy(x)), the screen-space derivative magnitude,
component-wise. It exists only on the GPU (the CPU evaluation returns 0) and only in a
fragment shader; the fragment-only-builtin lint rule, which runs at every emit, reports
SD0109 when it appears in a vertex or compute stage. In those stages compute the
quantity on the host and pass it in.
대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 |
|
| GLSL ES 3.00 (WebGL2) | 지원 |
|
| CPU 오라클 | 스텁 | The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with |
관련 가이드
소스
src/core/ir/node.ts, 2238행, 커밋 c66579bf 기준