EmitOptions
인터페이스, 출력 분류
Options accepted by emitModule and emitGlslModule.
import type { EmitOptions } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface EmitOptions { readonly plugins?: readonly EmitPlugin[]; readonly parens?: ParenMode; readonly fp64Flavor?: Fp64Flavor;}설명
Every field is optional; an omitted or empty options object gives the plain emit.
예제
예제
import { obfuscate } from 'typeshade/emit-prod'
const wgsl = emitModule(MODULE, { plugins: obfuscate(), parens: 'minimal' })인스턴스 속성
plugins선택 사항읽기 전용readonly EmitPlugin[]Plugins to run around the assembly, in order. See
EmitPluginfor the hook sequence.parens선택 사항읽기 전용ParenModeHow many parentheses the emitted expressions carry.
'full'is the default and wraps every operator.'minimal'omits a paren wherever operator precedence already implies the same parse. Pair it with{ plugins: obfuscate() }for the smallest shipped shader.'minimal'omits a paren only where WGSL and GLSL ES 3.00 define the same precedence:*,/and%over+and-over unary-. The relational, logical, bitwise and shift operators stay wrapped on purpose, because WGSL gives them no chaining precedence at all, so mixing them unparenthesised is a compile error there and ranking them would invent a rule one target lacks. The operands of a bitwise or shift operator are unary in WGSL’s grammar, so an arithmetic one keeps its parens too:a & (b - c).It never reassociates.
a + (b + c)keeps its parens, because in floating point that is a different number froma + b + c.fp64Flavor선택 사항읽기 전용Fp64FlavorWhich arithmetic primitives back the emulated-double helper functions that f64 lowering injects.
'float'is the default.'integer'writes the primitives in integer bit arithmetic, which a fast-math compiler pass cannot reassociate, and injects no_fp64guard binding. SeeFp64Flavorfor when to choose each.
함께 보기
소스
src/core/emit.ts, 690행, 커밋 c66579bf 기준