@taole/giftstage 0.3.4 → 0.3.6
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.
- package/README.md +15 -2
- package/dist/core/gift-stage.d.ts +5 -1
- package/dist/core/render-manager.d.ts +9 -0
- package/dist/gift-stage.cjs +790 -464
- package/dist/gift-stage.es.js +7050 -6130
- package/dist/index.d.ts +1 -0
- package/dist/renderers/svga-batch-renderer.d.ts +13 -2
- package/dist/types/index.d.ts +24 -0
- package/dist/utils/clip-mesh.d.ts +2 -1
- package/dist/utils/svga-clip-analysis.d.ts +36 -0
- package/dist/utils/svga-command-preparation.d.ts +13 -0
- package/dist/utils/svga-hybrid-command-data.d.ts +18 -0
- package/dist/utils/svga-hybrid-command-table.d.ts +7 -7
- package/dist/utils/svga-preparation-profile.d.ts +21 -0
- package/dist/utils/svga-work-scheduler.d.ts +3 -2
- package/dist/workers/svga-clip-worker-client.d.ts +5 -0
- package/dist/workers/svga-clip-worker.d.ts +9 -0
- package/dist/workers/svga-command-worker-client.d.ts +8 -0
- package/dist/workers/svga-command-worker.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -34,3 +34,4 @@ export { WebCodecsMp4Playback } from './video/webcodecs-mp4-playback.js';
|
|
|
34
34
|
export type { WebCodecsMp4CreateOptions } from './video/webcodecs-mp4-playback.js';
|
|
35
35
|
export type { WebCodecsPlaybackHandle, GPUBackend, BackendOperationFailureReason, BackendOperationResult, GPUBufferHandle, GPUTextureHandle, TextureOpts, BufferUsage, DrawCommand, ShaderType, BackendType, ParentMotionMode, SVGADrawBatchMode, SVGAFrameEvaluation, SVGAFrameEvaluationStrategy, SVGAFrameTableBinding, SVGAFrameTableBindingBase, SVGAFrameTableCreateOptions, SVGAFrameTableState, SVGAFrameTimelineFallbackReason, SVGAFrameTimelinePath, SVGAFrameTimelineRenderInfo, SVGAFrameTimelineStrategy, SVGAFrameTimelineTransport, SVGARenderFallbackReason, SVGARenderInfo, SVGARenderPath, SVGARenderPathState, SVGARenderPathChangeInfo, GiftStageRuntimeDiagnosticType, GiftStageRuntimeDiagnosticEvent, GiftStageRuntimeDiagnostics, SVGAHybridCommandTable, SVGAHybridOperation, SVGAHybridOperationType, SVGATimelineDrawRun, WebGL2FrameTableBinding, WebGPUFrameTableBinding, GiftStageOptions, AddGiftOptions, GiftHandle, GiftSlot, GiftType, GiftObjectFit, GiftCoordinate, GiftState, GiftAnimationStep, GiftAnimationChain, SVGAMovieEntity, SVGAParams, SVGASpriteTable, SVGAAudio, SVGATransform, SVGAShape, VideoEntity, UVRect, FrameJobData, FlyAnimation, VAPConfig, VAPSrcItem, VAPFrameItem, VAPFrameObj, } from './types/index.js';
|
|
36
36
|
export type { GiftAssetLease, GiftAssetMetadata, GiftStageCapabilities, SVGAFrameTimelineCapabilities, GiftStagePlugin, GiftStagePluginHost, MountedGiftStagePlugin, MotionBindingOptions, MotionTrackDescriptor, MotionTrackLease, BallisticV1ParticleBatchDescriptor, ParticleAtlasDescriptor, ParticleAtlasHandle, ParticleBatchDescriptor, ParticleBatchEnvelope, ParticleBatchGroupHandle, ParticleBatchHandle, ParticleEnvelopeSegment, SpriteV2ParticleBatchDescriptor, PlaybackFrame, PlaybackScope, PlaybackScopeStartOptions, PlaybackScopeState, ReadonlyTableDescriptor, ReadonlyTableLease, } from './plugin/types.js';
|
|
37
|
+
export type { SVGAPreparationProfile, SVGAPreparationPhase, SVGAPreparationStageProfile } from './types/index.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SVGAClipAnalysisCache } from '../utils/svga-clip-analysis.js';
|
|
2
|
+
import { type SVGAPreparationRecorder } from '../utils/svga-preparation-profile.js';
|
|
1
3
|
import type { GPUBackend, GPUBufferHandle, GiftSlot, VideoEntity } from '../types/index.js';
|
|
2
4
|
/** Signals RenderManager to discard and replay the complete frame after a resource fallback. */
|
|
3
5
|
export declare class SVGAFastPathFrameReplayError extends Error {
|
|
@@ -32,6 +34,7 @@ export interface ClipMeshCache {
|
|
|
32
34
|
indexBuf?: GPUBufferHandle | null;
|
|
33
35
|
}
|
|
34
36
|
interface SVGAClipPrewarmOptions {
|
|
37
|
+
profile?: SVGAPreparationRecorder;
|
|
35
38
|
frameBudgetMs?: number;
|
|
36
39
|
workerTimeSliceMs?: number;
|
|
37
40
|
checkActive?: () => void;
|
|
@@ -78,9 +81,13 @@ export declare class SVGABatchRenderer {
|
|
|
78
81
|
/** Shared producers outlive individual addGift/preload subscribers. */
|
|
79
82
|
private clipMeshProducerController;
|
|
80
83
|
private clipMeshProducerTasks;
|
|
84
|
+
private clipResourceProducers;
|
|
85
|
+
private clipPreparationOwners;
|
|
86
|
+
private liveClipPreparationControllers;
|
|
87
|
+
private clipTableOwnerCounts;
|
|
81
88
|
private destroyed;
|
|
82
89
|
private clipMeshDestroyed;
|
|
83
|
-
|
|
90
|
+
readonly clipAnalysis: SVGAClipAnalysisCache;
|
|
84
91
|
/** Meshes with lazily created GPU buffers (released in destroy). */
|
|
85
92
|
private clipMeshesWithBuffers;
|
|
86
93
|
private clipMeshRefCounts;
|
|
@@ -249,6 +256,8 @@ export declare class SVGABatchRenderer {
|
|
|
249
256
|
private getFrameClipMode;
|
|
250
257
|
prewarmClipMeshes(entity: Pick<VideoEntity, 'spriteTable'>, options?: SVGAClipPrewarmOptions): Promise<number>;
|
|
251
258
|
prewarmClipMeshesForFrame(entity: Pick<VideoEntity, 'spriteTable'>, frame: number, options?: SVGAClipPrewarmOptions): Promise<number>;
|
|
259
|
+
private retainClipPreparation;
|
|
260
|
+
private prewarmEntityClipMeshes;
|
|
252
261
|
/**
|
|
253
262
|
* Precompiles every immutable Shape group and uploads its static mesh once.
|
|
254
263
|
* Hybrid table promotion waits for this preparation so the first promoted
|
|
@@ -258,7 +267,8 @@ export declare class SVGABatchRenderer {
|
|
|
258
267
|
/** Validates every immutable Hybrid mesh reference and retains its GPU buffers for this entity. */
|
|
259
268
|
retainHybridMeshes(backend: GPUBackend, entity: VideoEntity): void;
|
|
260
269
|
releaseHybridMeshes(backend: GPUBackend, entity: VideoEntity): void;
|
|
261
|
-
|
|
270
|
+
releaseClipPreparation(entity: Pick<VideoEntity, 'spriteTable'>): void;
|
|
271
|
+
private collectClipPathsSteps;
|
|
262
272
|
/**
|
|
263
273
|
* Ensures shared producers exist, then waits as the current subscriber. A subscriber signal
|
|
264
274
|
* never owns or cancels shared mesh production; it only detaches this caller's waiter.
|
|
@@ -284,6 +294,7 @@ export declare class SVGABatchRenderer {
|
|
|
284
294
|
private queueClipMeshBuild;
|
|
285
295
|
private scheduleClipMeshBuildFlush;
|
|
286
296
|
private flushPendingClipMeshBuilds;
|
|
297
|
+
hydrateClipMeshesCooperative(meshes: SVGAClipMeshMap | null | undefined, options?: SVGAClipPrewarmOptions): Promise<void>;
|
|
287
298
|
hydrateClipMeshes(meshes: SVGAClipMeshMap | null | undefined): void;
|
|
288
299
|
snapshotClipMeshes(entity: Pick<VideoEntity, 'spriteTable'>): SVGAClipMeshMap;
|
|
289
300
|
private canUseTimelinePath;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -812,6 +812,10 @@ export interface GiftStageOptions {
|
|
|
812
812
|
* Default: true.
|
|
813
813
|
*/
|
|
814
814
|
svgaClipPrewarmInWorker?: boolean;
|
|
815
|
+
/** Build immutable GPU command/frame tables in a Worker. Defaults to true. */
|
|
816
|
+
svgaCommandTableInWorker?: boolean;
|
|
817
|
+
/** Optional per-resource preparation summary. Detailed sampling is disabled when absent. */
|
|
818
|
+
onSVGAPreparationProfile?: (profile: SVGAPreparationProfile) => void;
|
|
815
819
|
/** Called when a gift's selected SVGA rendering path changes. */
|
|
816
820
|
onSVGARenderPathChange?: (info: SVGARenderPathChangeInfo) => void;
|
|
817
821
|
/** Receives production runtime diagnostics. GiftStage does not upload these events. */
|
|
@@ -1154,3 +1158,23 @@ export interface GiftAnimationChain {
|
|
|
1154
1158
|
/** Cancel the active animation for this gift. */
|
|
1155
1159
|
cancel(): void;
|
|
1156
1160
|
}
|
|
1161
|
+
export type SVGAPreparationPhase = 'clip-prepare' | 'worker-queue' | 'input-copy' | 'command-build' | 'frame-pack' | 'validation' | 'gpu-submit';
|
|
1162
|
+
export interface SVGAPreparationStageProfile {
|
|
1163
|
+
/** Combined CPU execution across threads; excludes waits. */
|
|
1164
|
+
executionMs: number;
|
|
1165
|
+
mainThreadExecutionMs: number;
|
|
1166
|
+
workerExecutionMs: number;
|
|
1167
|
+
elapsedMs: number;
|
|
1168
|
+
maxSliceMs: number;
|
|
1169
|
+
slices: number;
|
|
1170
|
+
cacheHits: number;
|
|
1171
|
+
bytes: number;
|
|
1172
|
+
}
|
|
1173
|
+
export interface SVGAPreparationProfile {
|
|
1174
|
+
resourceId: number;
|
|
1175
|
+
executor: 'worker' | 'main-thread';
|
|
1176
|
+
fallbackReason?: string;
|
|
1177
|
+
status: 'complete' | 'canceled' | 'failed';
|
|
1178
|
+
elapsedMs: number;
|
|
1179
|
+
phases: Partial<Record<SVGAPreparationPhase, SVGAPreparationStageProfile>>;
|
|
1180
|
+
}
|
|
@@ -3,8 +3,8 @@ export interface ClipMeshData {
|
|
|
3
3
|
vertices: Float32Array;
|
|
4
4
|
indices: Uint32Array;
|
|
5
5
|
}
|
|
6
|
-
/** Returns a stable validation failure, or null for a renderable triangle mesh. */
|
|
7
6
|
export declare function validateClipMeshData(mesh: ClipMeshData): string | null;
|
|
7
|
+
export declare function validateClipMeshDataSteps(mesh: ClipMeshData): Generator<void, string | null>;
|
|
8
8
|
export type ClipMeshTriangulator = (vertices: Float64Array, polygonStarts: Uint32Array) => Uint32Array | null;
|
|
9
9
|
export type ClipPathGeometryKind = 'empty' | 'fillable' | 'invalid';
|
|
10
10
|
/**
|
|
@@ -22,3 +22,4 @@ export declare function classifyParsedClipPathGeometry(subPaths: ReturnType<type
|
|
|
22
22
|
/** Checkpoints also bound work for a single large, collinear contour. */
|
|
23
23
|
export declare function classifyParsedClipPathGeometrySteps(subPaths: ReturnType<typeof parseSvgPath>): Generator<void, ClipPathGeometryKind>;
|
|
24
24
|
export declare function buildClipMeshFromPath(clipPath: string, triangulator?: ClipMeshTriangulator): ClipMeshData | null;
|
|
25
|
+
export declare function buildClipMeshFromParsedPath(subPaths: ReturnType<typeof parseSvgPath>, triangulator?: ClipMeshTriangulator): ClipMeshData | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { VideoEntity } from '../types/index.js';
|
|
2
|
+
import { type ClipPathGeometryKind } from './clip-mesh.js';
|
|
3
|
+
import { type parseSvgPath } from './svg-path-parser.js';
|
|
4
|
+
export interface ClipAnalysis {
|
|
5
|
+
kind: ClipPathGeometryKind;
|
|
6
|
+
localRect: {
|
|
7
|
+
x0: number;
|
|
8
|
+
y0: number;
|
|
9
|
+
x1: number;
|
|
10
|
+
y1: number;
|
|
11
|
+
} | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function detectAxisAlignedClipRect(paths: ReturnType<typeof parseSvgPath>): {
|
|
14
|
+
x0: number;
|
|
15
|
+
y0: number;
|
|
16
|
+
x1: number;
|
|
17
|
+
y1: number;
|
|
18
|
+
} | null;
|
|
19
|
+
export declare function analyzeParsedClipSteps(points: ReturnType<typeof parseSvgPath>, blank?: boolean): Generator<void, ClipAnalysis>;
|
|
20
|
+
/** One Stage owns this small cache. Meshes and flattened points are not retained here. */
|
|
21
|
+
export declare class SVGAClipAnalysisCache {
|
|
22
|
+
private paths;
|
|
23
|
+
private tables;
|
|
24
|
+
private resourcePaths;
|
|
25
|
+
private pathUsers;
|
|
26
|
+
hits: number;
|
|
27
|
+
trackHits: boolean;
|
|
28
|
+
retain(table: VideoEntity['spriteTable'], path: string): void;
|
|
29
|
+
release(table: VideoEntity['spriteTable']): string[];
|
|
30
|
+
get(path: string): ClipAnalysis | undefined;
|
|
31
|
+
set(path: string, value: ClipAnalysis): void;
|
|
32
|
+
getByIndex(table: VideoEntity['spriteTable'], index: number): ClipAnalysis | undefined;
|
|
33
|
+
analyze(table: VideoEntity['spriteTable'], index: number): Generator<void, ClipAnalysis>;
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare function getStandaloneClipAnalysis(table: VideoEntity['spriteTable']): SVGAClipAnalysisCache;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VideoEntity } from '../types/index.js';
|
|
2
|
+
import { type SVGAHybridCommandTableBuildOptions } from './svga-hybrid-command-table.js';
|
|
3
|
+
import { type SVGACommandInput } from './svga-hybrid-command-data.js';
|
|
4
|
+
import type { SVGACommandResult } from '../workers/svga-command-worker.js';
|
|
5
|
+
export interface SVGACommandPreparationOptions extends SVGAHybridCommandTableBuildOptions {
|
|
6
|
+
useWorker?: boolean;
|
|
7
|
+
workerTimeSliceMs?: number;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
/** Transfer only dedicated copies, in at most 64 KiB copy operations. */
|
|
11
|
+
export declare function copySVGACommandInputSteps(input: SVGACommandInput): Generator<void, SVGACommandInput>;
|
|
12
|
+
export declare function validateSVGACommandResultSteps(result: SVGACommandResult, input: SVGACommandInput, hybrid: boolean): Generator<void, void>;
|
|
13
|
+
export declare function prepareSVGACommandTables(entity: VideoEntity, hybrid: boolean, options?: SVGACommandPreparationOptions): Promise<SVGACommandResult>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SVGAHybridCommandTable } from '../types/index.js';
|
|
2
|
+
/** Dedicated numeric snapshot; no paths, entity references or GPU handles. */
|
|
3
|
+
export interface SVGACommandInput {
|
|
4
|
+
frameCount: number;
|
|
5
|
+
spriteCount: number;
|
|
6
|
+
frameData: Float32Array;
|
|
7
|
+
shapesIndex: Int32Array;
|
|
8
|
+
clipPathIndex: Int32Array;
|
|
9
|
+
shapePresence: Uint8Array;
|
|
10
|
+
clipKinds: Uint8Array;
|
|
11
|
+
clipRects: Float64Array;
|
|
12
|
+
atlas: Float64Array;
|
|
13
|
+
}
|
|
14
|
+
/** FNV-1a over canonical numeric bytes; -0 and 0 have the same identity. */
|
|
15
|
+
export declare function hashScheduleNumber(hash: number, value: number): number;
|
|
16
|
+
/** All executors drain this same generator. Hashes only select exact-comparison buckets. */
|
|
17
|
+
export declare function buildSVGACommandDataSteps(input: SVGACommandInput, hashNumber?: typeof hashScheduleNumber): Generator<void, SVGAHybridCommandTable>;
|
|
18
|
+
export declare function packSVGAFrameDataSteps(data: Float32Array): Generator<void, Float32Array>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { SVGAHybridCommandTable, VideoEntity } from '../types/index.js';
|
|
2
|
+
import { type SVGAClipAnalysisCache } from './svga-clip-analysis.js';
|
|
3
|
+
import { type SVGACommandInput } from './svga-hybrid-command-data.js';
|
|
4
|
+
import { type PreparationStepOptions } from './svga-preparation-profile.js';
|
|
2
5
|
export declare const SVGA_HYBRID_OP_TEXTURE = 0;
|
|
3
6
|
export declare const SVGA_HYBRID_OP_SHAPE = 1;
|
|
4
7
|
export declare const SVGA_HYBRID_OP_CLIP_WRITE = 2;
|
|
5
8
|
export declare const SVGA_HYBRID_OP_CLIP_TEST = 3;
|
|
6
9
|
export declare const SVGA_HYBRID_OP_CLIP_CLEAR = 4;
|
|
7
|
-
export interface SVGAHybridCommandTableBuildOptions {
|
|
8
|
-
|
|
9
|
-
frameBudgetMs?: number;
|
|
10
|
-
/** Throw when the owning resource has been released or its backend is lost. */
|
|
11
|
-
checkActive?: () => void;
|
|
10
|
+
export interface SVGAHybridCommandTableBuildOptions extends PreparationStepOptions {
|
|
11
|
+
clipAnalysis?: SVGAClipAnalysisCache;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** Input references remain on the main thread until explicitly copied for a Worker. */
|
|
14
|
+
export declare function prepareSVGACommandInputSteps(entity: VideoEntity, options?: SVGAHybridCommandTableBuildOptions): Generator<void, SVGACommandInput>;
|
|
14
15
|
export declare function buildSVGAHybridCommandTable(entity: VideoEntity): SVGAHybridCommandTable;
|
|
15
|
-
/** Only returns a complete immutable table; partially built state never reaches the renderer. */
|
|
16
16
|
export declare function buildSVGAHybridCommandTableCooperative(entity: VideoEntity, options?: SVGAHybridCommandTableBuildOptions): Promise<SVGAHybridCommandTable>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SVGAPreparationPhase, SVGAPreparationProfile, SVGAPreparationStageProfile } from '../types/index.js';
|
|
2
|
+
export declare class SVGAPreparationRecorder {
|
|
3
|
+
readonly resourceId: number;
|
|
4
|
+
readonly started: number;
|
|
5
|
+
readonly phases: Partial<Record<SVGAPreparationPhase, SVGAPreparationStageProfile>>;
|
|
6
|
+
executor: SVGAPreparationProfile['executor'];
|
|
7
|
+
fallbackReason?: string;
|
|
8
|
+
constructor(resourceId: number);
|
|
9
|
+
phase(name: SVGAPreparationPhase): SVGAPreparationStageProfile;
|
|
10
|
+
record(name: SVGAPreparationPhase, duration: number, thread?: 'main' | 'worker'): void;
|
|
11
|
+
measure<T>(name: SVGAPreparationPhase, action: () => T): T;
|
|
12
|
+
finish(status: SVGAPreparationProfile['status']): SVGAPreparationProfile;
|
|
13
|
+
}
|
|
14
|
+
export interface PreparationStepOptions {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
frameBudgetMs?: number;
|
|
17
|
+
checkActive?: () => void;
|
|
18
|
+
profile?: SVGAPreparationRecorder;
|
|
19
|
+
}
|
|
20
|
+
/** Record only execution slices, excluding rAF waits and competing tasks. */
|
|
21
|
+
export declare function runPreparationSteps<T>(steps: Generator<void, T>, options?: PreparationStepOptions, phase?: SVGAPreparationPhase): Promise<T>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export type SVGAWorkerTaskPriority = 'foreground' | 'background';
|
|
1
2
|
/**
|
|
2
3
|
* SVGA parser, image decode, atlas and clip workers share this gate so they
|
|
3
4
|
* do not create a multi-core CPU burst while real-time media is active.
|
|
4
5
|
*/
|
|
5
6
|
export declare function configureSVGAWorkerTaskConcurrency(maxConcurrent?: number): void;
|
|
6
|
-
export declare function runSVGAWorkerTask<T>(task: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
7
|
-
export declare function acquireSVGAWorkerTask(signal?: AbortSignal): Promise<() => void>;
|
|
7
|
+
export declare function runSVGAWorkerTask<T>(task: () => Promise<T>, signal?: AbortSignal, priority?: SVGAWorkerTaskPriority): Promise<T>;
|
|
8
|
+
export declare function acquireSVGAWorkerTask(signal?: AbortSignal, priority?: SVGAWorkerTaskPriority): Promise<() => void>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { type SVGAPreparationRecorder } from '../utils/svga-preparation-profile.js';
|
|
2
|
+
import type { ClipAnalysis } from '../utils/svga-clip-analysis.js';
|
|
1
3
|
import { type ClipMeshData } from '../utils/clip-mesh.js';
|
|
2
4
|
export declare function canUseSVGAClipWorker(): boolean;
|
|
3
5
|
export declare function requestSVGAClipMeshesInWorker(paths: string[], options?: {
|
|
6
|
+
profile?: SVGAPreparationRecorder;
|
|
4
7
|
workerTimeSliceMs?: number;
|
|
5
8
|
signal?: AbortSignal;
|
|
9
|
+
frameBudgetMs?: number;
|
|
10
|
+
onAnalysis?: (path: string, analysis: ClipAnalysis) => void;
|
|
6
11
|
}): Promise<Map<string, ClipMeshData | null>>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { type ClipAnalysis } from '../utils/svga-clip-analysis.js';
|
|
1
2
|
export interface SVGAClipWorkerRequest {
|
|
2
3
|
type: 'build-svga-clip-meshes';
|
|
3
4
|
id: number;
|
|
4
5
|
paths: string[];
|
|
5
6
|
workerTimeSliceMs?: number;
|
|
7
|
+
profile?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export interface SVGAClipWorkerEntry {
|
|
8
10
|
path: string;
|
|
11
|
+
analysis: ClipAnalysis;
|
|
9
12
|
vertices: Float32Array | null;
|
|
10
13
|
indices: Uint32Array | null;
|
|
11
14
|
}
|
|
@@ -14,4 +17,10 @@ export interface SVGAClipWorkerResponse {
|
|
|
14
17
|
id: number;
|
|
15
18
|
entries?: SVGAClipWorkerEntry[];
|
|
16
19
|
error?: string;
|
|
20
|
+
profile?: {
|
|
21
|
+
executionMs: number;
|
|
22
|
+
elapsedMs: number;
|
|
23
|
+
maxSliceMs: number;
|
|
24
|
+
slices: number;
|
|
25
|
+
};
|
|
17
26
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SVGACommandResult } from './svga-command-worker.js';
|
|
2
|
+
import type { SVGACommandInput } from '../utils/svga-hybrid-command-data.js';
|
|
3
|
+
import type { PreparationStepOptions } from '../utils/svga-preparation-profile.js';
|
|
4
|
+
export interface CommandWorkerOptions extends PreparationStepOptions {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
workerTimeSliceMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function requestSVGACommandTableInWorker(input: SVGACommandInput, hybrid: boolean, options: CommandWorkerOptions): Promise<SVGACommandResult>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type SVGACommandInput } from '../utils/svga-hybrid-command-data.js';
|
|
2
|
+
import type { SVGAHybridCommandTable } from '../types/index.js';
|
|
3
|
+
export interface SVGACommandResult {
|
|
4
|
+
commandTable?: SVGAHybridCommandTable;
|
|
5
|
+
packed: Float32Array;
|
|
6
|
+
}
|
|
7
|
+
export interface SVGACommandRequest {
|
|
8
|
+
type: 'start' | 'resume' | 'cancel';
|
|
9
|
+
id: number;
|
|
10
|
+
generation: number;
|
|
11
|
+
input?: SVGACommandInput;
|
|
12
|
+
hybrid?: boolean;
|
|
13
|
+
sliceMs?: number;
|
|
14
|
+
profile?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface SVGACommandResponse {
|
|
17
|
+
id: number;
|
|
18
|
+
generation: number;
|
|
19
|
+
type: 'paused' | 'complete' | 'error';
|
|
20
|
+
result?: SVGACommandResult;
|
|
21
|
+
error?: string;
|
|
22
|
+
samples?: Array<{
|
|
23
|
+
phase: 'command-build' | 'frame-pack';
|
|
24
|
+
executionMs: number;
|
|
25
|
+
elapsedMs: number;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
package/package.json
CHANGED