emitFunc
이 페이지에서

emitFunc()

함수, 출력 분류

Emit one FuncDecl as a WGSL function, exactly as given.

import { emitFunc } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const emitFunc: (f: FuncDecl) => string

매개변수

f FuncDecl

반환값

string

설명

Prefer emitFuncs for authored functions. This function skips every pass emitModule runs before writing: autoVars, match lowering (lowerModule), double-precision lowering (fp64Lower) and the optimizer. A function that still contains a match expression or an f64 type therefore throws, because those constructs exist only before lowering, and a function the optimizer would have simplified is written as authored. Use it only when the declaration needs none of those passes, such as a hand-written helper built from plain f32 arithmetic.

Parenthesisation is always 'full'. emitModule passes its parens option down to the same speller, so a module emitted with parens: 'minimal' spells the same function with fewer parentheses. A function emitted here matches its text inside a module emitted with the default option, and may differ from its text inside a 'minimal' one.

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

Writes WGSL for WebGPU.

GLSL ES 3.00 (WebGL2) 해당 없음
CPU 오라클 해당 없음

함께 보기

소스

src/core/backends/wgsl.ts, 532행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고