EmitOptions
이 페이지에서

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 EmitPlugin for the hook sequence.

parens선택 사항읽기 전용 ParenMode

How 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 from a + b + c.

fp64Flavor선택 사항읽기 전용 Fp64Flavor

Which 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 _fp64 guard binding. See Fp64Flavor for when to choose each.

함께 보기

소스

src/core/emit.ts, 690행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고