compile
이 페이지에서

compile()

함수, 작성 분류

Compile TypeShade TypeScript source into the module and generated shader outputs.

import { compile } from 'typeshade'

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

구문

function compile(source: string, options: CompileOptions = {}): CompileResult

매개변수

source string
options선택 사항 CompileOptions

반환값

CompileResult

설명

The source must carry the "use typeshade" directive (compileTsSource’s requireDirective default): without it the result has one MISSING_DIRECTIVE error and nothing else. When the front end reports an error the backends are not run at all, so wgsl and glsl are undefined and eval throws; a partial module is never packed into shader text. When the front end reports no error, a WGSL emitter that throws anyway (a literal the target cannot spell, an IR the emitter rejects) is reported as one BACKEND error diagnostic rather than an exception, and wgsl and glsl are again undefined. GLSL is attempted for every module whose WGSL exists; when the GLSL emitter throws on a module with a render entry (a compute entry beside the render pair, a binding the GLSL emulation cannot spell) the module has still compiled: wgsl stays, glsl is undefined, and the throw is one BACKEND diagnostic with category warning. A compute-only module gets glsl: undefined with no diagnostic, since GLSL ES 3.00 has no compute stage to miss. See CompileResult for each field.

options.fileName names the source; see CompileOptions.fileName for when the default placeholder is not good enough.

관련 가이드

함께 보기

소스

src/compiler/ts/compile.ts, 176행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고