RenderSurfaceSource
此内容尚不支持你的语言。
RenderSurfaceSource = {
handle:number;kind:"gl-context"; } | {canvasSelector?:string;kind:"webgpu";readback?:boolean; } | {kind:"default"; }
Defined in: app/app.ts:1582
How the host provides the render surface the C++ renderer binds to — the single seam every platform’s renderer init flows through:
gl-context: an emscripten-registered WebGL2 context handle (web/desktop/WeChat).webgpu: the host acquired a GPUDevice (navigator.gpu) and passed it as the module factory’spreinitializedWebGPUDevicebefore instantiation; the engine owns the swapchain, resolving the canvas viacanvasSelector(default ‘#canvas’, via document.querySelector — so the canvas must be in the DOM).default: the module resolves its own surface (module.initRenderer()).
Native (wasm-on-JSC, no DOM): the host injects the device AND an already-built
CAMetalLayer/ANativeWindow surface, so { kind: 'webgpu' } omits canvasSelector
and must not reach the ‘#canvas’ fallback.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ handle: number; kind: "gl-context"; }
Type Literal
Section titled “Type Literal”{ canvasSelector?: string; kind: "webgpu"; readback?: boolean; }
canvasSelector?
Section titled “canvasSelector?”
readonlyoptionalcanvasSelector?:string
readonlykind:"webgpu"
readback?
Section titled “readback?”
readonlyoptionalreadback?:boolean
Configure the swapchain so the engine can read its own frames back
(captureFrame). Fixed at surface configuration, hence here.
Type Literal
Section titled “Type Literal”{ kind: "default"; }