@motion-core/motion-gpu 0.4.2 → 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 (121) hide show
  1. package/README.md +99 -0
  2. package/dist/advanced.js +3 -1
  3. package/dist/core/advanced.js +3 -1
  4. package/dist/core/compute-bindgroup-cache.d.ts +13 -0
  5. package/dist/core/compute-bindgroup-cache.d.ts.map +1 -0
  6. package/dist/core/compute-bindgroup-cache.js +45 -0
  7. package/dist/core/compute-bindgroup-cache.js.map +1 -0
  8. package/dist/core/compute-shader.d.ts +135 -0
  9. package/dist/core/compute-shader.d.ts.map +1 -0
  10. package/dist/core/compute-shader.js +238 -0
  11. package/dist/core/compute-shader.js.map +1 -0
  12. package/dist/core/error-diagnostics.d.ts +8 -1
  13. package/dist/core/error-diagnostics.d.ts.map +1 -1
  14. package/dist/core/error-diagnostics.js +7 -3
  15. package/dist/core/error-diagnostics.js.map +1 -1
  16. package/dist/core/error-report.d.ts +1 -1
  17. package/dist/core/error-report.d.ts.map +1 -1
  18. package/dist/core/error-report.js +82 -1
  19. package/dist/core/error-report.js.map +1 -1
  20. package/dist/core/frame-registry.d.ts.map +1 -1
  21. package/dist/core/frame-registry.js +1 -1
  22. package/dist/core/frame-registry.js.map +1 -1
  23. package/dist/core/index.d.ts +5 -2
  24. package/dist/core/index.d.ts.map +1 -1
  25. package/dist/core/index.js +3 -1
  26. package/dist/core/material-preprocess.d.ts.map +1 -1
  27. package/dist/core/material-preprocess.js +5 -3
  28. package/dist/core/material-preprocess.js.map +1 -1
  29. package/dist/core/material.d.ts +22 -6
  30. package/dist/core/material.d.ts.map +1 -1
  31. package/dist/core/material.js +32 -4
  32. package/dist/core/material.js.map +1 -1
  33. package/dist/core/render-graph.d.ts +7 -3
  34. package/dist/core/render-graph.d.ts.map +1 -1
  35. package/dist/core/render-graph.js +22 -6
  36. package/dist/core/render-graph.js.map +1 -1
  37. package/dist/core/renderer.d.ts.map +1 -1
  38. package/dist/core/renderer.js +489 -29
  39. package/dist/core/renderer.js.map +1 -1
  40. package/dist/core/runtime-loop.d.ts +2 -2
  41. package/dist/core/runtime-loop.d.ts.map +1 -1
  42. package/dist/core/runtime-loop.js +74 -14
  43. package/dist/core/runtime-loop.js.map +1 -1
  44. package/dist/core/shader.d.ts +16 -3
  45. package/dist/core/shader.d.ts.map +1 -1
  46. package/dist/core/shader.js +22 -2
  47. package/dist/core/shader.js.map +1 -1
  48. package/dist/core/storage-buffers.d.ts +37 -0
  49. package/dist/core/storage-buffers.d.ts.map +1 -0
  50. package/dist/core/storage-buffers.js +95 -0
  51. package/dist/core/storage-buffers.js.map +1 -0
  52. package/dist/core/texture-loader.d.ts.map +1 -1
  53. package/dist/core/texture-loader.js +4 -0
  54. package/dist/core/texture-loader.js.map +1 -1
  55. package/dist/core/textures.d.ts +16 -0
  56. package/dist/core/textures.d.ts.map +1 -1
  57. package/dist/core/textures.js +8 -2
  58. package/dist/core/textures.js.map +1 -1
  59. package/dist/core/types.d.ts +146 -4
  60. package/dist/core/types.d.ts.map +1 -1
  61. package/dist/index.js +3 -1
  62. package/dist/passes/ComputePass.d.ts +83 -0
  63. package/dist/passes/ComputePass.d.ts.map +1 -0
  64. package/dist/passes/ComputePass.js +92 -0
  65. package/dist/passes/ComputePass.js.map +1 -0
  66. package/dist/passes/PingPongComputePass.d.ts +104 -0
  67. package/dist/passes/PingPongComputePass.d.ts.map +1 -0
  68. package/dist/passes/PingPongComputePass.js +132 -0
  69. package/dist/passes/PingPongComputePass.js.map +1 -0
  70. package/dist/passes/ShaderPass.d.ts.map +1 -1
  71. package/dist/passes/ShaderPass.js +2 -1
  72. package/dist/passes/ShaderPass.js.map +1 -1
  73. package/dist/passes/index.d.ts +2 -0
  74. package/dist/passes/index.d.ts.map +1 -1
  75. package/dist/passes/index.js +3 -1
  76. package/dist/react/FragCanvas.d.ts +2 -2
  77. package/dist/react/FragCanvas.d.ts.map +1 -1
  78. package/dist/react/FragCanvas.js.map +1 -1
  79. package/dist/react/MotionGPUErrorOverlay.d.ts.map +1 -1
  80. package/dist/react/MotionGPUErrorOverlay.js +123 -20
  81. package/dist/react/MotionGPUErrorOverlay.js.map +1 -1
  82. package/dist/react/advanced.js +3 -1
  83. package/dist/react/index.d.ts +5 -2
  84. package/dist/react/index.d.ts.map +1 -1
  85. package/dist/react/index.js +3 -1
  86. package/dist/svelte/FragCanvas.svelte +2 -2
  87. package/dist/svelte/FragCanvas.svelte.d.ts +2 -2
  88. package/dist/svelte/FragCanvas.svelte.d.ts.map +1 -1
  89. package/dist/svelte/MotionGPUErrorOverlay.svelte +137 -7
  90. package/dist/svelte/MotionGPUErrorOverlay.svelte.d.ts.map +1 -1
  91. package/dist/svelte/advanced.js +3 -1
  92. package/dist/svelte/index.d.ts +5 -2
  93. package/dist/svelte/index.d.ts.map +1 -1
  94. package/dist/svelte/index.js +3 -1
  95. package/package.json +1 -1
  96. package/src/lib/core/compute-bindgroup-cache.ts +73 -0
  97. package/src/lib/core/compute-shader.ts +412 -0
  98. package/src/lib/core/error-diagnostics.ts +29 -4
  99. package/src/lib/core/error-report.ts +155 -1
  100. package/src/lib/core/frame-registry.ts +2 -1
  101. package/src/lib/core/index.ts +18 -1
  102. package/src/lib/core/material-preprocess.ts +17 -6
  103. package/src/lib/core/material.ts +103 -21
  104. package/src/lib/core/render-graph.ts +39 -9
  105. package/src/lib/core/renderer.ts +768 -48
  106. package/src/lib/core/runtime-loop.ts +116 -16
  107. package/src/lib/core/shader.ts +58 -4
  108. package/src/lib/core/storage-buffers.ts +142 -0
  109. package/src/lib/core/texture-loader.ts +6 -0
  110. package/src/lib/core/textures.ts +29 -2
  111. package/src/lib/core/types.ts +165 -4
  112. package/src/lib/passes/ComputePass.ts +136 -0
  113. package/src/lib/passes/PingPongComputePass.ts +180 -0
  114. package/src/lib/passes/ShaderPass.ts +2 -1
  115. package/src/lib/passes/index.ts +6 -0
  116. package/src/lib/react/FragCanvas.tsx +3 -3
  117. package/src/lib/react/MotionGPUErrorOverlay.tsx +137 -5
  118. package/src/lib/react/index.ts +18 -1
  119. package/src/lib/svelte/FragCanvas.svelte +2 -2
  120. package/src/lib/svelte/MotionGPUErrorOverlay.svelte +137 -7
  121. package/src/lib/svelte/index.ts +18 -1
@@ -9,6 +9,11 @@ export interface MaterialSourceMetadata {
9
9
  column?: number;
10
10
  functionName?: string;
11
11
  }
12
+ export interface ComputeSourceLocation {
13
+ kind: 'compute';
14
+ line: number;
15
+ }
16
+ export type ShaderSourceLocation = MaterialSourceLocation | ComputeSourceLocation;
12
17
  /**
13
18
  * One WGSL compiler diagnostic enriched with source-location metadata.
14
19
  */
@@ -17,7 +22,7 @@ export interface ShaderCompilationDiagnostic {
17
22
  message: string;
18
23
  linePos?: number;
19
24
  lineLength?: number;
20
- sourceLocation: MaterialSourceLocation | null;
25
+ sourceLocation: ShaderSourceLocation | null;
21
26
  }
22
27
  /**
23
28
  * Runtime context snapshot captured for shader compilation diagnostics.
@@ -37,8 +42,10 @@ export interface ShaderCompilationRuntimeContext {
37
42
  */
38
43
  export interface ShaderCompilationDiagnosticsPayload {
39
44
  kind: 'shader-compilation';
45
+ shaderStage?: 'fragment' | 'compute';
40
46
  diagnostics: ShaderCompilationDiagnostic[];
41
47
  fragmentSource: string;
48
+ computeSource?: string;
42
49
  includeSources: Record<string, string>;
43
50
  defineBlockSource?: string;
44
51
  materialSource: MaterialSourceMetadata | null;
@@ -1 +1 @@
1
- {"version":3,"file":"error-diagnostics.d.ts","sourceRoot":"","sources":["../../src/lib/core/error-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CA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AAG,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE,+BAA+B,CAAC;CACjD;AAkHD;;GAEG;AACH,wBAAgB,kCAAkC,CACjD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,mCAAmC,GAC1C,KAAK,CAGP;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC9C,KAAK,EAAE,OAAO,GACZ,mCAAmC,GAAG,IAAI,CAwE5C"}
@@ -9,12 +9,12 @@ function isMaterialSourceMetadata(value) {
9
9
  if (record.column !== void 0 && typeof record.column !== "number") return false;
10
10
  return true;
11
11
  }
12
- function isMaterialSourceLocation(value) {
12
+ function isShaderSourceLocation(value) {
13
13
  if (value === null) return true;
14
14
  if (typeof value !== "object") return false;
15
15
  const record = value;
16
16
  const kind = record.kind;
17
- if (kind !== "fragment" && kind !== "include" && kind !== "define") return false;
17
+ if (kind !== "fragment" && kind !== "include" && kind !== "define" && kind !== "compute") return false;
18
18
  return typeof record.line === "number";
19
19
  }
20
20
  function isShaderCompilationDiagnostic(value) {
@@ -24,7 +24,7 @@ function isShaderCompilationDiagnostic(value) {
24
24
  if (typeof record.message !== "string") return false;
25
25
  if (record.linePos !== void 0 && typeof record.linePos !== "number") return false;
26
26
  if (record.lineLength !== void 0 && typeof record.lineLength !== "number") return false;
27
- if (!isMaterialSourceLocation(record.sourceLocation)) return false;
27
+ if (!isShaderSourceLocation(record.sourceLocation)) return false;
28
28
  return true;
29
29
  }
30
30
  function isStringArray(value) {
@@ -60,8 +60,10 @@ function getShaderCompilationDiagnostics(error) {
60
60
  if (payload === null || typeof payload !== "object") return null;
61
61
  const record = payload;
62
62
  if (record.kind !== "shader-compilation") return null;
63
+ if (record.shaderStage !== void 0 && record.shaderStage !== "fragment" && record.shaderStage !== "compute") return null;
63
64
  if (!Array.isArray(record.diagnostics) || !record.diagnostics.every(isShaderCompilationDiagnostic)) return null;
64
65
  if (typeof record.fragmentSource !== "string") return null;
66
+ if (record.computeSource !== void 0 && typeof record.computeSource !== "string") return null;
65
67
  if (record.defineBlockSource !== void 0 && typeof record.defineBlockSource !== "string") return null;
66
68
  if (record.includeSources === null || typeof record.includeSources !== "object") return null;
67
69
  const includeSources = record.includeSources;
@@ -70,8 +72,10 @@ function getShaderCompilationDiagnostics(error) {
70
72
  if (record.runtimeContext !== void 0 && !isShaderCompilationRuntimeContext(record.runtimeContext)) return null;
71
73
  return {
72
74
  kind: "shader-compilation",
75
+ ...record.shaderStage !== void 0 ? { shaderStage: record.shaderStage } : {},
73
76
  diagnostics: record.diagnostics,
74
77
  fragmentSource: record.fragmentSource,
78
+ ...record.computeSource !== void 0 ? { computeSource: record.computeSource } : {},
75
79
  includeSources,
76
80
  ...record.defineBlockSource !== void 0 ? { defineBlockSource: record.defineBlockSource } : {},
77
81
  materialSource: record.materialSource ?? null,
@@ -1 +1 @@
1
- {"version":3,"file":"error-diagnostics.js","names":[],"sources":["../../src/lib/core/error-diagnostics.ts"],"sourcesContent":["import type { MaterialSourceLocation } from './material-preprocess.js';\n\n/**\n * Source metadata for material declaration callsite.\n */\nexport interface MaterialSourceMetadata {\n\tcomponent?: string;\n\tfile?: string;\n\tline?: number;\n\tcolumn?: number;\n\tfunctionName?: string;\n}\n\n/**\n * One WGSL compiler diagnostic enriched with source-location metadata.\n */\nexport interface ShaderCompilationDiagnostic {\n\tgeneratedLine: number;\n\tmessage: string;\n\tlinePos?: number;\n\tlineLength?: number;\n\tsourceLocation: MaterialSourceLocation | null;\n}\n\n/**\n * Runtime context snapshot captured for shader compilation diagnostics.\n */\nexport interface ShaderCompilationRuntimeContext {\n\tmaterialSignature?: string;\n\tpassGraph?: {\n\t\tpassCount: number;\n\t\tenabledPassCount: number;\n\t\tinputs: string[];\n\t\toutputs: string[];\n\t};\n\tactiveRenderTargets: string[];\n}\n\n/**\n * Structured payload attached to WGSL compilation errors.\n */\nexport interface ShaderCompilationDiagnosticsPayload {\n\tkind: 'shader-compilation';\n\tdiagnostics: ShaderCompilationDiagnostic[];\n\tfragmentSource: string;\n\tincludeSources: Record<string, string>;\n\tdefineBlockSource?: string;\n\tmaterialSource: MaterialSourceMetadata | null;\n\truntimeContext?: ShaderCompilationRuntimeContext;\n}\n\ntype MotionGPUErrorWithDiagnostics = Error & {\n\tmotiongpuDiagnostics?: unknown;\n};\n\nfunction isMaterialSourceMetadata(value: unknown): value is MaterialSourceMetadata {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (record.component !== undefined && typeof record.component !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.file !== undefined && typeof record.file !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.functionName !== undefined && typeof record.functionName !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.line !== undefined && typeof record.line !== 'number') {\n\t\treturn false;\n\t}\n\tif (record.column !== undefined && typeof record.column !== 'number') {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isMaterialSourceLocation(value: unknown): value is MaterialSourceLocation | null {\n\tif (value === null) {\n\t\treturn true;\n\t}\n\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tconst kind = record.kind;\n\tif (kind !== 'fragment' && kind !== 'include' && kind !== 'define') {\n\t\treturn false;\n\t}\n\n\treturn typeof record.line === 'number';\n}\n\nfunction isShaderCompilationDiagnostic(value: unknown): value is ShaderCompilationDiagnostic {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (typeof record.generatedLine !== 'number') {\n\t\treturn false;\n\t}\n\tif (typeof record.message !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.linePos !== undefined && typeof record.linePos !== 'number') {\n\t\treturn false;\n\t}\n\tif (record.lineLength !== undefined && typeof record.lineLength !== 'number') {\n\t\treturn false;\n\t}\n\tif (!isMaterialSourceLocation(record.sourceLocation)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n\treturn Array.isArray(value) && value.every((entry) => typeof entry === 'string');\n}\n\nfunction isShaderCompilationRuntimeContext(\n\tvalue: unknown\n): value is ShaderCompilationRuntimeContext {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (record.materialSignature !== undefined && typeof record.materialSignature !== 'string') {\n\t\treturn false;\n\t}\n\tif (!isStringArray(record.activeRenderTargets)) {\n\t\treturn false;\n\t}\n\tconst passGraph = record.passGraph;\n\tif (passGraph === undefined) {\n\t\treturn true;\n\t}\n\tif (passGraph === null || typeof passGraph !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst passGraphRecord = passGraph as Record<string, unknown>;\n\tif (typeof passGraphRecord.passCount !== 'number') {\n\t\treturn false;\n\t}\n\tif (typeof passGraphRecord.enabledPassCount !== 'number') {\n\t\treturn false;\n\t}\n\tif (!isStringArray(passGraphRecord.inputs) || !isStringArray(passGraphRecord.outputs)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Attaches structured diagnostics payload to an Error.\n */\nexport function attachShaderCompilationDiagnostics(\n\terror: Error,\n\tpayload: ShaderCompilationDiagnosticsPayload\n): Error {\n\t(error as MotionGPUErrorWithDiagnostics).motiongpuDiagnostics = payload;\n\treturn error;\n}\n\n/**\n * Extracts structured diagnostics payload from unknown error value.\n */\nexport function getShaderCompilationDiagnostics(\n\terror: unknown\n): ShaderCompilationDiagnosticsPayload | null {\n\tif (!(error instanceof Error)) {\n\t\treturn null;\n\t}\n\n\tconst payload = (error as MotionGPUErrorWithDiagnostics).motiongpuDiagnostics;\n\tif (payload === null || typeof payload !== 'object') {\n\t\treturn null;\n\t}\n\n\tconst record = payload as Record<string, unknown>;\n\tif (record.kind !== 'shader-compilation') {\n\t\treturn null;\n\t}\n\tif (\n\t\t!Array.isArray(record.diagnostics) ||\n\t\t!record.diagnostics.every(isShaderCompilationDiagnostic)\n\t) {\n\t\treturn null;\n\t}\n\tif (typeof record.fragmentSource !== 'string') {\n\t\treturn null;\n\t}\n\tif (record.defineBlockSource !== undefined && typeof record.defineBlockSource !== 'string') {\n\t\treturn null;\n\t}\n\tif (record.includeSources === null || typeof record.includeSources !== 'object') {\n\t\treturn null;\n\t}\n\tconst includeSources = record.includeSources as Record<string, unknown>;\n\tif (Object.values(includeSources).some((value) => typeof value !== 'string')) {\n\t\treturn null;\n\t}\n\tif (record.materialSource !== null && !isMaterialSourceMetadata(record.materialSource)) {\n\t\treturn null;\n\t}\n\tif (\n\t\trecord.runtimeContext !== undefined &&\n\t\t!isShaderCompilationRuntimeContext(record.runtimeContext)\n\t) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tkind: 'shader-compilation',\n\t\tdiagnostics: record.diagnostics as ShaderCompilationDiagnostic[],\n\t\tfragmentSource: record.fragmentSource,\n\t\tincludeSources: includeSources as Record<string, string>,\n\t\t...(record.defineBlockSource !== undefined\n\t\t\t? { defineBlockSource: record.defineBlockSource as string }\n\t\t\t: {}),\n\t\tmaterialSource: (record.materialSource ?? null) as MaterialSourceMetadata | null,\n\t\t...(record.runtimeContext !== undefined\n\t\t\t? { runtimeContext: record.runtimeContext as ShaderCompilationRuntimeContext }\n\t\t\t: {})\n\t};\n}\n"],"mappings":";AAuDA,SAAS,yBAAyB,OAAiD;AAClF,KAAI,UAAU,QAAQ,OAAO,UAAU,SACtC,QAAO;CAGR,MAAM,SAAS;AACf,KAAI,OAAO,cAAc,UAAa,OAAO,OAAO,cAAc,SACjE,QAAO;AAER,KAAI,OAAO,SAAS,UAAa,OAAO,OAAO,SAAS,SACvD,QAAO;AAER,KAAI,OAAO,iBAAiB,UAAa,OAAO,OAAO,iBAAiB,SACvE,QAAO;AAER,KAAI,OAAO,SAAS,UAAa,OAAO,OAAO,SAAS,SACvD,QAAO;AAER,KAAI,OAAO,WAAW,UAAa,OAAO,OAAO,WAAW,SAC3D,QAAO;AAGR,QAAO;;AAGR,SAAS,yBAAyB,OAAwD;AACzF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AAO;;;;;AAMR,SAAgB,gCACf,OAC6C;AAC7C,KAAI,EAAE,iBAAiB,OACtB,QAAO;CAGR,MAAM,UAAW,MAAwC;AACzD,KAAI,YAAY,QAAQ,OAAO,YAAY,SAC1C,QAAO;CAGR,MAAM,SAAS;AACf,KAAI,OAAO,SAAS,qBACnB,QAAO;AAER,KACC,CAAC,MAAM,QAAQ,OAAO,YAAY,IAClC,CAAC,OAAO,YAAY,MAAM,8BAA8B,CAExD,QAAO;AAER,KAAI,OAAO,OAAO,mBAAmB,SACpC,QAAO;AAER,KAAI,OAAO,sBAAsB,UAAa,OAAO,OAAO,sBAAsB,SACjF,QAAO;AAER,KAAI,OAAO,mBAAmB,QAAQ,OAAO,OAAO,mBAAmB,SACtE,QAAO;CAER,MAAM,iBAAiB,OAAO;AAC9B,KAAI,OAAO,OAAO,eAAe,CAAC,MAAM,UAAU,OAAO,UAAU,SAAS,CAC3E,QAAO;AAER,KAAI,OAAO,mBAAmB,QAAQ,CAAC,yBAAyB,OAAO,eAAe,CACrF,QAAO;AAER,KACC,OAAO,mBAAmB,UAC1B,CAAC,kCAAkC,OAAO,eAAe,CAEzD,QAAO;AAGR,QAAO;EACN,MAAM;EACN,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACP;EAChB,GAAI,OAAO,sBAAsB,SAC9B,EAAE,mBAAmB,OAAO,mBAA6B,GACzD,EAAE;EACL,gBAAiB,OAAO,kBAAkB;EAC1C,GAAI,OAAO,mBAAmB,SAC3B,EAAE,gBAAgB,OAAO,gBAAmD,GAC5E,EAAE;EACL"}
1
+ {"version":3,"file":"error-diagnostics.js","names":[],"sources":["../../src/lib/core/error-diagnostics.ts"],"sourcesContent":["import type { MaterialSourceLocation } from './material-preprocess.js';\n\n/**\n * Source metadata for material declaration callsite.\n */\nexport interface MaterialSourceMetadata {\n\tcomponent?: string;\n\tfile?: string;\n\tline?: number;\n\tcolumn?: number;\n\tfunctionName?: string;\n}\n\nexport interface ComputeSourceLocation {\n\tkind: 'compute';\n\tline: number;\n}\n\nexport type ShaderSourceLocation = MaterialSourceLocation | ComputeSourceLocation;\n\n/**\n * One WGSL compiler diagnostic enriched with source-location metadata.\n */\nexport interface ShaderCompilationDiagnostic {\n\tgeneratedLine: number;\n\tmessage: string;\n\tlinePos?: number;\n\tlineLength?: number;\n\tsourceLocation: ShaderSourceLocation | null;\n}\n\n/**\n * Runtime context snapshot captured for shader compilation diagnostics.\n */\nexport interface ShaderCompilationRuntimeContext {\n\tmaterialSignature?: string;\n\tpassGraph?: {\n\t\tpassCount: number;\n\t\tenabledPassCount: number;\n\t\tinputs: string[];\n\t\toutputs: string[];\n\t};\n\tactiveRenderTargets: string[];\n}\n\n/**\n * Structured payload attached to WGSL compilation errors.\n */\nexport interface ShaderCompilationDiagnosticsPayload {\n\tkind: 'shader-compilation';\n\tshaderStage?: 'fragment' | 'compute';\n\tdiagnostics: ShaderCompilationDiagnostic[];\n\tfragmentSource: string;\n\tcomputeSource?: string;\n\tincludeSources: Record<string, string>;\n\tdefineBlockSource?: string;\n\tmaterialSource: MaterialSourceMetadata | null;\n\truntimeContext?: ShaderCompilationRuntimeContext;\n}\n\ntype MotionGPUErrorWithDiagnostics = Error & {\n\tmotiongpuDiagnostics?: unknown;\n};\n\nfunction isMaterialSourceMetadata(value: unknown): value is MaterialSourceMetadata {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (record.component !== undefined && typeof record.component !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.file !== undefined && typeof record.file !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.functionName !== undefined && typeof record.functionName !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.line !== undefined && typeof record.line !== 'number') {\n\t\treturn false;\n\t}\n\tif (record.column !== undefined && typeof record.column !== 'number') {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isShaderSourceLocation(value: unknown): value is ShaderSourceLocation | null {\n\tif (value === null) {\n\t\treturn true;\n\t}\n\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tconst kind = record.kind;\n\tif (kind !== 'fragment' && kind !== 'include' && kind !== 'define' && kind !== 'compute') {\n\t\treturn false;\n\t}\n\n\treturn typeof record.line === 'number';\n}\n\nfunction isShaderCompilationDiagnostic(value: unknown): value is ShaderCompilationDiagnostic {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (typeof record.generatedLine !== 'number') {\n\t\treturn false;\n\t}\n\tif (typeof record.message !== 'string') {\n\t\treturn false;\n\t}\n\tif (record.linePos !== undefined && typeof record.linePos !== 'number') {\n\t\treturn false;\n\t}\n\tif (record.lineLength !== undefined && typeof record.lineLength !== 'number') {\n\t\treturn false;\n\t}\n\tif (!isShaderSourceLocation(record.sourceLocation)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n\treturn Array.isArray(value) && value.every((entry) => typeof entry === 'string');\n}\n\nfunction isShaderCompilationRuntimeContext(\n\tvalue: unknown\n): value is ShaderCompilationRuntimeContext {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst record = value as Record<string, unknown>;\n\tif (record.materialSignature !== undefined && typeof record.materialSignature !== 'string') {\n\t\treturn false;\n\t}\n\tif (!isStringArray(record.activeRenderTargets)) {\n\t\treturn false;\n\t}\n\tconst passGraph = record.passGraph;\n\tif (passGraph === undefined) {\n\t\treturn true;\n\t}\n\tif (passGraph === null || typeof passGraph !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst passGraphRecord = passGraph as Record<string, unknown>;\n\tif (typeof passGraphRecord.passCount !== 'number') {\n\t\treturn false;\n\t}\n\tif (typeof passGraphRecord.enabledPassCount !== 'number') {\n\t\treturn false;\n\t}\n\tif (!isStringArray(passGraphRecord.inputs) || !isStringArray(passGraphRecord.outputs)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Attaches structured diagnostics payload to an Error.\n */\nexport function attachShaderCompilationDiagnostics(\n\terror: Error,\n\tpayload: ShaderCompilationDiagnosticsPayload\n): Error {\n\t(error as MotionGPUErrorWithDiagnostics).motiongpuDiagnostics = payload;\n\treturn error;\n}\n\n/**\n * Extracts structured diagnostics payload from unknown error value.\n */\nexport function getShaderCompilationDiagnostics(\n\terror: unknown\n): ShaderCompilationDiagnosticsPayload | null {\n\tif (!(error instanceof Error)) {\n\t\treturn null;\n\t}\n\n\tconst payload = (error as MotionGPUErrorWithDiagnostics).motiongpuDiagnostics;\n\tif (payload === null || typeof payload !== 'object') {\n\t\treturn null;\n\t}\n\n\tconst record = payload as Record<string, unknown>;\n\tif (record.kind !== 'shader-compilation') {\n\t\treturn null;\n\t}\n\tif (\n\t\trecord.shaderStage !== undefined &&\n\t\trecord.shaderStage !== 'fragment' &&\n\t\trecord.shaderStage !== 'compute'\n\t) {\n\t\treturn null;\n\t}\n\tif (\n\t\t!Array.isArray(record.diagnostics) ||\n\t\t!record.diagnostics.every(isShaderCompilationDiagnostic)\n\t) {\n\t\treturn null;\n\t}\n\tif (typeof record.fragmentSource !== 'string') {\n\t\treturn null;\n\t}\n\tif (record.computeSource !== undefined && typeof record.computeSource !== 'string') {\n\t\treturn null;\n\t}\n\tif (record.defineBlockSource !== undefined && typeof record.defineBlockSource !== 'string') {\n\t\treturn null;\n\t}\n\tif (record.includeSources === null || typeof record.includeSources !== 'object') {\n\t\treturn null;\n\t}\n\tconst includeSources = record.includeSources as Record<string, unknown>;\n\tif (Object.values(includeSources).some((value) => typeof value !== 'string')) {\n\t\treturn null;\n\t}\n\tif (record.materialSource !== null && !isMaterialSourceMetadata(record.materialSource)) {\n\t\treturn null;\n\t}\n\tif (\n\t\trecord.runtimeContext !== undefined &&\n\t\t!isShaderCompilationRuntimeContext(record.runtimeContext)\n\t) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tkind: 'shader-compilation',\n\t\t...(record.shaderStage !== undefined\n\t\t\t? { shaderStage: record.shaderStage as 'fragment' | 'compute' }\n\t\t\t: {}),\n\t\tdiagnostics: record.diagnostics as ShaderCompilationDiagnostic[],\n\t\tfragmentSource: record.fragmentSource,\n\t\t...(record.computeSource !== undefined\n\t\t\t? { computeSource: record.computeSource as string }\n\t\t\t: {}),\n\t\tincludeSources: includeSources as Record<string, string>,\n\t\t...(record.defineBlockSource !== undefined\n\t\t\t? { defineBlockSource: record.defineBlockSource as string }\n\t\t\t: {}),\n\t\tmaterialSource: (record.materialSource ?? null) as MaterialSourceMetadata | null,\n\t\t...(record.runtimeContext !== undefined\n\t\t\t? { runtimeContext: record.runtimeContext as ShaderCompilationRuntimeContext }\n\t\t\t: {})\n\t};\n}\n"],"mappings":";AAgEA,SAAS,yBAAyB,OAAiD;AAClF,KAAI,UAAU,QAAQ,OAAO,UAAU,SACtC,QAAO;CAGR,MAAM,SAAS;AACf,KAAI,OAAO,cAAc,UAAa,OAAO,OAAO,cAAc,SACjE,QAAO;AAER,KAAI,OAAO,SAAS,UAAa,OAAO,OAAO,SAAS,SACvD,QAAO;AAER,KAAI,OAAO,iBAAiB,UAAa,OAAO,OAAO,iBAAiB,SACvE,QAAO;AAER,KAAI,OAAO,SAAS,UAAa,OAAO,OAAO,SAAS,SACvD,QAAO;AAER,KAAI,OAAO,WAAW,UAAa,OAAO,OAAO,WAAW,SAC3D,QAAO;AAGR,QAAO;;AAGR,SAAS,uBAAuB,OAAsD;AACrF,KAAI,UAAU,KACb,QAAO;AAGR,KAAI,OAAO,UAAU,SACpB,QAAO;CAGR,MAAM,SAAS;CACf,MAAM,OAAO,OAAO;AACpB,KAAI,SAAS,cAAc,SAAS,aAAa,SAAS,YAAY,SAAS,UAC9E,QAAO;AAGR,QAAO,OAAO,OAAO,SAAS;;AAG/B,SAAS,8BAA8B,OAAsD;AAC5F,KAAI,UAAU,QAAQ,OAAO,UAAU,SACtC,QAAO;CAGR,MAAM,SAAS;AACf,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KACC,CAAC,MAAM,QAAQ,OAAO,YAAY,IAClC,CAAC,OAAO,YAAY,MAAM,8BAA8B,CAExD,QAAO;AAER,KAAI,OAAO,OAAO,mBAAmB,SACpC,QAAO;AAER,KAAI,OAAO,kBAAkB,UAAa,OAAO,OAAO,kBAAkB,SACzE,QAAO;AAER,KAAI,OAAO,sBAAsB,UAAa,OAAO,OAAO,sBAAsB,SACjF,QAAO;AAER,KAAI,OAAO,mBAAmB,QAAQ,OAAO,OAAO,mBAAmB,SACtE,QAAO;CAER,MAAM,iBAAiB,OAAO;AAC9B,KAAI,OAAO,OAAO,eAAe,CAAC,MAAM,UAAU,OAAO,UAAU,SAAS,CAC3E,QAAO;AAER,KAAI,OAAO,mBAAmB,QAAQ,CAAC,yBAAyB,OAAO,eAAe,CACrF,QAAO;AAER,KACC,OAAO,mBAAmB,UAC1B,CAAC,kCAAkC,OAAO,eAAe,CAEzD,QAAO;AAGR,QAAO;EACN,MAAM;EACN,GAAI,OAAO,gBAAgB,SACxB,EAAE,aAAa,OAAO,aAAuC,GAC7D,EAAE;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,GAAI,OAAO,kBAAkB,SAC1B,EAAE,eAAe,OAAO,eAAyB,GACjD,EAAE;EACW;EAChB,GAAI,OAAO,sBAAsB,SAC9B,EAAE,mBAAmB,OAAO,mBAA6B,GACzD,EAAE;EACL,gBAAiB,OAAO,kBAAkB;EAC1C,GAAI,OAAO,mBAAmB,SAC3B,EAAE,gBAAgB,OAAO,gBAAmD,GAC5E,EAAE;EACL"}
@@ -5,7 +5,7 @@ export type MotionGPUErrorPhase = 'initialization' | 'render';
5
5
  /**
6
6
  * Stable machine-readable error category code.
7
7
  */
8
- export type MotionGPUErrorCode = 'WEBGPU_UNAVAILABLE' | 'WEBGPU_ADAPTER_UNAVAILABLE' | 'WEBGPU_CONTEXT_UNAVAILABLE' | 'WGSL_COMPILATION_FAILED' | 'WEBGPU_DEVICE_LOST' | 'WEBGPU_UNCAPTURED_ERROR' | 'BIND_GROUP_MISMATCH' | 'TEXTURE_USAGE_INVALID' | 'TEXTURE_REQUEST_FAILED' | 'TEXTURE_DECODE_UNAVAILABLE' | 'TEXTURE_REQUEST_ABORTED' | 'MOTIONGPU_RUNTIME_ERROR';
8
+ export type MotionGPUErrorCode = 'WEBGPU_UNAVAILABLE' | 'WEBGPU_ADAPTER_UNAVAILABLE' | 'WEBGPU_CONTEXT_UNAVAILABLE' | 'WGSL_COMPILATION_FAILED' | 'MATERIAL_PREPROCESS_FAILED' | 'WEBGPU_DEVICE_LOST' | 'WEBGPU_UNCAPTURED_ERROR' | 'BIND_GROUP_MISMATCH' | 'RUNTIME_RESOURCE_MISSING' | 'UNIFORM_VALUE_INVALID' | 'STORAGE_BUFFER_OUT_OF_BOUNDS' | 'STORAGE_BUFFER_READ_FAILED' | 'RENDER_GRAPH_INVALID' | 'PINGPONG_CONFIGURATION_INVALID' | 'TEXTURE_USAGE_INVALID' | 'TEXTURE_REQUEST_FAILED' | 'TEXTURE_DECODE_UNAVAILABLE' | 'TEXTURE_REQUEST_ABORTED' | 'COMPUTE_COMPILATION_FAILED' | 'COMPUTE_CONTRACT_INVALID' | 'MOTIONGPU_RUNTIME_ERROR';
9
9
  /**
10
10
  * Severity level for user-facing diagnostics.
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"error-report.d.ts","sourceRoot":"","sources":["../../src/lib/core/error-report.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,oBAAoB,GACpB,4BAA4B,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,oBAAoB,GACpB,yBAAyB,GACzB,qBAAqB,GACrB,uBAAuB,GACvB,wBAAwB,GACxB,4BAA4B,GAC5B,yBAAyB,GACzB,yBAAyB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAA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GAAG,IAAI,CAAC;CACtC;AA4OD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,mBAAmB,GACxB,oBAAoB,CAwCtB"}
1
+ {"version":3,"file":"error-report.d.ts","sourceRoot":"","sources":["../../src/lib/core/error-report.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,oBAAoB,GACpB,4BAA4B,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,oBAAoB,GACpB,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,uBAAuB,GACvB,8BAA8B,GAC9B,4BAA4B,GAC5B,sBAAsB,GACtB,gCAAgC,GAChC,uBAAuB,GACvB,wBAAwB,GACxB,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,0BAA0B,GAC1B,yBAAyB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,OAAO,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,sBAAsB,CAAC;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpC;;OAEG;IACH,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACtC;AAiXD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,mBAAmB,GACxB,oBAAoB,CAoDtB"}
@@ -55,6 +55,17 @@ function buildSourceFromDiagnostics(error) {
55
55
  snippet: toSnippet(includeSource, location.line)
56
56
  };
57
57
  }
58
+ if (location.kind === "compute") {
59
+ const computeSource = diagnostics.computeSource ?? diagnostics.fragmentSource;
60
+ const component = "Compute shader";
61
+ return {
62
+ component,
63
+ location: `${component} (${formatShaderSourceLocation(location) ?? `compute line ${location.line}`})`,
64
+ line: location.line,
65
+ ...column !== void 0 ? { column } : {},
66
+ snippet: toSnippet(computeSource, location.line)
67
+ };
68
+ }
58
69
  const defineName = location.define ?? "unknown";
59
70
  const defineLine = Math.max(1, location.line);
60
71
  const component = `#define ${defineName}`;
@@ -103,6 +114,27 @@ function classifyErrorMessage(message) {
103
114
  title: "WGSL compilation failed",
104
115
  hint: "Check WGSL line numbers below and verify struct/binding/function signatures."
105
116
  };
117
+ if (message.includes("Invalid include directive in fragment shader.") || message.includes("Unknown include \"") || message.includes("Circular include detected for \"") || message.includes("Invalid define value for \"") || message.includes("Invalid include \"")) return {
118
+ code: "MATERIAL_PREPROCESS_FAILED",
119
+ severity: "error",
120
+ recoverable: true,
121
+ title: "Material preprocess failed",
122
+ hint: "Validate #include keys, define values and include expansion order before retrying."
123
+ };
124
+ if (message.includes("Compute shader compilation failed")) return {
125
+ code: "COMPUTE_COMPILATION_FAILED",
126
+ severity: "error",
127
+ recoverable: true,
128
+ title: "Compute shader compilation failed",
129
+ hint: "Check WGSL compute shader sources below and verify storage bindings."
130
+ };
131
+ if (message.includes("Compute shader must declare `@compute @workgroup_size(...) fn compute(...)`.") || message.includes("Compute shader must include a `@builtin(global_invocation_id)` parameter.") || message.includes("Could not extract @workgroup_size from compute shader source.") || message.includes("@workgroup_size dimensions must be integers in range") || message.includes("Unsupported storage buffer access mode \"")) return {
132
+ code: "COMPUTE_CONTRACT_INVALID",
133
+ severity: "error",
134
+ recoverable: true,
135
+ title: "Compute contract is invalid",
136
+ hint: "Ensure compute shader contract (@compute, @workgroup_size, global_invocation_id, storage access) is valid."
137
+ };
106
138
  if (message.includes("WebGPU device lost") || message.includes("Device Lost")) return {
107
139
  code: "WEBGPU_DEVICE_LOST",
108
140
  severity: "fatal",
@@ -124,6 +156,48 @@ function classifyErrorMessage(message) {
124
156
  title: "Bind group mismatch",
125
157
  hint: "Bindings in shader and runtime resources are out of sync. Verify uniforms/textures layout."
126
158
  };
159
+ if (message.includes("Storage buffer \"") && message.includes("write out of bounds:")) return {
160
+ code: "STORAGE_BUFFER_OUT_OF_BOUNDS",
161
+ severity: "error",
162
+ recoverable: true,
163
+ title: "Storage buffer write out of bounds",
164
+ hint: "Ensure offset + write byte length does not exceed declared storage buffer size."
165
+ };
166
+ if (message.includes("Cannot read storage buffer \"") || message.includes("Cannot read storage buffer: GPU device unavailable.") || message.includes("not allocated on GPU.")) return {
167
+ code: "STORAGE_BUFFER_READ_FAILED",
168
+ severity: "error",
169
+ recoverable: true,
170
+ title: "Storage buffer read failed",
171
+ hint: "Readbacks require an initialized renderer, allocated GPU buffer and active device."
172
+ };
173
+ if (message.includes("Unknown uniform \"") || message.includes("Unknown uniform type for \"") || message.includes("Unknown texture \"") || message.includes("Unknown storage buffer \"") || message.includes("Missing definition for storage buffer \"") || message.includes("Missing texture definition for \"") || message.includes("Storage buffer \"") && message.includes("\" not allocated.") || message.includes("Storage texture \"") && message.includes("\" not allocated.")) return {
174
+ code: "RUNTIME_RESOURCE_MISSING",
175
+ severity: "error",
176
+ recoverable: true,
177
+ title: "Runtime resource binding failed",
178
+ hint: "Check material declarations and runtime keys for uniforms, textures and storage resources."
179
+ };
180
+ if (message.includes("Uniform ") && message.includes(" value must")) return {
181
+ code: "UNIFORM_VALUE_INVALID",
182
+ severity: "error",
183
+ recoverable: true,
184
+ title: "Uniform value is invalid",
185
+ hint: "Provide finite values with tuple/matrix sizes matching the uniform type."
186
+ };
187
+ if (message.includes("Render pass #") || message.includes("Render graph references unknown runtime target")) return {
188
+ code: "RENDER_GRAPH_INVALID",
189
+ severity: "error",
190
+ recoverable: true,
191
+ title: "Render graph configuration is invalid",
192
+ hint: "Verify pass inputs/outputs, declared render targets and execution order."
193
+ };
194
+ if (message.includes("PingPongComputePass must provide a target texture key.")) return {
195
+ code: "PINGPONG_CONFIGURATION_INVALID",
196
+ severity: "error",
197
+ recoverable: true,
198
+ title: "Ping-pong compute pass is misconfigured",
199
+ hint: "Configure a valid target texture key for PingPongComputePass."
200
+ };
127
201
  if (message.includes("Destination texture needs to have CopyDst")) return {
128
202
  code: "TEXTURE_USAGE_INVALID",
129
203
  severity: "error",
@@ -178,7 +252,14 @@ function toMotionGPUErrorReport(error, phase) {
178
252
  const message = shaderDiagnostics && shaderDiagnostics.diagnostics[0] ? formatDiagnosticMessage(shaderDiagnostics.diagnostics[0]) : defaultMessage;
179
253
  const details = shaderDiagnostics ? shaderDiagnostics.diagnostics.slice(1).map((entry) => formatDiagnosticMessage(entry)) : defaultDetails;
180
254
  const stack = error instanceof Error && error.stack ? splitLines(error.stack).filter((line) => line !== message) : [];
181
- const classification = classifyErrorMessage(rawMessage);
255
+ let classification = classifyErrorMessage(rawMessage);
256
+ if (shaderDiagnostics?.shaderStage === "compute" && classification.code === "WGSL_COMPILATION_FAILED") classification = {
257
+ code: "COMPUTE_COMPILATION_FAILED",
258
+ severity: "error",
259
+ recoverable: true,
260
+ title: "Compute shader compilation failed",
261
+ hint: "Check WGSL compute shader sources below and verify storage bindings."
262
+ };
182
263
  return {
183
264
  code: classification.code,
184
265
  severity: classification.severity,
@@ -1 +1 @@
1
- {"version":3,"file":"error-report.js","names":[],"sources":["../../src/lib/core/error-report.ts"],"sourcesContent":["import {\n\tgetShaderCompilationDiagnostics,\n\ttype ShaderCompilationDiagnostic\n} from './error-diagnostics.js';\nimport { formatShaderSourceLocation } from './shader.js';\n\n/**\n * Runtime phase in which an error occurred.\n */\nexport type MotionGPUErrorPhase = 'initialization' | 'render';\n\n/**\n * Stable machine-readable error category code.\n */\nexport type MotionGPUErrorCode =\n\t| 'WEBGPU_UNAVAILABLE'\n\t| 'WEBGPU_ADAPTER_UNAVAILABLE'\n\t| 'WEBGPU_CONTEXT_UNAVAILABLE'\n\t| 'WGSL_COMPILATION_FAILED'\n\t| 'WEBGPU_DEVICE_LOST'\n\t| 'WEBGPU_UNCAPTURED_ERROR'\n\t| 'BIND_GROUP_MISMATCH'\n\t| 'TEXTURE_USAGE_INVALID'\n\t| 'TEXTURE_REQUEST_FAILED'\n\t| 'TEXTURE_DECODE_UNAVAILABLE'\n\t| 'TEXTURE_REQUEST_ABORTED'\n\t| 'MOTIONGPU_RUNTIME_ERROR';\n\n/**\n * Severity level for user-facing diagnostics.\n */\nexport type MotionGPUErrorSeverity = 'error' | 'fatal';\n\n/**\n * One source-code line displayed in diagnostics snippet.\n */\nexport interface MotionGPUErrorSourceLine {\n\tnumber: number;\n\tcode: string;\n\thighlight: boolean;\n}\n\n/**\n * Structured source context displayed for shader compilation errors.\n */\nexport interface MotionGPUErrorSource {\n\tcomponent: string;\n\tlocation: string;\n\tline: number;\n\tcolumn?: number;\n\tsnippet: MotionGPUErrorSourceLine[];\n}\n\n/**\n * Optional runtime context captured with diagnostics payload.\n */\nexport interface MotionGPUErrorContext {\n\tmaterialSignature?: string;\n\tpassGraph?: {\n\t\tpassCount: number;\n\t\tenabledPassCount: number;\n\t\tinputs: string[];\n\t\toutputs: string[];\n\t};\n\tactiveRenderTargets: string[];\n}\n\n/**\n * Structured error payload used by UI diagnostics.\n */\nexport interface MotionGPUErrorReport {\n\t/**\n\t * Stable machine-readable category code.\n\t */\n\tcode: MotionGPUErrorCode;\n\t/**\n\t * Severity level used by diagnostics UIs and telemetry.\n\t */\n\tseverity: MotionGPUErrorSeverity;\n\t/**\n\t * Whether runtime may recover without full renderer re-creation.\n\t */\n\trecoverable: boolean;\n\t/**\n\t * Short category title.\n\t */\n\ttitle: string;\n\t/**\n\t * Primary human-readable message.\n\t */\n\tmessage: string;\n\t/**\n\t * Suggested remediation hint.\n\t */\n\thint: string;\n\t/**\n\t * Additional parsed details (for example WGSL line errors).\n\t */\n\tdetails: string[];\n\t/**\n\t * Stack trace lines when available.\n\t */\n\tstack: string[];\n\t/**\n\t * Original unmodified message.\n\t */\n\trawMessage: string;\n\t/**\n\t * Runtime phase where the error occurred.\n\t */\n\tphase: MotionGPUErrorPhase;\n\t/**\n\t * Optional source context for shader-related diagnostics.\n\t */\n\tsource: MotionGPUErrorSource | null;\n\t/**\n\t * Optional runtime context snapshot (material/pass graph/render targets).\n\t */\n\tcontext: MotionGPUErrorContext | null;\n}\n\n/**\n * Splits multi-line values into trimmed non-empty lines.\n */\nfunction splitLines(value: string): string[] {\n\treturn value\n\t\t.split('\\n')\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0);\n}\n\nfunction toDisplayName(path: string): string {\n\tconst normalized = path.split(/[?#]/)[0] ?? path;\n\tconst chunks = normalized.split(/[\\\\/]/);\n\tconst last = chunks[chunks.length - 1];\n\treturn last && last.length > 0 ? last : path;\n}\n\nfunction toSnippet(source: string, line: number, radius = 3): MotionGPUErrorSourceLine[] {\n\tconst lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n\tif (lines.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst targetLine = Math.min(Math.max(1, line), lines.length);\n\tconst start = Math.max(1, targetLine - radius);\n\tconst end = Math.min(lines.length, targetLine + radius);\n\tconst snippet: MotionGPUErrorSourceLine[] = [];\n\n\tfor (let index = start; index <= end; index += 1) {\n\t\tsnippet.push({\n\t\t\tnumber: index,\n\t\t\tcode: lines[index - 1] ?? '',\n\t\t\thighlight: index === targetLine\n\t\t});\n\t}\n\n\treturn snippet;\n}\n\nfunction buildSourceFromDiagnostics(error: unknown): MotionGPUErrorSource | null {\n\tconst diagnostics = getShaderCompilationDiagnostics(error);\n\tif (!diagnostics || diagnostics.diagnostics.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst primary = diagnostics.diagnostics.find((entry) => entry.sourceLocation !== null);\n\tif (!primary?.sourceLocation) {\n\t\treturn null;\n\t}\n\n\tconst location = primary.sourceLocation;\n\tconst column = primary.linePos && primary.linePos > 0 ? primary.linePos : undefined;\n\n\tif (location.kind === 'fragment') {\n\t\tconst component =\n\t\t\tdiagnostics.materialSource?.component ??\n\t\t\t(diagnostics.materialSource?.file\n\t\t\t\t? toDisplayName(diagnostics.materialSource.file)\n\t\t\t\t: 'User shader fragment');\n\t\tconst locationLabel = formatShaderSourceLocation(location) ?? `fragment line ${location.line}`;\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tlocation: `${component} (${locationLabel})`,\n\t\t\tline: location.line,\n\t\t\t...(column !== undefined ? { column } : {}),\n\t\t\tsnippet: toSnippet(diagnostics.fragmentSource, location.line)\n\t\t};\n\t}\n\n\tif (location.kind === 'include') {\n\t\tconst includeName = location.include ?? 'unknown';\n\t\tconst includeSource = diagnostics.includeSources[includeName] ?? '';\n\t\tconst component = `#include <${includeName}>`;\n\t\tconst locationLabel = formatShaderSourceLocation(location) ?? `include <${includeName}>`;\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tlocation: `${component} (${locationLabel})`,\n\t\t\tline: location.line,\n\t\t\t...(column !== undefined ? { column } : {}),\n\t\t\tsnippet: toSnippet(includeSource, location.line)\n\t\t};\n\t}\n\n\tconst defineName = location.define ?? 'unknown';\n\tconst defineLine = Math.max(1, location.line);\n\tconst component = `#define ${defineName}`;\n\tconst locationLabel =\n\t\tformatShaderSourceLocation(location) ?? `define \"${defineName}\" line ${defineLine}`;\n\treturn {\n\t\tcomponent,\n\t\tlocation: `${component} (${locationLabel})`,\n\t\tline: defineLine,\n\t\t...(column !== undefined ? { column } : {}),\n\t\tsnippet: toSnippet(diagnostics.defineBlockSource ?? '', defineLine, 2)\n\t};\n}\n\nfunction formatDiagnosticMessage(entry: ShaderCompilationDiagnostic): string {\n\tconst sourceLabel = formatShaderSourceLocation(entry.sourceLocation);\n\tconst generatedLineLabel =\n\t\tentry.generatedLine > 0 ? `generated WGSL line ${entry.generatedLine}` : null;\n\tconst labels = [sourceLabel, generatedLineLabel].filter((value) => Boolean(value));\n\tif (labels.length === 0) {\n\t\treturn entry.message;\n\t}\n\n\treturn `[${labels.join(' | ')}] ${entry.message}`;\n}\n\n/**\n * Maps known WebGPU/WGSL error patterns to a user-facing title and hint.\n */\nfunction classifyErrorMessage(\n\tmessage: string\n): Pick<MotionGPUErrorReport, 'code' | 'severity' | 'recoverable' | 'title' | 'hint'> {\n\tif (message.includes('WebGPU is not available in this browser')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU unavailable',\n\t\t\thint: 'Use a browser with WebGPU enabled (latest Chrome/Edge/Safari TP) and secure context.'\n\t\t};\n\t}\n\n\tif (message.includes('Unable to acquire WebGPU adapter')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_ADAPTER_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU adapter unavailable',\n\t\t\thint: 'GPU adapter request failed. Check browser permissions, flags and device support.'\n\t\t};\n\t}\n\n\tif (message.includes('Canvas does not support webgpu context')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_CONTEXT_UNAVAILABLE',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Canvas cannot create WebGPU context',\n\t\t\thint: 'Make sure this canvas is attached to DOM and not using an unsupported context option.'\n\t\t};\n\t}\n\n\tif (message.includes('WGSL compilation failed')) {\n\t\treturn {\n\t\t\tcode: 'WGSL_COMPILATION_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'WGSL compilation failed',\n\t\t\thint: 'Check WGSL line numbers below and verify struct/binding/function signatures.'\n\t\t};\n\t}\n\n\tif (message.includes('WebGPU device lost') || message.includes('Device Lost')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_DEVICE_LOST',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU device lost',\n\t\t\thint: 'GPU device/context was lost. Recreate the renderer and check OS/GPU stability.'\n\t\t};\n\t}\n\n\tif (message.includes('WebGPU uncaptured error')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_UNCAPTURED_ERROR',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'WebGPU uncaptured error',\n\t\t\thint: 'A GPU command failed asynchronously. Review details and validate resource/state usage.'\n\t\t};\n\t}\n\n\tif (message.includes('CreateBindGroup') || message.includes('bind group layout')) {\n\t\treturn {\n\t\t\tcode: 'BIND_GROUP_MISMATCH',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Bind group mismatch',\n\t\t\thint: 'Bindings in shader and runtime resources are out of sync. Verify uniforms/textures layout.'\n\t\t};\n\t}\n\n\tif (message.includes('Destination texture needs to have CopyDst')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_USAGE_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Invalid texture usage flags',\n\t\t\thint: 'Texture used as upload destination must include CopyDst (and often RenderAttachment).'\n\t\t};\n\t}\n\n\tif (message.includes('Texture request failed')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_REQUEST_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Texture request failed',\n\t\t\thint: 'Verify texture URL, CORS policy and response status before retrying.'\n\t\t};\n\t}\n\n\tif (message.includes('createImageBitmap is not available in this runtime')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_DECODE_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'Texture decode unavailable',\n\t\t\thint: 'Runtime lacks createImageBitmap support. Use a browser/runtime with image bitmap decoding.'\n\t\t};\n\t}\n\n\tif (message.toLowerCase().includes('texture request was aborted')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_REQUEST_ABORTED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Texture request aborted',\n\t\t\thint: 'Texture load was cancelled. Retry the request when source inputs stabilize.'\n\t\t};\n\t}\n\n\treturn {\n\t\tcode: 'MOTIONGPU_RUNTIME_ERROR',\n\t\tseverity: 'error',\n\t\trecoverable: true,\n\t\ttitle: 'MotionGPU render error',\n\t\thint: 'Review technical details below. If issue persists, isolate shader/uniform/texture changes.'\n\t};\n}\n\n/**\n * Converts unknown errors to a consistent, display-ready error report.\n *\n * @param error - Unknown thrown value.\n * @param phase - Phase during which error occurred.\n * @returns Normalized error report.\n */\nexport function toMotionGPUErrorReport(\n\terror: unknown,\n\tphase: MotionGPUErrorPhase\n): MotionGPUErrorReport {\n\tconst shaderDiagnostics = getShaderCompilationDiagnostics(error);\n\tconst rawMessage =\n\t\terror instanceof Error\n\t\t\t? error.message\n\t\t\t: typeof error === 'string'\n\t\t\t\t? error\n\t\t\t\t: 'Unknown FragCanvas error';\n\tconst rawLines = splitLines(rawMessage);\n\tconst defaultMessage = rawLines[0] ?? rawMessage;\n\tconst defaultDetails = rawLines.slice(1);\n\tconst source = buildSourceFromDiagnostics(error);\n\tconst context = shaderDiagnostics?.runtimeContext ?? null;\n\tconst message =\n\t\tshaderDiagnostics && shaderDiagnostics.diagnostics[0]\n\t\t\t? formatDiagnosticMessage(shaderDiagnostics.diagnostics[0])\n\t\t\t: defaultMessage;\n\tconst details = shaderDiagnostics\n\t\t? shaderDiagnostics.diagnostics.slice(1).map((entry) => formatDiagnosticMessage(entry))\n\t\t: defaultDetails;\n\tconst stack =\n\t\terror instanceof Error && error.stack\n\t\t\t? splitLines(error.stack).filter((line) => line !== message)\n\t\t\t: [];\n\tconst classification = classifyErrorMessage(rawMessage);\n\n\treturn {\n\t\tcode: classification.code,\n\t\tseverity: classification.severity,\n\t\trecoverable: classification.recoverable,\n\t\ttitle: classification.title,\n\t\tmessage,\n\t\thint: classification.hint,\n\t\tdetails,\n\t\tstack,\n\t\trawMessage,\n\t\tphase,\n\t\tsource,\n\t\tcontext\n\t};\n}\n"],"mappings":";;;;;;AA4HA,SAAS,WAAW,OAAyB;AAC5C,QAAO,MACL,MAAM,KAAK,CACX,KAAK,SAAS,KAAK,MAAM,CAAC,CAC1B,QAAQ,SAAS,KAAK,SAAS,EAAE;;AAGpC,SAAS,cAAc,MAAsB;CAE5C,MAAM,UADa,KAAK,MAAM,OAAO,CAAC,MAAM,MAClB,MAAM,QAAQ;CACxC,MAAM,OAAO,OAAO,OAAO,SAAS;AACpC,QAAO,QAAQ,KAAK,SAAS,IA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AkB;CACrD,MAAM,UACL,qBAAqB,kBAAkB,YAAY,KAChD,wBAAwB,kBAAkB,YAAY,GAAG,GACzD;CACJ,MAAM,UAAU,oBACb,kBAAkB,YAAY,MAAM,EAAE,CAAC,KAAK,UAAU,wBAAwB,MAAM,CAAC,GACrF;CACH,MAAM,QACL,iBAAiB,SAAS,MAAM,QAC7B,WAAW,MAAM,MAAM,CAAC,QAAQ,SAAS,SAAS,QAAQ,GAC1D,EAAE;CACN,MAAM,iBAAiB,qBAAqB,WAAW;AAEvD,QAAO;EACN,MAAM,eAAe;EACrB,UAAU,eAAe;EACzB,aAAa,eAAe;EAC5B,OAAO,eAAe;EACtB;EACA,MAAM,eAAe;EACrB;EACA;EACA;EACA;EACA;EACA;EACA"}
1
+ {"version":3,"file":"error-report.js","names":[],"sources":["../../src/lib/core/error-report.ts"],"sourcesContent":["import {\n\tgetShaderCompilationDiagnostics,\n\ttype ShaderCompilationDiagnostic\n} from './error-diagnostics.js';\nimport { formatShaderSourceLocation } from './shader.js';\n\n/**\n * Runtime phase in which an error occurred.\n */\nexport type MotionGPUErrorPhase = 'initialization' | 'render';\n\n/**\n * Stable machine-readable error category code.\n */\nexport type MotionGPUErrorCode =\n\t| 'WEBGPU_UNAVAILABLE'\n\t| 'WEBGPU_ADAPTER_UNAVAILABLE'\n\t| 'WEBGPU_CONTEXT_UNAVAILABLE'\n\t| 'WGSL_COMPILATION_FAILED'\n\t| 'MATERIAL_PREPROCESS_FAILED'\n\t| 'WEBGPU_DEVICE_LOST'\n\t| 'WEBGPU_UNCAPTURED_ERROR'\n\t| 'BIND_GROUP_MISMATCH'\n\t| 'RUNTIME_RESOURCE_MISSING'\n\t| 'UNIFORM_VALUE_INVALID'\n\t| 'STORAGE_BUFFER_OUT_OF_BOUNDS'\n\t| 'STORAGE_BUFFER_READ_FAILED'\n\t| 'RENDER_GRAPH_INVALID'\n\t| 'PINGPONG_CONFIGURATION_INVALID'\n\t| 'TEXTURE_USAGE_INVALID'\n\t| 'TEXTURE_REQUEST_FAILED'\n\t| 'TEXTURE_DECODE_UNAVAILABLE'\n\t| 'TEXTURE_REQUEST_ABORTED'\n\t| 'COMPUTE_COMPILATION_FAILED'\n\t| 'COMPUTE_CONTRACT_INVALID'\n\t| 'MOTIONGPU_RUNTIME_ERROR';\n\n/**\n * Severity level for user-facing diagnostics.\n */\nexport type MotionGPUErrorSeverity = 'error' | 'fatal';\n\n/**\n * One source-code line displayed in diagnostics snippet.\n */\nexport interface MotionGPUErrorSourceLine {\n\tnumber: number;\n\tcode: string;\n\thighlight: boolean;\n}\n\n/**\n * Structured source context displayed for shader compilation errors.\n */\nexport interface MotionGPUErrorSource {\n\tcomponent: string;\n\tlocation: string;\n\tline: number;\n\tcolumn?: number;\n\tsnippet: MotionGPUErrorSourceLine[];\n}\n\n/**\n * Optional runtime context captured with diagnostics payload.\n */\nexport interface MotionGPUErrorContext {\n\tmaterialSignature?: string;\n\tpassGraph?: {\n\t\tpassCount: number;\n\t\tenabledPassCount: number;\n\t\tinputs: string[];\n\t\toutputs: string[];\n\t};\n\tactiveRenderTargets: string[];\n}\n\n/**\n * Structured error payload used by UI diagnostics.\n */\nexport interface MotionGPUErrorReport {\n\t/**\n\t * Stable machine-readable category code.\n\t */\n\tcode: MotionGPUErrorCode;\n\t/**\n\t * Severity level used by diagnostics UIs and telemetry.\n\t */\n\tseverity: MotionGPUErrorSeverity;\n\t/**\n\t * Whether runtime may recover without full renderer re-creation.\n\t */\n\trecoverable: boolean;\n\t/**\n\t * Short category title.\n\t */\n\ttitle: string;\n\t/**\n\t * Primary human-readable message.\n\t */\n\tmessage: string;\n\t/**\n\t * Suggested remediation hint.\n\t */\n\thint: string;\n\t/**\n\t * Additional parsed details (for example WGSL line errors).\n\t */\n\tdetails: string[];\n\t/**\n\t * Stack trace lines when available.\n\t */\n\tstack: string[];\n\t/**\n\t * Original unmodified message.\n\t */\n\trawMessage: string;\n\t/**\n\t * Runtime phase where the error occurred.\n\t */\n\tphase: MotionGPUErrorPhase;\n\t/**\n\t * Optional source context for shader-related diagnostics.\n\t */\n\tsource: MotionGPUErrorSource | null;\n\t/**\n\t * Optional runtime context snapshot (material/pass graph/render targets).\n\t */\n\tcontext: MotionGPUErrorContext | null;\n}\n\n/**\n * Splits multi-line values into trimmed non-empty lines.\n */\nfunction splitLines(value: string): string[] {\n\treturn value\n\t\t.split('\\n')\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0);\n}\n\nfunction toDisplayName(path: string): string {\n\tconst normalized = path.split(/[?#]/)[0] ?? path;\n\tconst chunks = normalized.split(/[\\\\/]/);\n\tconst last = chunks[chunks.length - 1];\n\treturn last && last.length > 0 ? last : path;\n}\n\nfunction toSnippet(source: string, line: number, radius = 3): MotionGPUErrorSourceLine[] {\n\tconst lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n\tif (lines.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst targetLine = Math.min(Math.max(1, line), lines.length);\n\tconst start = Math.max(1, targetLine - radius);\n\tconst end = Math.min(lines.length, targetLine + radius);\n\tconst snippet: MotionGPUErrorSourceLine[] = [];\n\n\tfor (let index = start; index <= end; index += 1) {\n\t\tsnippet.push({\n\t\t\tnumber: index,\n\t\t\tcode: lines[index - 1] ?? '',\n\t\t\thighlight: index === targetLine\n\t\t});\n\t}\n\n\treturn snippet;\n}\n\nfunction buildSourceFromDiagnostics(error: unknown): MotionGPUErrorSource | null {\n\tconst diagnostics = getShaderCompilationDiagnostics(error);\n\tif (!diagnostics || diagnostics.diagnostics.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst primary = diagnostics.diagnostics.find((entry) => entry.sourceLocation !== null);\n\tif (!primary?.sourceLocation) {\n\t\treturn null;\n\t}\n\n\tconst location = primary.sourceLocation;\n\tconst column = primary.linePos && primary.linePos > 0 ? primary.linePos : undefined;\n\n\tif (location.kind === 'fragment') {\n\t\tconst component =\n\t\t\tdiagnostics.materialSource?.component ??\n\t\t\t(diagnostics.materialSource?.file\n\t\t\t\t? toDisplayName(diagnostics.materialSource.file)\n\t\t\t\t: 'User shader fragment');\n\t\tconst locationLabel = formatShaderSourceLocation(location) ?? `fragment line ${location.line}`;\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tlocation: `${component} (${locationLabel})`,\n\t\t\tline: location.line,\n\t\t\t...(column !== undefined ? { column } : {}),\n\t\t\tsnippet: toSnippet(diagnostics.fragmentSource, location.line)\n\t\t};\n\t}\n\n\tif (location.kind === 'include') {\n\t\tconst includeName = location.include ?? 'unknown';\n\t\tconst includeSource = diagnostics.includeSources[includeName] ?? '';\n\t\tconst component = `#include <${includeName}>`;\n\t\tconst locationLabel = formatShaderSourceLocation(location) ?? `include <${includeName}>`;\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tlocation: `${component} (${locationLabel})`,\n\t\t\tline: location.line,\n\t\t\t...(column !== undefined ? { column } : {}),\n\t\t\tsnippet: toSnippet(includeSource, location.line)\n\t\t};\n\t}\n\n\tif (location.kind === 'compute') {\n\t\tconst computeSource = diagnostics.computeSource ?? diagnostics.fragmentSource;\n\t\tconst component = 'Compute shader';\n\t\tconst locationLabel = formatShaderSourceLocation(location) ?? `compute line ${location.line}`;\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tlocation: `${component} (${locationLabel})`,\n\t\t\tline: location.line,\n\t\t\t...(column !== undefined ? { column } : {}),\n\t\t\tsnippet: toSnippet(computeSource, location.line)\n\t\t};\n\t}\n\n\tconst defineName = location.define ?? 'unknown';\n\tconst defineLine = Math.max(1, location.line);\n\tconst component = `#define ${defineName}`;\n\tconst locationLabel =\n\t\tformatShaderSourceLocation(location) ?? `define \"${defineName}\" line ${defineLine}`;\n\treturn {\n\t\tcomponent,\n\t\tlocation: `${component} (${locationLabel})`,\n\t\tline: defineLine,\n\t\t...(column !== undefined ? { column } : {}),\n\t\tsnippet: toSnippet(diagnostics.defineBlockSource ?? '', defineLine, 2)\n\t};\n}\n\nfunction formatDiagnosticMessage(entry: ShaderCompilationDiagnostic): string {\n\tconst sourceLabel = formatShaderSourceLocation(entry.sourceLocation);\n\tconst generatedLineLabel =\n\t\tentry.generatedLine > 0 ? `generated WGSL line ${entry.generatedLine}` : null;\n\tconst labels = [sourceLabel, generatedLineLabel].filter((value) => Boolean(value));\n\tif (labels.length === 0) {\n\t\treturn entry.message;\n\t}\n\n\treturn `[${labels.join(' | ')}] ${entry.message}`;\n}\n\n/**\n * Maps known WebGPU/WGSL error patterns to a user-facing title and hint.\n */\nfunction classifyErrorMessage(\n\tmessage: string\n): Pick<MotionGPUErrorReport, 'code' | 'severity' | 'recoverable' | 'title' | 'hint'> {\n\tif (message.includes('WebGPU is not available in this browser')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU unavailable',\n\t\t\thint: 'Use a browser with WebGPU enabled (latest Chrome/Edge/Safari TP) and secure context.'\n\t\t};\n\t}\n\n\tif (message.includes('Unable to acquire WebGPU adapter')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_ADAPTER_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU adapter unavailable',\n\t\t\thint: 'GPU adapter request failed. Check browser permissions, flags and device support.'\n\t\t};\n\t}\n\n\tif (message.includes('Canvas does not support webgpu context')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_CONTEXT_UNAVAILABLE',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Canvas cannot create WebGPU context',\n\t\t\thint: 'Make sure this canvas is attached to DOM and not using an unsupported context option.'\n\t\t};\n\t}\n\n\tif (message.includes('WGSL compilation failed')) {\n\t\treturn {\n\t\t\tcode: 'WGSL_COMPILATION_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'WGSL compilation failed',\n\t\t\thint: 'Check WGSL line numbers below and verify struct/binding/function signatures.'\n\t\t};\n\t}\n\n\tif (\n\t\tmessage.includes('Invalid include directive in fragment shader.') ||\n\t\tmessage.includes('Unknown include \"') ||\n\t\tmessage.includes('Circular include detected for \"') ||\n\t\tmessage.includes('Invalid define value for \"') ||\n\t\tmessage.includes('Invalid include \"')\n\t) {\n\t\treturn {\n\t\t\tcode: 'MATERIAL_PREPROCESS_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Material preprocess failed',\n\t\t\thint: 'Validate #include keys, define values and include expansion order before retrying.'\n\t\t};\n\t}\n\n\tif (message.includes('Compute shader compilation failed')) {\n\t\treturn {\n\t\t\tcode: 'COMPUTE_COMPILATION_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Compute shader compilation failed',\n\t\t\thint: 'Check WGSL compute shader sources below and verify storage bindings.'\n\t\t};\n\t}\n\n\tif (\n\t\tmessage.includes(\n\t\t\t'Compute shader must declare `@compute @workgroup_size(...) fn compute(...)`.'\n\t\t) ||\n\t\tmessage.includes('Compute shader must include a `@builtin(global_invocation_id)` parameter.') ||\n\t\tmessage.includes('Could not extract @workgroup_size from compute shader source.') ||\n\t\tmessage.includes('@workgroup_size dimensions must be integers in range') ||\n\t\tmessage.includes('Unsupported storage buffer access mode \"')\n\t) {\n\t\treturn {\n\t\t\tcode: 'COMPUTE_CONTRACT_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Compute contract is invalid',\n\t\t\thint: 'Ensure compute shader contract (@compute, @workgroup_size, global_invocation_id, storage access) is valid.'\n\t\t};\n\t}\n\n\tif (message.includes('WebGPU device lost') || message.includes('Device Lost')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_DEVICE_LOST',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'WebGPU device lost',\n\t\t\thint: 'GPU device/context was lost. Recreate the renderer and check OS/GPU stability.'\n\t\t};\n\t}\n\n\tif (message.includes('WebGPU uncaptured error')) {\n\t\treturn {\n\t\t\tcode: 'WEBGPU_UNCAPTURED_ERROR',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'WebGPU uncaptured error',\n\t\t\thint: 'A GPU command failed asynchronously. Review details and validate resource/state usage.'\n\t\t};\n\t}\n\n\tif (message.includes('CreateBindGroup') || message.includes('bind group layout')) {\n\t\treturn {\n\t\t\tcode: 'BIND_GROUP_MISMATCH',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Bind group mismatch',\n\t\t\thint: 'Bindings in shader and runtime resources are out of sync. Verify uniforms/textures layout.'\n\t\t};\n\t}\n\n\tif (message.includes('Storage buffer \"') && message.includes('write out of bounds:')) {\n\t\treturn {\n\t\t\tcode: 'STORAGE_BUFFER_OUT_OF_BOUNDS',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Storage buffer write out of bounds',\n\t\t\thint: 'Ensure offset + write byte length does not exceed declared storage buffer size.'\n\t\t};\n\t}\n\n\tif (\n\t\tmessage.includes('Cannot read storage buffer \"') ||\n\t\tmessage.includes('Cannot read storage buffer: GPU device unavailable.') ||\n\t\tmessage.includes('not allocated on GPU.')\n\t) {\n\t\treturn {\n\t\t\tcode: 'STORAGE_BUFFER_READ_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Storage buffer read failed',\n\t\t\thint: 'Readbacks require an initialized renderer, allocated GPU buffer and active device.'\n\t\t};\n\t}\n\n\tif (\n\t\tmessage.includes('Unknown uniform \"') ||\n\t\tmessage.includes('Unknown uniform type for \"') ||\n\t\tmessage.includes('Unknown texture \"') ||\n\t\tmessage.includes('Unknown storage buffer \"') ||\n\t\tmessage.includes('Missing definition for storage buffer \"') ||\n\t\tmessage.includes('Missing texture definition for \"') ||\n\t\t(message.includes('Storage buffer \"') && message.includes('\" not allocated.')) ||\n\t\t(message.includes('Storage texture \"') && message.includes('\" not allocated.'))\n\t) {\n\t\treturn {\n\t\t\tcode: 'RUNTIME_RESOURCE_MISSING',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Runtime resource binding failed',\n\t\t\thint: 'Check material declarations and runtime keys for uniforms, textures and storage resources.'\n\t\t};\n\t}\n\n\tif (message.includes('Uniform ') && message.includes(' value must')) {\n\t\treturn {\n\t\t\tcode: 'UNIFORM_VALUE_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Uniform value is invalid',\n\t\t\thint: 'Provide finite values with tuple/matrix sizes matching the uniform type.'\n\t\t};\n\t}\n\n\tif (\n\t\tmessage.includes('Render pass #') ||\n\t\tmessage.includes('Render graph references unknown runtime target')\n\t) {\n\t\treturn {\n\t\t\tcode: 'RENDER_GRAPH_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Render graph configuration is invalid',\n\t\t\thint: 'Verify pass inputs/outputs, declared render targets and execution order.'\n\t\t};\n\t}\n\n\tif (message.includes('PingPongComputePass must provide a target texture key.')) {\n\t\treturn {\n\t\t\tcode: 'PINGPONG_CONFIGURATION_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Ping-pong compute pass is misconfigured',\n\t\t\thint: 'Configure a valid target texture key for PingPongComputePass.'\n\t\t};\n\t}\n\n\tif (message.includes('Destination texture needs to have CopyDst')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_USAGE_INVALID',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Invalid texture usage flags',\n\t\t\thint: 'Texture used as upload destination must include CopyDst (and often RenderAttachment).'\n\t\t};\n\t}\n\n\tif (message.includes('Texture request failed')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_REQUEST_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Texture request failed',\n\t\t\thint: 'Verify texture URL, CORS policy and response status before retrying.'\n\t\t};\n\t}\n\n\tif (message.includes('createImageBitmap is not available in this runtime')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_DECODE_UNAVAILABLE',\n\t\t\tseverity: 'fatal',\n\t\t\trecoverable: false,\n\t\t\ttitle: 'Texture decode unavailable',\n\t\t\thint: 'Runtime lacks createImageBitmap support. Use a browser/runtime with image bitmap decoding.'\n\t\t};\n\t}\n\n\tif (message.toLowerCase().includes('texture request was aborted')) {\n\t\treturn {\n\t\t\tcode: 'TEXTURE_REQUEST_ABORTED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Texture request aborted',\n\t\t\thint: 'Texture load was cancelled. Retry the request when source inputs stabilize.'\n\t\t};\n\t}\n\n\treturn {\n\t\tcode: 'MOTIONGPU_RUNTIME_ERROR',\n\t\tseverity: 'error',\n\t\trecoverable: true,\n\t\ttitle: 'MotionGPU render error',\n\t\thint: 'Review technical details below. If issue persists, isolate shader/uniform/texture changes.'\n\t};\n}\n\n/**\n * Converts unknown errors to a consistent, display-ready error report.\n *\n * @param error - Unknown thrown value.\n * @param phase - Phase during which error occurred.\n * @returns Normalized error report.\n */\nexport function toMotionGPUErrorReport(\n\terror: unknown,\n\tphase: MotionGPUErrorPhase\n): MotionGPUErrorReport {\n\tconst shaderDiagnostics = getShaderCompilationDiagnostics(error);\n\tconst rawMessage =\n\t\terror instanceof Error\n\t\t\t? error.message\n\t\t\t: typeof error === 'string'\n\t\t\t\t? error\n\t\t\t\t: 'Unknown FragCanvas error';\n\tconst rawLines = splitLines(rawMessage);\n\tconst defaultMessage = rawLines[0] ?? rawMessage;\n\tconst defaultDetails = rawLines.slice(1);\n\tconst source = buildSourceFromDiagnostics(error);\n\tconst context = shaderDiagnostics?.runtimeContext ?? null;\n\tconst message =\n\t\tshaderDiagnostics && shaderDiagnostics.diagnostics[0]\n\t\t\t? formatDiagnosticMessage(shaderDiagnostics.diagnostics[0])\n\t\t\t: defaultMessage;\n\tconst details = shaderDiagnostics\n\t\t? shaderDiagnostics.diagnostics.slice(1).map((entry) => formatDiagnosticMessage(entry))\n\t\t: defaultDetails;\n\tconst stack =\n\t\terror instanceof Error && error.stack\n\t\t\t? splitLines(error.stack).filter((line) => line !== message)\n\t\t\t: [];\n\tlet classification = classifyErrorMessage(rawMessage);\n\tif (\n\t\tshaderDiagnostics?.shaderStage === 'compute' &&\n\t\tclassification.code === 'WGSL_COMPILATION_FAILED'\n\t) {\n\t\tclassification = {\n\t\t\tcode: 'COMPUTE_COMPILATION_FAILED',\n\t\t\tseverity: 'error',\n\t\t\trecoverable: true,\n\t\t\ttitle: 'Compute shader compilation failed',\n\t\t\thint: 'Check WGSL compute shader sources below and verify storage bindings.'\n\t\t};\n\t}\n\n\treturn {\n\t\tcode: classification.code,\n\t\tseverity: classification.severity,\n\t\trecoverable: classification.recoverable,\n\t\ttitle: classification.title,\n\t\tmessage,\n\t\thint: classification.hint,\n\t\tdetails,\n\t\tstack,\n\t\trawMessage,\n\t\tphase,\n\t\tsource,\n\t\tcontext\n\t};\n}\n"],"mappings":";;;;;;AAqIA,SAAS,WAAW,OAAyB;AAC5C,QAAO,MACL,MAAM,KAAK,CACX,KAAK,SAAS,KAAK,MAAM,CAAC,CAC1B,QAAQ,SAAS,KAAK,SAAS,EAAE;;AAGpC,SAAS,cAAc,MAAsB;CAE5C,MAAM,UADa,KAAK,MAAM,OAAO,CAAC,MAAM,MAClB,MAAM,QAAQ;CACxC,MAAM,OAAO,OAAO,OAAO,SAAS;AACpC,QAAO,QAAQ,KAAK,SAAS,IAAI,OAAO;;AAGzC,SAAS,UAAU,QAAgB,MAAc,SAAS,GAA+B;CACxF,MAAM,QAAQ,OAAO,QAAQ,UAAU,KAAK,CAAC,MAAM,KAAK;AACxD,KAAI,MAAM,WAAW,EACpB,QAAO,EAAE;CAGV,MAAM,aAAa,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,EAA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P,MAAM;EACN;AAGF,QAAO;EACN,MAAM;EACN,UAAU;EACV,aAAa;EACb,OAAO;EACP,MAAM;EACN;;;;;;;;;AAUF,SAAgB,uBACf,OACA,OACuB;CACvB,MAAM,oBAAoB,gCAAgC,MAAM;CAChE,MAAM,aACL,iBAAiB,QACd,MAAM,UACN,OAAO,UAAU,WAChB,QACA;CACL,MAAM,WAAW,WAAW,WAAW;CACvC,MAAM,iBAAiB,SAAS,MAAM;CACtC,MAAM,iBAAiB,SAAS,MAAM,EAAE;CACxC,MAAM,SAAS,2BAA2B,MAAM;CAChD,MAAM,UAAU,mBAAmB,kBAAkB;CACrD,MAAM,UACL,qBAAqB,kBAAkB,YAAY,KAChD,wBAAwB,kBAAkB,YAAY,GAAG,GACzD;CACJ,MAAM,UAAU,oBACb,kBAAkB,YAAY,MAAM,EAAE,CAAC,KAAK,UAAU,wBAAwB,MAAM,CAAC,GACrF;CACH,MAAM,QACL,iBAAiB,SAAS,MAAM,QAC7B,WAAW,MAAM,MAAM,CAAC,QAAQ,SAAS,SAAS,QAAQ,GAC1D,EAAE;CACN,IAAI,iBAAiB,qBAAqB,WAAW;AACrD,KACC,mBAAmB,gBAAgB,aACnC,eAAe,SAAS,0BAExB,kBAAiB;EAChB,MAAM;EACN,UAAU;EACV,aAAa;EACb,OAAO;EACP,MAAM;EACN;AAGF,QAAO;EACN,MAAM,eAAe;EACrB,UAAU,eAAe;EACzB,aAAa,eAAe;EAC5B,OAAO,eAAe;EACtB;EACA,MAAM,eAAe;EACrB;EACA;EACA;EACA;EACA;EACA;EACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"frame-registry.d.ts","sourceRoot":"","sources":["../../src/lib/core/frame-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF;;GAEG;AACH,MAAM,M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C;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,aAAa,CA6fhB"}
@@ -442,7 +442,7 @@ function createFrameRegistry(options) {
442
442
  stop,
443
443
  started: internalTask.startedStore,
444
444
  unsubscribe: () => {
445
- if (stage.tasks.delete(key)) markScheduleDirty();
445
+ if (stage.tasks.get(key) === internalTask && stage.tasks.delete(key)) markScheduleDirty();
446
446
  }
447
447
  };
448
448
  },