emitFragment()
함수, 출력 분류
Emit a ModuleDecl as a WGSL fragment for a host that assembles the final module itself: the declarations and helper functions without the enable directive header and, unless opts.entryPoints is true, without the stage entry points.
import { emitFragment } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const emitFragment: ( m: ModuleDecl, opts?: EmitOptions & { entryPoints?: boolean; },) => EmitFragment매개변수
mModuleDeclopts선택 사항EmitOptions & { entryPoints?: boolean }
반환값
설명
Where GLSL would use
#include, a WGSL host composes by concatenating fragments, so the directives it must
place at the top of the module come back in the result’s preamble field, and what the
fragment declares and requires comes back alongside (see EmitFragment).
Prefer this over concatenating emitFuncs and emitConst output. This
function runs the same validation and capability check as emitModule, so it never
writes a module that validate or the capability check would have rejected.
대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 | Writes WGSL for WebGPU. |
| GLSL ES 3.00 (WebGL2) | 해당 없음 | |
| CPU 오라클 | 해당 없음 |
관련 가이드
함께 보기
소스
src/core/backends/wgsl.ts, 586행, 커밋 c66579bf 기준