packModule
이 페이지에서

packModule()

함수, 리플렉션 분류

The compiled module's manifest: everything a host needs to create its pipelines and bind its resources, in one plain JSON object.

import { packModule } from 'typeshade'

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

구문

function packModule(m: ModuleDecl, options: PackOptions = {}): Pack

매개변수

m ModuleDecl
options선택 사항 PackOptions

반환값

Pack

예외

TypeError

TypeError for a word an emit option does not take, and for ir with emit.plugins.

설명

See buildManifest in src/core/manifest.ts, which builds it from the IR alone, for what each field promises.

options.console adds the recorded variant, the WGSL that writes each console.* call an entry reaches into the console buffer, with the table the buffer decodes with.

options.emit emits the program under other options than the defaults (change 0028): the WGSL writer’s parens, fp64Flavor and plugins, and an optimization level. The manifest’s wgsl, its recorded variant’s wgsl, its glsl and its bindings are the ones those options emit (fp64Flavor: 'integer' binds no _fp64 guard), and it records level, parens and fp64Flavor in emit, so repack from typeshade/emit emits the program again under them. A plugin is a function, which a manifest cannot record: options.ir with a plugin throws a TypeError, since the load-time emitter could not emit the program again.

예제

예제

import { compile, packModule } from 'typeshade';
const program = packModule(compile(source).module, {
emit: { level: 'O1', parens: 'minimal', fp64Flavor: 'integer' },
});
program.emit; // { level: 'O1', parens: 'minimal', fp64Flavor: 'integer' }

소스

src/compiler/ts/pack.ts, 46행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고