@motion-core/motion-gpu 0.5.0 → 0.6.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.
Files changed (45) hide show
  1. package/dist/core/compute-bindgroup-cache.d.ts +13 -0
  2. package/dist/core/compute-bindgroup-cache.d.ts.map +1 -0
  3. package/dist/core/compute-bindgroup-cache.js +45 -0
  4. package/dist/core/compute-bindgroup-cache.js.map +1 -0
  5. package/dist/core/compute-shader.d.ts +48 -0
  6. package/dist/core/compute-shader.d.ts.map +1 -1
  7. package/dist/core/compute-shader.js +34 -1
  8. package/dist/core/compute-shader.js.map +1 -1
  9. package/dist/core/error-diagnostics.d.ts +8 -1
  10. package/dist/core/error-diagnostics.d.ts.map +1 -1
  11. package/dist/core/error-diagnostics.js +7 -3
  12. package/dist/core/error-diagnostics.js.map +1 -1
  13. package/dist/core/error-report.d.ts.map +1 -1
  14. package/dist/core/error-report.js +19 -1
  15. package/dist/core/error-report.js.map +1 -1
  16. package/dist/core/material.d.ts.map +1 -1
  17. package/dist/core/material.js +2 -1
  18. package/dist/core/material.js.map +1 -1
  19. package/dist/core/renderer.d.ts.map +1 -1
  20. package/dist/core/renderer.js +150 -85
  21. package/dist/core/renderer.js.map +1 -1
  22. package/dist/core/runtime-loop.d.ts.map +1 -1
  23. package/dist/core/runtime-loop.js +26 -14
  24. package/dist/core/runtime-loop.js.map +1 -1
  25. package/dist/core/shader.d.ts +7 -2
  26. package/dist/core/shader.d.ts.map +1 -1
  27. package/dist/core/shader.js +1 -0
  28. package/dist/core/shader.js.map +1 -1
  29. package/dist/core/textures.d.ts +4 -0
  30. package/dist/core/textures.d.ts.map +1 -1
  31. package/dist/core/textures.js +2 -1
  32. package/dist/core/textures.js.map +1 -1
  33. package/dist/core/types.d.ts +1 -1
  34. package/dist/core/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/lib/core/compute-bindgroup-cache.ts +73 -0
  37. package/src/lib/core/compute-shader.ts +86 -0
  38. package/src/lib/core/error-diagnostics.ts +29 -4
  39. package/src/lib/core/error-report.ts +26 -1
  40. package/src/lib/core/material.ts +2 -1
  41. package/src/lib/core/renderer.ts +198 -92
  42. package/src/lib/core/runtime-loop.ts +37 -16
  43. package/src/lib/core/shader.ts +13 -2
  44. package/src/lib/core/textures.ts +6 -1
  45. package/src/lib/core/types.ts +1 -1
@@ -2,6 +2,11 @@ import { assertUniformName } from './uniforms.js';
2
2
  import type { MaterialLineMap, MaterialSourceLocation } from './material-preprocess.js';
3
3
  import type { StorageBufferType, UniformLayout } from './types.js';
4
4
 
5
+ type ComputeShaderSourceLocation = {
6
+ kind: 'compute';
7
+ line: number;
8
+ };
9
+
5
10
  /**
6
11
  * Fallback uniform field used when no custom uniforms are provided.
7
12
  */
@@ -146,7 +151,7 @@ function buildFragmentOutput(keepAliveExpression: string, enableSrgbTransform: b
146
151
  /**
147
152
  * 1-based map from generated WGSL lines to original material source lines.
148
153
  */
149
- export type ShaderLineMap = Array<MaterialSourceLocation | null>;
154
+ export type ShaderLineMap = Array<(MaterialSourceLocation | ComputeShaderSourceLocation) | null>;
150
155
 
151
156
  /**
152
157
  * Result of shader source generation with line mapping metadata.
@@ -284,7 +289,9 @@ export function buildShaderSourceWithMap(
284
289
  /**
285
290
  * Converts source location metadata to user-facing diagnostics label.
286
291
  */
287
- export function formatShaderSourceLocation(location: MaterialSourceLocation | null): string | null {
292
+ export function formatShaderSourceLocation(
293
+ location: (MaterialSourceLocation | ComputeShaderSourceLocation) | null
294
+ ): string | null {
288
295
  if (!location) {
289
296
  return null;
290
297
  }
@@ -297,5 +304,9 @@ export function formatShaderSourceLocation(location: MaterialSourceLocation | nu
297
304
  return `include <${location.include}> line ${location.line}`;
298
305
  }
299
306
 
307
+ if (location.kind === 'compute') {
308
+ return `compute line ${location.line}`;
309
+ }
310
+
300
311
  return `define "${location.define}" line ${location.line}`;
301
312
  }
@@ -59,6 +59,10 @@ export interface NormalizedTextureDefinition {
59
59
  * Whether this texture is a storage texture (writable by compute).
60
60
  */
61
61
  storage: boolean;
62
+ /**
63
+ * Whether this texture should be exposed as a fragment-stage sampled binding.
64
+ */
65
+ fragmentVisible: boolean;
62
66
  /**
63
67
  * Explicit width for storage textures. Undefined when derived from source.
64
68
  */
@@ -115,7 +119,8 @@ export function normalizeTextureDefinition(
115
119
  filter: definition?.filter ?? DEFAULT_TEXTURE_FILTER,
116
120
  addressModeU: definition?.addressModeU ?? DEFAULT_TEXTURE_ADDRESS_MODE,
117
121
  addressModeV: definition?.addressModeV ?? DEFAULT_TEXTURE_ADDRESS_MODE,
118
- storage: isStorage
122
+ storage: isStorage,
123
+ fragmentVisible: definition?.fragmentVisible ?? true
119
124
  };
120
125
 
121
126
  if (definition?.width !== undefined) {
@@ -726,7 +726,7 @@ export interface Renderer {
726
726
  width: number;
727
727
  height: number;
728
728
  };
729
- pendingStorageWrites?: PendingStorageWrite[];
729
+ pendingStorageWrites?: PendingStorageWrite[] | undefined;
730
730
  }) => void;
731
731
  /**
732
732
  * Returns the GPU buffer for a named storage buffer, if allocated.