@motion-core/motion-gpu 0.1.0 → 0.2.0
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 +31 -11
- package/dist/advanced.d.ts +3 -11
- package/dist/advanced.js +3 -6
- package/dist/core/advanced.d.ts +6 -0
- package/dist/core/advanced.js +5 -0
- package/dist/core/current-value.d.ts +23 -0
- package/dist/core/current-value.js +33 -0
- package/dist/core/error-diagnostics.d.ts +1 -1
- package/dist/core/error-report.js +2 -2
- package/dist/{frame-context.d.ts → core/frame-registry.d.ts} +3 -17
- package/dist/{frame-context.js → core/frame-registry.js} +2 -37
- package/dist/core/index.d.ts +19 -0
- package/dist/core/index.js +12 -0
- package/dist/core/material-preprocess.d.ts +1 -1
- package/dist/core/material-preprocess.js +1 -1
- package/dist/core/material.d.ts +4 -4
- package/dist/core/material.js +3 -3
- package/dist/core/recompile-policy.d.ts +1 -1
- package/dist/core/render-graph.d.ts +1 -1
- package/dist/core/render-targets.d.ts +1 -1
- package/dist/core/render-targets.js +1 -1
- package/dist/core/renderer.d.ts +1 -1
- package/dist/core/renderer.js +6 -6
- package/dist/core/runtime-loop.d.ts +31 -0
- package/dist/core/runtime-loop.js +294 -0
- package/dist/{advanced-scheduler.d.ts → core/scheduler-helpers.d.ts} +6 -2
- package/dist/core/shader.d.ts +2 -2
- package/dist/core/shader.js +1 -1
- package/dist/core/texture-loader.d.ts +1 -1
- package/dist/core/textures.d.ts +1 -1
- package/dist/core/textures.js +1 -1
- package/dist/core/uniforms.d.ts +1 -1
- package/dist/index.d.ts +3 -14
- package/dist/index.js +3 -8
- package/dist/passes/BlitPass.d.ts +1 -1
- package/dist/passes/CopyPass.d.ts +1 -1
- package/dist/passes/CopyPass.js +1 -1
- package/dist/passes/ShaderPass.d.ts +1 -1
- package/dist/passes/index.d.ts +3 -3
- package/dist/passes/index.js +3 -3
- package/dist/svelte/FragCanvas.svelte +220 -0
- package/dist/{FragCanvas.svelte.d.ts → svelte/FragCanvas.svelte.d.ts} +3 -3
- package/dist/{MotionGPUErrorOverlay.svelte → svelte/MotionGPUErrorOverlay.svelte} +1 -1
- package/dist/{MotionGPUErrorOverlay.svelte.d.ts → svelte/MotionGPUErrorOverlay.svelte.d.ts} +1 -1
- package/dist/svelte/advanced.d.ts +11 -0
- package/dist/svelte/advanced.js +6 -0
- package/dist/svelte/frame-context.d.ts +14 -0
- package/dist/svelte/frame-context.js +32 -0
- package/dist/svelte/index.d.ts +15 -0
- package/dist/svelte/index.js +9 -0
- package/dist/{motiongpu-context.d.ts → svelte/motiongpu-context.d.ts} +5 -7
- package/dist/{use-motiongpu-user-context.d.ts → svelte/use-motiongpu-user-context.d.ts} +2 -2
- package/dist/{use-motiongpu-user-context.js → svelte/use-motiongpu-user-context.js} +1 -1
- package/dist/{use-texture.d.ts → svelte/use-texture.d.ts} +2 -2
- package/dist/{use-texture.js → svelte/use-texture.js} +2 -2
- package/package.json +25 -5
- package/dist/FragCanvas.svelte +0 -511
- package/dist/current-writable.d.ts +0 -31
- package/dist/current-writable.js +0 -27
- /package/dist/{advanced-scheduler.js → core/scheduler-helpers.js} +0 -0
- /package/dist/{Portal.svelte → svelte/Portal.svelte} +0 -0
- /package/dist/{Portal.svelte.d.ts → svelte/Portal.svelte.d.ts} +0 -0
- /package/dist/{motiongpu-context.js → svelte/motiongpu-context.js} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte adapter advanced entrypoint for MotionGPU.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index.js';
|
|
5
|
+
export { applySchedulerPreset, captureSchedulerDebugSnapshot } from '../core/scheduler-helpers.js';
|
|
6
|
+
export { setMotionGPUUserContext, useMotionGPUUserContext } from './use-motiongpu-user-context.js';
|
|
7
|
+
export type { ApplySchedulerPresetOptions, SchedulerDebugSnapshot, SchedulerPreset, SchedulerPresetConfig } from '../core/scheduler-helpers.js';
|
|
8
|
+
export type { MotionGPUUserContext, MotionGPUUserNamespace } from './motiongpu-context.js';
|
|
9
|
+
export type { FrameProfilingSnapshot, FrameKey, FrameTaskInvalidation, FrameTaskInvalidationToken, FrameRunTimings, FrameScheduleSnapshot, FrameStage, FrameStageCallback, FrameTimingStats, FrameTask } from '../core/frame-registry.js';
|
|
10
|
+
export type { SetMotionGPUUserContextOptions } from './use-motiongpu-user-context.js';
|
|
11
|
+
export type { RenderPassContext, RenderTarget, UniformLayout, UniformLayoutEntry } from '../core/types.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte adapter advanced entrypoint for MotionGPU.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index.js';
|
|
5
|
+
export { applySchedulerPreset, captureSchedulerDebugSnapshot } from '../core/scheduler-helpers.js';
|
|
6
|
+
export { setMotionGPUUserContext, useMotionGPUUserContext } from './use-motiongpu-user-context.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFrameRegistry, type FrameCallback, type FrameKey, type FrameProfilingSnapshot, type FrameRegistry, type FrameRunTimings, type FrameScheduleSnapshot, type FrameStage, type FrameStageCallback, type FrameTask, type FrameTaskInvalidation, type FrameTaskInvalidationToken, type UseFrameOptions, type UseFrameResult } from '../core/frame-registry.js';
|
|
2
|
+
export { createFrameRegistry, type FrameCallback, type FrameKey, type FrameProfilingSnapshot, type FrameRegistry, type FrameRunTimings, type FrameScheduleSnapshot, type FrameStage, type FrameStageCallback, type FrameTask, type FrameTaskInvalidation, type FrameTaskInvalidationToken, type UseFrameOptions, type UseFrameResult };
|
|
3
|
+
/**
|
|
4
|
+
* Provides a frame registry through Svelte context.
|
|
5
|
+
*/
|
|
6
|
+
export declare function provideFrameRegistry(registry: FrameRegistry): void;
|
|
7
|
+
/**
|
|
8
|
+
* Registers a frame callback using an auto-generated task key.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFrame(callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
|
|
11
|
+
/**
|
|
12
|
+
* Registers a frame callback with an explicit task key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFrame(key: FrameKey, callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getContext, onDestroy, setContext } from 'svelte';
|
|
2
|
+
import { createFrameRegistry } from '../core/frame-registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Svelte context key for the active frame registry.
|
|
5
|
+
*/
|
|
6
|
+
const FRAME_CONTEXT_KEY = Symbol('motiongpu.frame-context');
|
|
7
|
+
export { createFrameRegistry };
|
|
8
|
+
/**
|
|
9
|
+
* Provides a frame registry through Svelte context.
|
|
10
|
+
*/
|
|
11
|
+
export function provideFrameRegistry(registry) {
|
|
12
|
+
setContext(FRAME_CONTEXT_KEY, registry);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Registers a callback in the active frame registry and auto-unsubscribes on destroy.
|
|
16
|
+
*/
|
|
17
|
+
export function useFrame(keyOrCallback, callbackOrOptions, maybeOptions) {
|
|
18
|
+
const registry = getContext(FRAME_CONTEXT_KEY);
|
|
19
|
+
if (!registry) {
|
|
20
|
+
throw new Error('useFrame must be used inside <FragCanvas>');
|
|
21
|
+
}
|
|
22
|
+
const registration = typeof keyOrCallback === 'function'
|
|
23
|
+
? registry.register(keyOrCallback, callbackOrOptions)
|
|
24
|
+
: registry.register(keyOrCallback, callbackOrOptions, maybeOptions);
|
|
25
|
+
onDestroy(registration.unsubscribe);
|
|
26
|
+
return {
|
|
27
|
+
task: registration.task,
|
|
28
|
+
start: registration.start,
|
|
29
|
+
stop: registration.stop,
|
|
30
|
+
started: registration.started
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte adapter entrypoint for MotionGPU.
|
|
3
|
+
*/
|
|
4
|
+
export { default as FragCanvas } from './FragCanvas.svelte';
|
|
5
|
+
export { defineMaterial } from '../core/material.js';
|
|
6
|
+
export { BlitPass, CopyPass, ShaderPass } from '../passes/index.js';
|
|
7
|
+
export { useMotionGPU } from './motiongpu-context.js';
|
|
8
|
+
export { useFrame } from './frame-context.js';
|
|
9
|
+
export { useTexture } from './use-texture.js';
|
|
10
|
+
export type { FrameInvalidationToken, FrameState, OutputColorSpace, RenderPass, RenderPassContext, RenderPassFlags, RenderPassInputSlot, RenderPassOutputSlot, RenderMode, RenderTarget, RenderTargetDefinition, RenderTargetDefinitionMap, TextureData, TextureDefinition, TextureDefinitionMap, TextureUpdateMode, TextureMap, TextureSource, TextureValue, TypedUniform, UniformMat4Value, UniformMap, UniformType, UniformValue } from '../core/types.js';
|
|
11
|
+
export type { LoadedTexture, TextureDecodeOptions, TextureLoadOptions } from '../core/texture-loader.js';
|
|
12
|
+
export type { FragMaterial, FragMaterialInput, MaterialIncludes, MaterialDefineValue, MaterialDefines, TypedMaterialDefineValue } from '../core/material.js';
|
|
13
|
+
export type { MotionGPUContext } from './motiongpu-context.js';
|
|
14
|
+
export type { UseFrameOptions, UseFrameResult } from './frame-context.js';
|
|
15
|
+
export type { TextureUrlInput, UseTextureResult } from './use-texture.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte adapter entrypoint for MotionGPU.
|
|
3
|
+
*/
|
|
4
|
+
export { default as FragCanvas } from './FragCanvas.svelte';
|
|
5
|
+
export { defineMaterial } from '../core/material.js';
|
|
6
|
+
export { BlitPass, CopyPass, ShaderPass } from '../passes/index.js';
|
|
7
|
+
export { useMotionGPU } from './motiongpu-context.js';
|
|
8
|
+
export { useFrame } from './frame-context.js';
|
|
9
|
+
export { useTexture } from './use-texture.js';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { RenderMode } from '
|
|
2
|
-
import type { CurrentReadable, CurrentWritable } from '
|
|
3
|
-
import type { FrameProfilingSnapshot,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export type MotionGPUScheduler = Pick<FrameRegistry, 'createStage' | 'getStage' | 'setDiagnosticsEnabled' | 'getDiagnosticsEnabled' | 'getLastRunTimings' | 'getSchedule' | 'setProfilingEnabled' | 'setProfilingWindow' | 'resetProfiling' | 'getProfilingEnabled' | 'getProfilingWindow' | 'getProfilingSnapshot'>;
|
|
1
|
+
import type { RenderMode } from '../core/types.js';
|
|
2
|
+
import type { CurrentReadable, CurrentWritable } from '../core/current-value.js';
|
|
3
|
+
import type { FrameProfilingSnapshot, FrameRunTimings, FrameScheduleSnapshot } from '../core/frame-registry.js';
|
|
4
|
+
import type { MotionGPUScheduler as CoreMotionGPUScheduler } from '../core/scheduler-helpers.js';
|
|
5
|
+
export type MotionGPUScheduler = CoreMotionGPUScheduler;
|
|
8
6
|
export type { FrameProfilingSnapshot, FrameRunTimings, FrameScheduleSnapshot };
|
|
9
7
|
/**
|
|
10
8
|
* Namespace identifier for user-owned context entries.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CurrentReadable } from '
|
|
2
|
-
import { type MotionGPUUserNamespace } from './motiongpu-context';
|
|
1
|
+
import type { CurrentReadable } from '../core/current-value.js';
|
|
2
|
+
import { type MotionGPUUserNamespace } from './motiongpu-context.js';
|
|
3
3
|
/**
|
|
4
4
|
* Internal shape of the user context store.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type LoadedTexture, type TextureLoadOptions } from '
|
|
1
|
+
import { type CurrentReadable } from '../core/current-value.js';
|
|
2
|
+
import { type LoadedTexture, type TextureLoadOptions } from '../core/texture-loader.js';
|
|
3
3
|
/**
|
|
4
4
|
* Reactive state returned by {@link useTexture}.
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
|
-
import { currentWritable } from '
|
|
3
|
-
import { isAbortError, loadTexturesFromUrls } from '
|
|
2
|
+
import { createCurrentWritable as currentWritable } from '../core/current-value.js';
|
|
3
|
+
import { isAbortError, loadTexturesFromUrls } from '../core/texture-loader.js';
|
|
4
4
|
/**
|
|
5
5
|
* Normalizes unknown thrown values to an `Error` instance.
|
|
6
6
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motion-core/motion-gpu",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte adapter entrypoints.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
7
7
|
"svelte5",
|
|
@@ -26,18 +26,33 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
29
|
-
"svelte": "./dist/index.js",
|
|
30
29
|
"types": "./dist/index.d.ts",
|
|
31
30
|
"exports": {
|
|
32
31
|
".": {
|
|
33
32
|
"types": "./dist/index.d.ts",
|
|
34
|
-
"svelte": "./dist/index.js",
|
|
35
33
|
"default": "./dist/index.js"
|
|
36
34
|
},
|
|
37
35
|
"./advanced": {
|
|
38
36
|
"types": "./dist/advanced.d.ts",
|
|
39
|
-
"svelte": "./dist/advanced.js",
|
|
40
37
|
"default": "./dist/advanced.js"
|
|
38
|
+
},
|
|
39
|
+
"./svelte": {
|
|
40
|
+
"types": "./dist/svelte/index.d.ts",
|
|
41
|
+
"svelte": "./dist/svelte/index.js",
|
|
42
|
+
"default": "./dist/svelte/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./svelte/advanced": {
|
|
45
|
+
"types": "./dist/svelte/advanced.d.ts",
|
|
46
|
+
"svelte": "./dist/svelte/advanced.js",
|
|
47
|
+
"default": "./dist/svelte/advanced.js"
|
|
48
|
+
},
|
|
49
|
+
"./core": {
|
|
50
|
+
"types": "./dist/core/index.d.ts",
|
|
51
|
+
"default": "./dist/core/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./core/advanced": {
|
|
54
|
+
"types": "./dist/core/advanced.d.ts",
|
|
55
|
+
"default": "./dist/core/advanced.js"
|
|
41
56
|
}
|
|
42
57
|
},
|
|
43
58
|
"files": [
|
|
@@ -65,6 +80,11 @@
|
|
|
65
80
|
"peerDependencies": {
|
|
66
81
|
"svelte": "^5.0.0"
|
|
67
82
|
},
|
|
83
|
+
"peerDependenciesMeta": {
|
|
84
|
+
"svelte": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
68
88
|
"devDependencies": {
|
|
69
89
|
"@eslint/compat": "^2.0.2",
|
|
70
90
|
"@eslint/js": "^10.0.1",
|