@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
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
**A tiny WebGPU runtime for writing Shadertoy-style fullscreen shaders in pure WGSL.**
|
|
14
14
|
|
|
15
|
-
`@motion-core/motion-gpu`
|
|
16
|
-
It provides a minimal runtime, scheduler, and render graph designed specifically for fragment-driven GPU programs.
|
|
15
|
+
`@motion-core/motion-gpu` ships a framework-agnostic core plus a Svelte 5 adapter for building fullscreen shader pipelines using WebGPU and WGSL.
|
|
16
|
+
It provides a minimal runtime loop, scheduler, and render graph designed specifically for fragment-driven GPU programs.
|
|
17
17
|
|
|
18
18
|
Unlike general-purpose 3D engines, Motion GPU focuses on a very narrow problem: **running fullscreen fragment shaders and multi-pass GPU pipelines**.
|
|
19
19
|
|
|
@@ -87,9 +87,9 @@ Motion GPU follows a simple three-step flow:
|
|
|
87
87
|
|
|
88
88
|
# Entrypoints
|
|
89
89
|
|
|
90
|
-
##
|
|
90
|
+
## Svelte adapter
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
`@motion-core/motion-gpu/svelte` exposes the runtime API for Svelte:
|
|
93
93
|
|
|
94
94
|
- `FragCanvas`
|
|
95
95
|
- `defineMaterial`
|
|
@@ -110,9 +110,7 @@ Also exports runtime/core types:
|
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Re-exports everything from root, plus:
|
|
113
|
+
`@motion-core/motion-gpu/svelte/advanced` re-exports everything above, plus:
|
|
116
114
|
|
|
117
115
|
- `useMotionGPUUserContext`
|
|
118
116
|
- `setMotionGPUUserContext`
|
|
@@ -121,9 +119,31 @@ Re-exports everything from root, plus:
|
|
|
121
119
|
|
|
122
120
|
---
|
|
123
121
|
|
|
122
|
+
## Framework-agnostic core
|
|
123
|
+
|
|
124
|
+
`@motion-core/motion-gpu` (and explicit alias `@motion-core/motion-gpu/core`) exposes adapter-building primitives:
|
|
125
|
+
|
|
126
|
+
- `defineMaterial`
|
|
127
|
+
- `resolveMaterial`
|
|
128
|
+
- `createCurrentWritable`
|
|
129
|
+
- `createFrameRegistry`
|
|
130
|
+
- `createMotionGPURuntimeLoop`
|
|
131
|
+
- `loadTexturesFromUrls`
|
|
132
|
+
- `toMotionGPUErrorReport`
|
|
133
|
+
- `ShaderPass`
|
|
134
|
+
- `BlitPass`
|
|
135
|
+
- `CopyPass`
|
|
136
|
+
|
|
137
|
+
`@motion-core/motion-gpu/advanced` (and explicit alias `@motion-core/motion-gpu/core/advanced`) re-exports core plus:
|
|
138
|
+
|
|
139
|
+
- `applySchedulerPreset`
|
|
140
|
+
- `captureSchedulerDebugSnapshot`
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
124
144
|
# Requirements
|
|
125
145
|
|
|
126
|
-
- Svelte 5 (
|
|
146
|
+
- Svelte 5 is required only for the Svelte adapter entrypoints (`/svelte`, `/svelte/advanced`)
|
|
127
147
|
- A browser/runtime with WebGPU support
|
|
128
148
|
- Secure context (`https://` or `localhost`)
|
|
129
149
|
|
|
@@ -144,7 +164,7 @@ npm i @motion-core/motion-gpu
|
|
|
144
164
|
```svelte
|
|
145
165
|
<!-- App.svelte -->
|
|
146
166
|
<script lang="ts">
|
|
147
|
-
import { FragCanvas, defineMaterial } from '@motion-core/motion-gpu';
|
|
167
|
+
import { FragCanvas, defineMaterial } from '@motion-core/motion-gpu/svelte';
|
|
148
168
|
|
|
149
169
|
const material = defineMaterial({
|
|
150
170
|
fragment: `
|
|
@@ -167,7 +187,7 @@ fn frag(uv: vec2f) -> vec4f {
|
|
|
167
187
|
```svelte
|
|
168
188
|
<!-- App.svelte -->
|
|
169
189
|
<script lang="ts">
|
|
170
|
-
import { FragCanvas, defineMaterial } from '@motion-core/motion-gpu';
|
|
190
|
+
import { FragCanvas, defineMaterial } from '@motion-core/motion-gpu/svelte';
|
|
171
191
|
import Runtime from './Runtime.svelte';
|
|
172
192
|
|
|
173
193
|
const material = defineMaterial({
|
|
@@ -191,7 +211,7 @@ fn frag(uv: vec2f) -> vec4f {
|
|
|
191
211
|
```svelte
|
|
192
212
|
<!-- Runtime.svelte -->
|
|
193
213
|
<script lang="ts">
|
|
194
|
-
import { useFrame } from '@motion-core/motion-gpu';
|
|
214
|
+
import { useFrame } from '@motion-core/motion-gpu/svelte';
|
|
195
215
|
|
|
196
216
|
useFrame((state) => {
|
|
197
217
|
state.setUniform('uTime', state.time);
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Root advanced package entrypoint.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* minimal root API surface.
|
|
4
|
+
* Framework-agnostic advanced core entrypoint.
|
|
6
5
|
*/
|
|
7
|
-
export * from './
|
|
8
|
-
export { applySchedulerPreset, captureSchedulerDebugSnapshot } from './advanced-scheduler';
|
|
9
|
-
export { setMotionGPUUserContext, useMotionGPUUserContext } from './use-motiongpu-user-context';
|
|
10
|
-
export type { ApplySchedulerPresetOptions, SchedulerDebugSnapshot, SchedulerPreset, SchedulerPresetConfig } from './advanced-scheduler';
|
|
11
|
-
export type { MotionGPUUserContext, MotionGPUUserNamespace } from './motiongpu-context';
|
|
12
|
-
export type { FrameProfilingSnapshot, FrameKey, FrameTaskInvalidation, FrameTaskInvalidationToken, FrameRunTimings, FrameScheduleSnapshot, FrameStage, FrameStageCallback, FrameTimingStats, FrameTask } from './frame-context';
|
|
13
|
-
export type { SetMotionGPUUserContextOptions } from './use-motiongpu-user-context';
|
|
14
|
-
export type { RenderPassContext, RenderTarget, UniformLayout, UniformLayoutEntry } from './core/types';
|
|
6
|
+
export * from './core/advanced.js';
|
package/dist/advanced.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Root advanced package entrypoint.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* minimal root API surface.
|
|
4
|
+
* Framework-agnostic advanced core entrypoint.
|
|
6
5
|
*/
|
|
7
|
-
export * from './
|
|
8
|
-
export { applySchedulerPreset, captureSchedulerDebugSnapshot } from './advanced-scheduler';
|
|
9
|
-
export { setMotionGPUUserContext, useMotionGPUUserContext } from './use-motiongpu-user-context';
|
|
6
|
+
export * from './core/advanced.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic advanced MotionGPU core entrypoint.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index.js';
|
|
5
|
+
export { applySchedulerPreset, captureSchedulerDebugSnapshot } from './scheduler-helpers.js';
|
|
6
|
+
export type { ApplySchedulerPresetOptions, MotionGPUScheduler, SchedulerDebugSnapshot, SchedulerPreset, SchedulerPresetConfig } from './scheduler-helpers.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal subscribe contract used by MotionGPU core.
|
|
3
|
+
*/
|
|
4
|
+
export interface Subscribable<T> {
|
|
5
|
+
subscribe: (run: (value: T) => void) => () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Readable value with synchronous access to the latest value.
|
|
9
|
+
*/
|
|
10
|
+
export interface CurrentReadable<T> extends Subscribable<T> {
|
|
11
|
+
readonly current: T;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Writable extension of {@link CurrentReadable}.
|
|
15
|
+
*/
|
|
16
|
+
export interface CurrentWritable<T> extends CurrentReadable<T> {
|
|
17
|
+
set: (value: T) => void;
|
|
18
|
+
update: (updater: (value: T) => T) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a writable value with immediate subscription semantics.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCurrentWritable<T>(initialValue: T, onChange?: (value: T) => void): CurrentWritable<T>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a writable value with immediate subscription semantics.
|
|
3
|
+
*/
|
|
4
|
+
export function createCurrentWritable(initialValue, onChange) {
|
|
5
|
+
let current = initialValue;
|
|
6
|
+
const subscribers = new Set();
|
|
7
|
+
const notify = (value) => {
|
|
8
|
+
for (const run of subscribers) {
|
|
9
|
+
run(value);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const set = (value) => {
|
|
13
|
+
current = value;
|
|
14
|
+
notify(value);
|
|
15
|
+
onChange?.(value);
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
get current() {
|
|
19
|
+
return current;
|
|
20
|
+
},
|
|
21
|
+
subscribe(run) {
|
|
22
|
+
subscribers.add(run);
|
|
23
|
+
run(current);
|
|
24
|
+
return () => {
|
|
25
|
+
subscribers.delete(run);
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
set,
|
|
29
|
+
update(updater) {
|
|
30
|
+
set(updater(current));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getShaderCompilationDiagnostics } from './error-diagnostics';
|
|
2
|
-
import { formatShaderSourceLocation } from './shader';
|
|
1
|
+
import { getShaderCompilationDiagnostics } from './error-diagnostics.js';
|
|
2
|
+
import { formatShaderSourceLocation } from './shader.js';
|
|
3
3
|
/**
|
|
4
4
|
* Splits multi-line values into trimmed non-empty lines.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { FrameInvalidationToken, FrameState, RenderMode } from './
|
|
1
|
+
import { type Subscribable } from './current-value.js';
|
|
2
|
+
import type { FrameInvalidationToken, FrameState, RenderMode } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Per-frame callback executed by the frame scheduler.
|
|
5
5
|
*/
|
|
@@ -97,7 +97,7 @@ export interface UseFrameResult {
|
|
|
97
97
|
/**
|
|
98
98
|
* Readable flag representing effective running state.
|
|
99
99
|
*/
|
|
100
|
-
started:
|
|
100
|
+
started: Subscribable<boolean>;
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Snapshot of the resolved stage/task execution order.
|
|
@@ -270,18 +270,4 @@ export declare function createFrameRegistry(options?: {
|
|
|
270
270
|
profilingWindow?: number;
|
|
271
271
|
diagnosticsEnabled?: boolean;
|
|
272
272
|
}): FrameRegistry;
|
|
273
|
-
/**
|
|
274
|
-
* Provides a frame registry through Svelte context.
|
|
275
|
-
*
|
|
276
|
-
* @param registry - Registry to provide.
|
|
277
|
-
*/
|
|
278
|
-
export declare function provideFrameRegistry(registry: FrameRegistry): void;
|
|
279
|
-
/**
|
|
280
|
-
* Registers a frame callback using an auto-generated task key.
|
|
281
|
-
*/
|
|
282
|
-
export declare function useFrame(callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
|
|
283
|
-
/**
|
|
284
|
-
* Registers a frame callback with an explicit task key.
|
|
285
|
-
*/
|
|
286
|
-
export declare function useFrame(key: FrameKey, callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
|
|
287
273
|
export {};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { writable } from 'svelte/store';
|
|
3
|
-
/**
|
|
4
|
-
* Svelte context key for the active frame registry.
|
|
5
|
-
*/
|
|
6
|
-
const FRAME_CONTEXT_KEY = Symbol('motiongpu.frame-context');
|
|
1
|
+
import { createCurrentWritable } from './current-value.js';
|
|
7
2
|
/**
|
|
8
3
|
* Default stage key used when task stage is not explicitly specified.
|
|
9
4
|
*/
|
|
@@ -492,7 +487,7 @@ export function createFrameRegistry(options) {
|
|
|
492
487
|
? toStageKey(taskOptions.stage)
|
|
493
488
|
: (inferredStage?.stage ?? MAIN_STAGE_KEY);
|
|
494
489
|
const stage = ensureStage(stageKey);
|
|
495
|
-
const startedWritable =
|
|
490
|
+
const startedWritable = createCurrentWritable(taskOptions.autoStart ?? true);
|
|
496
491
|
const internalTask = {
|
|
497
492
|
task: { key, stage: stage.key },
|
|
498
493
|
callback,
|
|
@@ -699,33 +694,3 @@ export function createFrameRegistry(options) {
|
|
|
699
694
|
}
|
|
700
695
|
};
|
|
701
696
|
}
|
|
702
|
-
/**
|
|
703
|
-
* Provides a frame registry through Svelte context.
|
|
704
|
-
*
|
|
705
|
-
* @param registry - Registry to provide.
|
|
706
|
-
*/
|
|
707
|
-
export function provideFrameRegistry(registry) {
|
|
708
|
-
setContext(FRAME_CONTEXT_KEY, registry);
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Registers a callback in the active frame registry and auto-unsubscribes on destroy.
|
|
712
|
-
*
|
|
713
|
-
* @returns Frame task handle for start/stop control.
|
|
714
|
-
* @throws {Error} When used outside `<FragCanvas>`.
|
|
715
|
-
*/
|
|
716
|
-
export function useFrame(keyOrCallback, callbackOrOptions, maybeOptions) {
|
|
717
|
-
const registry = getContext(FRAME_CONTEXT_KEY);
|
|
718
|
-
if (!registry) {
|
|
719
|
-
throw new Error('useFrame must be used inside <FragCanvas>');
|
|
720
|
-
}
|
|
721
|
-
const registration = typeof keyOrCallback === 'function'
|
|
722
|
-
? registry.register(keyOrCallback, callbackOrOptions)
|
|
723
|
-
: registry.register(keyOrCallback, callbackOrOptions, maybeOptions);
|
|
724
|
-
onDestroy(registration.unsubscribe);
|
|
725
|
-
return {
|
|
726
|
-
task: registration.task,
|
|
727
|
-
start: registration.start,
|
|
728
|
-
stop: registration.stop,
|
|
729
|
-
started: registration.started
|
|
730
|
-
};
|
|
731
|
-
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic MotionGPU core entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* This surface is intended for building framework adapters (Svelte/React/Vue).
|
|
5
|
+
*/
|
|
6
|
+
export { defineMaterial, resolveMaterial } from './material.js';
|
|
7
|
+
export { toMotionGPUErrorReport } from './error-report.js';
|
|
8
|
+
export { createCurrentWritable } from './current-value.js';
|
|
9
|
+
export { createFrameRegistry } from './frame-registry.js';
|
|
10
|
+
export { createMotionGPURuntimeLoop } from './runtime-loop.js';
|
|
11
|
+
export { loadTexturesFromUrls } from './texture-loader.js';
|
|
12
|
+
export { BlitPass, CopyPass, ShaderPass } from '../passes/index.js';
|
|
13
|
+
export type { CurrentReadable, CurrentWritable, Subscribable } from './current-value.js';
|
|
14
|
+
export type { MotionGPUErrorPhase, MotionGPUErrorReport, MotionGPUErrorSource, MotionGPUErrorSourceLine } from './error-report.js';
|
|
15
|
+
export type { FrameCallback, FrameKey, FrameProfilingSnapshot, FrameRegistry, FrameRunTimings, FrameScheduleSnapshot, FrameStage, FrameStageCallback, FrameTask, FrameTaskInvalidation, FrameTaskInvalidationToken, FrameTimingStats, UseFrameOptions, UseFrameResult } from './frame-registry.js';
|
|
16
|
+
export type { FragMaterial, FragMaterialInput, MaterialDefineValue, MaterialDefines, MaterialIncludes, ResolvedMaterial, TypedMaterialDefineValue } from './material.js';
|
|
17
|
+
export type { MotionGPURuntimeLoop, MotionGPURuntimeLoopOptions } from './runtime-loop.js';
|
|
18
|
+
export type { LoadedTexture, TextureDecodeOptions, TextureLoadOptions } from './texture-loader.js';
|
|
19
|
+
export type { FrameInvalidationToken, FrameState, OutputColorSpace, RenderPass, RenderPassContext, RenderPassFlags, RenderPassInputSlot, RenderPassOutputSlot, RenderMode, RenderTarget, RenderTargetDefinition, RenderTargetDefinitionMap, TextureData, TextureDefinition, TextureDefinitionMap, TextureMap, TextureSource, TextureUpdateMode, TextureValue, TypedUniform, UniformLayout, UniformLayoutEntry, UniformMap, UniformMat4Value, UniformType, UniformValue } from './types.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic MotionGPU core entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* This surface is intended for building framework adapters (Svelte/React/Vue).
|
|
5
|
+
*/
|
|
6
|
+
export { defineMaterial, resolveMaterial } from './material.js';
|
|
7
|
+
export { toMotionGPUErrorReport } from './error-report.js';
|
|
8
|
+
export { createCurrentWritable } from './current-value.js';
|
|
9
|
+
export { createFrameRegistry } from './frame-registry.js';
|
|
10
|
+
export { createMotionGPURuntimeLoop } from './runtime-loop.js';
|
|
11
|
+
export { loadTexturesFromUrls } from './texture-loader.js';
|
|
12
|
+
export { BlitPass, CopyPass, ShaderPass } from '../passes/index.js';
|
package/dist/core/material.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { MaterialSourceMetadata } from './error-diagnostics';
|
|
2
|
-
import { resolveUniformLayout } from './uniforms';
|
|
3
|
-
import { type MaterialLineMap } from './material-preprocess';
|
|
4
|
-
import type { TextureDefinitionMap, UniformMap } from './types';
|
|
1
|
+
import type { MaterialSourceMetadata } from './error-diagnostics.js';
|
|
2
|
+
import { resolveUniformLayout } from './uniforms.js';
|
|
3
|
+
import { type MaterialLineMap } from './material-preprocess.js';
|
|
4
|
+
import type { TextureDefinitionMap, UniformMap } from './types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Typed compile-time define declaration.
|
|
7
7
|
*/
|
package/dist/core/material.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { normalizeTextureDefinition } from './textures';
|
|
2
|
-
import { assertUniformName, assertUniformValueForType, inferUniformType, resolveUniformLayout } from './uniforms';
|
|
3
|
-
import { normalizeDefines, normalizeIncludes, preprocessMaterialFragment, toDefineLine } from './material-preprocess';
|
|
1
|
+
import { normalizeTextureDefinition } from './textures.js';
|
|
2
|
+
import { assertUniformName, assertUniformValueForType, inferUniformType, resolveUniformLayout } from './uniforms.js';
|
|
3
|
+
import { normalizeDefines, normalizeIncludes, preprocessMaterialFragment, toDefineLine } from './material-preprocess.js';
|
|
4
4
|
/**
|
|
5
5
|
* Strict fragment contract used by MotionGPU.
|
|
6
6
|
*/
|
package/dist/core/renderer.d.ts
CHANGED
package/dist/core/renderer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { buildRenderTargetSignature, resolveRenderTargetDefinitions } from './render-targets';
|
|
2
|
-
import { planRenderGraph } from './render-graph';
|
|
3
|
-
import { buildShaderSourceWithMap, formatShaderSourceLocation } from './shader';
|
|
4
|
-
import { attachShaderCompilationDiagnostics } from './error-diagnostics';
|
|
5
|
-
import { getTextureMipLevelCount, normalizeTextureDefinitions, resolveTextureUpdateMode, resolveTextureSize, toTextureData } from './textures';
|
|
6
|
-
import { packUniformsInto } from './uniforms';
|
|
1
|
+
import { buildRenderTargetSignature, resolveRenderTargetDefinitions } from './render-targets.js';
|
|
2
|
+
import { planRenderGraph } from './render-graph.js';
|
|
3
|
+
import { buildShaderSourceWithMap, formatShaderSourceLocation } from './shader.js';
|
|
4
|
+
import { attachShaderCompilationDiagnostics } from './error-diagnostics.js';
|
|
5
|
+
import { getTextureMipLevelCount, normalizeTextureDefinitions, resolveTextureUpdateMode, resolveTextureSize, toTextureData } from './textures.js';
|
|
6
|
+
import { packUniformsInto } from './uniforms.js';
|
|
7
7
|
/**
|
|
8
8
|
* Binding index for frame uniforms (`time`, `delta`, `resolution`).
|
|
9
9
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CurrentReadable, CurrentWritable } from './current-value.js';
|
|
2
|
+
import { type FragMaterial } from './material.js';
|
|
3
|
+
import { type MotionGPUErrorReport } from './error-report.js';
|
|
4
|
+
import type { FrameRegistry } from './frame-registry.js';
|
|
5
|
+
import type { FrameInvalidationToken, OutputColorSpace, RenderPass, RenderTargetDefinitionMap } from './types.js';
|
|
6
|
+
export interface MotionGPURuntimeLoopOptions {
|
|
7
|
+
canvas: HTMLCanvasElement;
|
|
8
|
+
registry: FrameRegistry;
|
|
9
|
+
size: CurrentWritable<{
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}>;
|
|
13
|
+
dpr: CurrentReadable<number>;
|
|
14
|
+
maxDelta: CurrentReadable<number>;
|
|
15
|
+
getMaterial: () => FragMaterial;
|
|
16
|
+
getRenderTargets: () => RenderTargetDefinitionMap;
|
|
17
|
+
getPasses: () => RenderPass[];
|
|
18
|
+
getClearColor: () => [number, number, number, number];
|
|
19
|
+
getOutputColorSpace: () => OutputColorSpace;
|
|
20
|
+
getAdapterOptions: () => GPURequestAdapterOptions | undefined;
|
|
21
|
+
getDeviceDescriptor: () => GPUDeviceDescriptor | undefined;
|
|
22
|
+
getOnError: () => ((report: MotionGPUErrorReport) => void) | undefined;
|
|
23
|
+
reportError: (report: MotionGPUErrorReport | null) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface MotionGPURuntimeLoop {
|
|
26
|
+
requestFrame: () => void;
|
|
27
|
+
invalidate: (token?: FrameInvalidationToken) => void;
|
|
28
|
+
advance: () => void;
|
|
29
|
+
destroy: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createMotionGPURuntimeLoop(options: MotionGPURuntimeLoopOptions): MotionGPURuntimeLoop;
|