emitFragment
이 페이지에서

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

매개변수

m ModuleDecl
opts선택 사항 EmitOptions & { entryPoints?: boolean }

반환값

EmitFragment

설명

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 기준

이 페이지 편집 문제 보고