@aelionsdk/renderer-worker 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ import type { JsonValue } from '@aelionsdk/core';
2
+ import type { WebGl2MaterialProgram } from '@aelionsdk/material-compiler';
3
+ export interface ComposeRequest {
4
+ readonly type: 'compose';
5
+ readonly id: number;
6
+ readonly inputs: Readonly<Record<string, VideoFrame>>;
7
+ readonly program: WebGl2MaterialProgram;
8
+ readonly parameters: Readonly<Record<string, JsonValue>>;
9
+ readonly systems: Readonly<Record<string, number>>;
10
+ readonly width: number;
11
+ readonly height: number;
12
+ readonly preferredBackend: 'webgpu' | 'webgl2';
13
+ readonly allowFallback: boolean;
14
+ /** @internal Conformance-only loss injection; production callers must omit it. */
15
+ readonly debugSimulateLoss?: 'webgpu-device' | 'webgl2-context';
16
+ }
17
+ export type FrameGraphInput = {
18
+ readonly kind: 'external';
19
+ readonly id: string;
20
+ } | {
21
+ readonly kind: 'node';
22
+ readonly id: string;
23
+ };
24
+ export interface FrameGraphNode {
25
+ readonly id: string;
26
+ readonly inputs: Readonly<Record<string, FrameGraphInput>>;
27
+ readonly program: WebGl2MaterialProgram;
28
+ readonly parameters: Readonly<Record<string, JsonValue>>;
29
+ readonly systems: Readonly<Record<string, number>>;
30
+ }
31
+ /**
32
+ * One complete output-frame graph. Intermediate node outputs remain Worker/GPU
33
+ * owned; only the final node is transferred back to the caller.
34
+ */
35
+ export interface ComposeFrameGraphRequest {
36
+ readonly type: 'compose-frame-graph';
37
+ readonly id: number;
38
+ readonly inputs: Readonly<Record<string, VideoFrame>>;
39
+ readonly nodes: readonly FrameGraphNode[];
40
+ readonly outputNodeId: string;
41
+ readonly width: number;
42
+ readonly height: number;
43
+ readonly preferredBackend: 'webgpu' | 'webgl2';
44
+ readonly allowFallback: boolean;
45
+ }
46
+ export interface RendererWorkerResourceSnapshot {
47
+ /** Worker requests still executing after this request completed. */
48
+ readonly activeRequests: number;
49
+ /** Active requests with cancellation pending after this request completed. */
50
+ readonly cancelledRequests: number;
51
+ readonly webgpuDevices: number;
52
+ readonly webgpuPipelines: number;
53
+ readonly webgpuBuffers: number;
54
+ readonly webgpuTextures: number;
55
+ readonly webgl2Contexts: number;
56
+ readonly webgl2Programs: number;
57
+ readonly webgl2Buffers: number;
58
+ readonly webgl2Textures: number;
59
+ readonly inputFrames: number;
60
+ }
61
+ export interface RendererWorkerDiagnostic {
62
+ readonly code: string;
63
+ readonly message: string;
64
+ }
65
+ export interface RendererWorkerTiming {
66
+ /** Worker request wall time including setup, compilation, draw and bitmap transfer. */
67
+ readonly totalWorkerUs: number;
68
+ /**
69
+ * Backend completion proxy. WebGL uses finish/readback; WebGPU covers queue
70
+ * submission, validation and presentation handoff without a blocking
71
+ * texture-to-CPU readback or queue-wide completion wait.
72
+ */
73
+ readonly gpuCompletionUs: number;
74
+ }
75
+ export interface DisposeRequest {
76
+ readonly type: 'dispose';
77
+ }
78
+ export interface CancelRequest {
79
+ readonly type: 'cancel';
80
+ readonly id: number;
81
+ }
82
+ /** @internal Conformance-only Worker resource inspection. */
83
+ export interface InspectResourcesRequest {
84
+ readonly type: 'inspect-resources';
85
+ readonly responsePort: MessagePort;
86
+ }
87
+ /** @internal Conformance-only Worker request-set snapshot. */
88
+ export interface RendererWorkerRequestSetSnapshot {
89
+ readonly activeRequests: number;
90
+ readonly cancelledRequests: number;
91
+ }
92
+ export type RendererWorkerRequest = ComposeRequest | ComposeFrameGraphRequest | CancelRequest | DisposeRequest | InspectResourcesRequest;
93
+ export interface ComposeSuccess {
94
+ readonly type: 'composed';
95
+ readonly id: number;
96
+ readonly bitmap: ImageBitmap;
97
+ readonly backend: 'webgpu' | 'webgl2';
98
+ readonly graphHash: string;
99
+ readonly diagnostics: readonly RendererWorkerDiagnostic[];
100
+ /** Transient Worker resources after the request; the returned bitmap is caller-owned. */
101
+ readonly resources: RendererWorkerResourceSnapshot;
102
+ readonly outputBitmapOwner: 'caller';
103
+ readonly timing: RendererWorkerTiming;
104
+ }
105
+ export interface ComposeFailure {
106
+ readonly type: 'failed';
107
+ readonly id: number;
108
+ readonly code: string;
109
+ readonly message: string;
110
+ }
111
+ /** Worker acknowledgement emitted only after a cancelled request has released its resources. */
112
+ export interface ComposeCancelled {
113
+ readonly type: 'cancelled';
114
+ readonly id: number;
115
+ }
116
+ export type RendererWorkerResponse = ComposeSuccess | ComposeFailure | ComposeCancelled;
117
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,kFAAkF;IAClF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,eAAe,GAAG,gBAAgB,CA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