@luma.gl/graph 10.0.0-alpha.7 → 10.0.0-alpha.9

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 (193) hide show
  1. package/dist/dist.dev.js +5096 -7269
  2. package/dist/dist.min.js +270 -83
  3. package/dist/experimental/index.cjs.map +2 -2
  4. package/dist/experimental/simulation/index.cjs.map +2 -2
  5. package/dist/gpu-core/compiled-gpu-graph.cjs +99 -14
  6. package/dist/gpu-core/compiled-gpu-graph.d.ts +26 -4
  7. package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
  8. package/dist/gpu-core/compiled-gpu-graph.js +101 -13
  9. package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
  10. package/dist/gpu-core/gpu-command-graph-compiler.cjs +35 -3
  11. package/dist/gpu-core/gpu-command-graph-compiler.js +40 -4
  12. package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
  13. package/dist/gpu-core/gpu-command-graph-types.d.ts +2 -0
  14. package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
  15. package/dist/gpu-core/gpu-compaction-operation.cjs +56 -0
  16. package/dist/gpu-core/gpu-compaction-operation.d.ts +20 -0
  17. package/dist/gpu-core/gpu-compaction-operation.d.ts.map +1 -0
  18. package/dist/gpu-core/gpu-compaction-operation.js +36 -0
  19. package/dist/gpu-core/gpu-compaction-operation.js.map +1 -0
  20. package/dist/gpu-core/gpu-compaction.cjs +35 -3
  21. package/dist/gpu-core/gpu-compaction.d.ts.map +1 -1
  22. package/dist/gpu-core/gpu-compaction.js +38 -3
  23. package/dist/gpu-core/gpu-compaction.js.map +1 -1
  24. package/dist/gpu-core/gpu-expression-operation.cjs +18 -2
  25. package/dist/gpu-core/gpu-expression-operation.d.ts +2 -2
  26. package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
  27. package/dist/gpu-core/gpu-expression-operation.js +20 -1
  28. package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
  29. package/dist/gpu-core/gpu-expression-plan.cjs +140 -29
  30. package/dist/gpu-core/gpu-expression-plan.d.ts +26 -5
  31. package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
  32. package/dist/gpu-core/gpu-expression-plan.js +168 -34
  33. package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
  34. package/dist/gpu-core/gpu-graph-compiler.cjs +100 -11
  35. package/dist/gpu-core/gpu-graph-compiler.d.ts +7 -3
  36. package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
  37. package/dist/gpu-core/gpu-graph-compiler.js +109 -9
  38. package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
  39. package/dist/gpu-core/gpu-graph-declarations.cjs +120 -0
  40. package/dist/gpu-core/gpu-graph-declarations.d.ts +4 -0
  41. package/dist/gpu-core/gpu-graph-declarations.d.ts.map +1 -0
  42. package/dist/gpu-core/gpu-graph-declarations.js +110 -0
  43. package/dist/gpu-core/gpu-graph-declarations.js.map +1 -0
  44. package/dist/gpu-core/gpu-graph-validation.cjs +33 -2
  45. package/dist/gpu-core/gpu-graph-validation.d.ts.map +1 -1
  46. package/dist/gpu-core/gpu-graph-validation.js +32 -0
  47. package/dist/gpu-core/gpu-graph-validation.js.map +1 -1
  48. package/dist/gpu-core/gpu-graph-value.cjs +38 -3
  49. package/dist/gpu-core/gpu-graph-value.d.ts +50 -4
  50. package/dist/gpu-core/gpu-graph-value.d.ts.map +1 -1
  51. package/dist/gpu-core/gpu-graph-value.js +39 -1
  52. package/dist/gpu-core/gpu-graph-value.js.map +1 -1
  53. package/dist/gpu-core/gpu-graph.cjs +65 -0
  54. package/dist/gpu-core/gpu-graph.d.ts +15 -2
  55. package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
  56. package/dist/gpu-core/gpu-graph.js +70 -0
  57. package/dist/gpu-core/gpu-graph.js.map +1 -1
  58. package/dist/gpu-core/gpu-operation-contract.cjs +5 -0
  59. package/dist/gpu-core/gpu-operation-contract.d.ts +10 -0
  60. package/dist/gpu-core/gpu-operation-contract.d.ts.map +1 -1
  61. package/dist/gpu-core/gpu-operation-contract.js +6 -1
  62. package/dist/gpu-core/gpu-operation-contract.js.map +1 -1
  63. package/dist/gpu-core/gpu-scan.cjs +11 -2
  64. package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
  65. package/dist/gpu-core/gpu-scan.js +11 -2
  66. package/dist/gpu-core/gpu-scan.js.map +1 -1
  67. package/dist/gpu-core/gpu-texture-copy.cjs +53 -0
  68. package/dist/gpu-core/gpu-texture-copy.d.ts +7 -0
  69. package/dist/gpu-core/gpu-texture-copy.d.ts.map +1 -0
  70. package/dist/gpu-core/gpu-texture-copy.js +39 -0
  71. package/dist/gpu-core/gpu-texture-copy.js.map +1 -0
  72. package/dist/gpu-core/gpu-texture-plan.cjs +181 -0
  73. package/dist/gpu-core/gpu-texture-plan.d.ts +32 -0
  74. package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -0
  75. package/dist/gpu-core/gpu-texture-plan.js +215 -0
  76. package/dist/gpu-core/gpu-texture-plan.js.map +1 -0
  77. package/dist/gpu-core/gpu-transfer-lowering.cjs +109 -0
  78. package/dist/gpu-core/gpu-transfer-lowering.d.ts +9 -0
  79. package/dist/gpu-core/gpu-transfer-lowering.d.ts.map +1 -0
  80. package/dist/gpu-core/gpu-transfer-lowering.js +88 -0
  81. package/dist/gpu-core/gpu-transfer-lowering.js.map +1 -0
  82. package/dist/gpu-core/gpu-transfer-operation.cjs +100 -0
  83. package/dist/gpu-core/gpu-transfer-operation.d.ts +38 -0
  84. package/dist/gpu-core/gpu-transfer-operation.d.ts.map +1 -0
  85. package/dist/gpu-core/gpu-transfer-operation.js +84 -0
  86. package/dist/gpu-core/gpu-transfer-operation.js.map +1 -0
  87. package/dist/gpu-core/index.cjs +13 -0
  88. package/dist/gpu-core/index.cjs.map +3 -3
  89. package/dist/gpu-core/index.d.ts +11 -1
  90. package/dist/gpu-core/index.d.ts.map +1 -1
  91. package/dist/gpu-core/index.js +4 -1
  92. package/dist/gpu-core/index.js.map +1 -1
  93. package/dist/gpu-dggs/benchmarks.cjs.map +2 -2
  94. package/dist/gpu-graph/index.cjs +8 -0
  95. package/dist/gpu-graph/index.cjs.map +3 -3
  96. package/dist/gpu-graph/index.d.ts +5 -0
  97. package/dist/gpu-graph/index.d.ts.map +1 -1
  98. package/dist/gpu-graph/index.js +2 -0
  99. package/dist/gpu-graph/index.js.map +1 -1
  100. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +3 -3
  101. package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
  102. package/dist/gpu-physics/gpu-rigid-body-world.cjs +56 -17
  103. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +1 -1
  104. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  105. package/dist/gpu-physics/gpu-rigid-body-world.js +42 -2
  106. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  107. package/dist/gpu-physics/index.cjs.map +2 -2
  108. package/dist/gpu-physics/rigid-body-joints.cjs +6 -1
  109. package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
  110. package/dist/gpu-physics/rigid-body-joints.js +9 -1
  111. package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
  112. package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +4 -2
  113. package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
  114. package/dist/gpu-physics/rigid-body-parallel-shaders.js +4 -2
  115. package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
  116. package/dist/gpu-physics/rigid-body-shaders.cjs +1 -0
  117. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  118. package/dist/gpu-physics/rigid-body-shaders.js +1 -0
  119. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  120. package/dist/gpu-pointcloud/index.cjs.map +1 -1
  121. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +54 -7
  122. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +11 -4
  123. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
  124. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +56 -4
  125. package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
  126. package/dist/gpu-simple-graph/gpu-simple-graph.cjs +16 -0
  127. package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +11 -4
  128. package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
  129. package/dist/gpu-simple-graph/gpu-simple-graph.js +18 -0
  130. package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
  131. package/dist/gpu-simple-graph/gpu-transfer-execution.cjs +82 -0
  132. package/dist/gpu-simple-graph/gpu-transfer-execution.d.ts +7 -0
  133. package/dist/gpu-simple-graph/gpu-transfer-execution.d.ts.map +1 -0
  134. package/dist/gpu-simple-graph/gpu-transfer-execution.js +64 -0
  135. package/dist/gpu-simple-graph/gpu-transfer-execution.js.map +1 -0
  136. package/dist/gpu-simple-graph/index.cjs +3 -0
  137. package/dist/gpu-simple-graph/index.cjs.map +3 -3
  138. package/dist/gpu-simple-graph/index.d.ts +3 -0
  139. package/dist/gpu-simple-graph/index.d.ts.map +1 -1
  140. package/dist/gpu-simple-graph/index.js +1 -0
  141. package/dist/gpu-simple-graph/index.js.map +1 -1
  142. package/dist/gpu-sql/{lu-sql.cjs → gpu-sql.cjs} +68 -68
  143. package/dist/gpu-sql/{lu-sql.d.ts → gpu-sql.d.ts} +14 -14
  144. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -0
  145. package/dist/gpu-sql/{lu-sql.js → gpu-sql.js} +68 -68
  146. package/dist/gpu-sql/gpu-sql.js.map +1 -0
  147. package/dist/gpu-sql/index.cjs +5 -5
  148. package/dist/gpu-sql/index.cjs.map +2 -2
  149. package/dist/gpu-sql/index.d.ts +2 -2
  150. package/dist/gpu-sql/index.d.ts.map +1 -1
  151. package/dist/gpu-sql/index.js +1 -1
  152. package/dist/gpu-sql/index.js.map +1 -1
  153. package/dist/index.cjs +13 -0
  154. package/dist/index.cjs.map +3 -3
  155. package/dist/index.d.ts +11 -1
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +4 -1
  158. package/dist/index.js.map +1 -1
  159. package/package.json +6 -7
  160. package/src/gpu-core/compiled-gpu-graph.ts +118 -15
  161. package/src/gpu-core/gpu-command-graph-compiler.ts +38 -6
  162. package/src/gpu-core/gpu-command-graph-types.ts +2 -0
  163. package/src/gpu-core/gpu-compaction-operation.ts +49 -0
  164. package/src/gpu-core/gpu-compaction.ts +47 -3
  165. package/src/gpu-core/gpu-expression-operation.ts +23 -2
  166. package/src/gpu-core/gpu-expression-plan.ts +247 -44
  167. package/src/gpu-core/gpu-graph-compiler.ts +130 -11
  168. package/src/gpu-core/gpu-graph-declarations.ts +137 -0
  169. package/src/gpu-core/gpu-graph-validation.ts +32 -0
  170. package/src/gpu-core/gpu-graph-value.ts +88 -4
  171. package/src/gpu-core/gpu-graph.ts +104 -2
  172. package/src/gpu-core/gpu-operation-contract.ts +18 -0
  173. package/src/gpu-core/gpu-scan.ts +15 -2
  174. package/src/gpu-core/gpu-texture-copy.ts +51 -0
  175. package/src/gpu-core/gpu-texture-plan.ts +248 -0
  176. package/src/gpu-core/gpu-transfer-lowering.ts +102 -0
  177. package/src/gpu-core/gpu-transfer-operation.ts +110 -0
  178. package/src/gpu-core/index.ts +22 -1
  179. package/src/gpu-graph/index.ts +15 -0
  180. package/src/gpu-physics/gpu-rigid-body-world.ts +44 -3
  181. package/src/gpu-physics/rigid-body-joints.ts +11 -2
  182. package/src/gpu-physics/rigid-body-parallel-shaders.ts +4 -2
  183. package/src/gpu-physics/rigid-body-shaders.ts +1 -0
  184. package/src/gpu-project/README.md +4 -4
  185. package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +90 -8
  186. package/src/gpu-simple-graph/gpu-simple-graph.ts +56 -3
  187. package/src/gpu-simple-graph/gpu-transfer-execution.ts +73 -0
  188. package/src/gpu-simple-graph/index.ts +9 -0
  189. package/src/gpu-sql/{lu-sql.ts → gpu-sql.ts} +134 -125
  190. package/src/gpu-sql/index.ts +2 -2
  191. package/src/index.ts +29 -1
  192. package/dist/gpu-sql/lu-sql.d.ts.map +0 -1
  193. package/dist/gpu-sql/lu-sql.js.map +0 -1
@@ -0,0 +1,120 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var gpu_graph_declarations_exports = {};
19
+ __export(gpu_graph_declarations_exports, {
20
+ resolveGPUGraphDeclarations: () => resolveGPUGraphDeclarations
21
+ });
22
+ module.exports = __toCommonJS(gpu_graph_declarations_exports);
23
+ var import_gpu_graph_value = require("./gpu-graph-value.cjs");
24
+ var import_gpu_operation = require("./gpu-operation.cjs");
25
+ var import_gpu_operation_contract = require("./gpu-operation-contract.cjs");
26
+ function resolveGPUGraphDeclarations(source) {
27
+ const program = source.clone();
28
+ const values = new Map([...program.scalars, ...program.vectors, ...program.textures].map((value) => [value.id, value]));
29
+ const written = /* @__PURE__ */ new Set();
30
+ const visit = (operation, conditional = false) => {
31
+ var _a, _b;
32
+ if (operation instanceof import_gpu_operation.GPUCompositeOperation) {
33
+ for (const child of operation.operations)
34
+ visit(child, conditional || operation.type !== "composite");
35
+ return;
36
+ }
37
+ if (!(0, import_gpu_operation.isGPUOperation)(operation))
38
+ return;
39
+ try {
40
+ const contract = operation.contract;
41
+ if (!contract)
42
+ return;
43
+ const outputs = typeof contract.outputs === "function" ? contract.outputs({
44
+ getValue(name) {
45
+ const value = values.get(name);
46
+ if (!value)
47
+ throw new Error(`Undeclared operation value ${name}`);
48
+ if (value instanceof import_gpu_graph_value.GPUGraphTexture)
49
+ return value.descriptor ?? import_gpu_graph_value.gpuGraph.texture({
50
+ format: value.format,
51
+ dimension: value.dimension,
52
+ extent: { width: value.width, height: value.height, depth: value.depth },
53
+ mipLevels: value.mipLevels,
54
+ samples: value.samples
55
+ });
56
+ return value instanceof import_gpu_graph_value.GPUGraphScalar ? import_gpu_graph_value.gpuGraph.scalar(value.format) : import_gpu_graph_value.gpuGraph.vector(value.format, {
57
+ length: value.length,
58
+ chunkLengths: value.chunkLengths
59
+ });
60
+ }
61
+ }) : contract.outputs;
62
+ for (const [name, descriptor] of Object.entries(outputs ?? {})) {
63
+ if (!contract.values.some((use) => use.access === "write" && (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value) === name))
64
+ throw new Error(`Operation result ${name} requires a write`);
65
+ if (descriptor.type === "texture" && descriptor.extent && "like" in descriptor.extent) {
66
+ const sourceName = descriptor.extent.like;
67
+ if (!(values.get(sourceName) instanceof import_gpu_graph_value.GPUGraphTexture) || !contract.values.some((use) => use.access !== "write" && (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value) === sourceName))
68
+ throw new Error(`Texture extent source ${sourceName} must be a declared texture read`);
69
+ }
70
+ const existing = values.get(name);
71
+ if ((existing == null ? void 0 : existing.role) === "input" || (existing == null ? void 0 : existing.role) === "state")
72
+ throw new Error(`Operation result conflicts with ${existing.role} ${name}`);
73
+ if (!existing) {
74
+ if (conditional)
75
+ throw new Error("Operation results inside control flow require explicit declarations");
76
+ const shape = (_a = contract.values.find((use) => (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value) === name && use.access === "write")) == null ? void 0 : _a.shape;
77
+ let resolvedDescriptor = descriptor;
78
+ if (descriptor.type === "vector" && descriptor.length === void 0 && shape) {
79
+ const source2 = "like" in shape ? values.get((0, import_gpu_operation_contract.getGPUOperationValueName)(shape.like)) : void 0;
80
+ const dimensions = "length" in shape ? shape : source2 instanceof import_gpu_graph_value.GPUGraphVector ? source2 : void 0;
81
+ if ((dimensions == null ? void 0 : dimensions.length) !== void 0)
82
+ resolvedDescriptor = {
83
+ ...descriptor,
84
+ length: dimensions.length,
85
+ chunkLengths: descriptor.chunkLengths ?? dimensions.chunkLengths
86
+ };
87
+ }
88
+ const declaration = program.addDeclaration(name, resolvedDescriptor, "value");
89
+ values.set(name, declaration);
90
+ } else if (existing.format !== descriptor.format || existing instanceof import_gpu_graph_value.GPUGraphVector !== (descriptor.type === "vector") || existing instanceof import_gpu_graph_value.GPUGraphTexture !== (descriptor.type === "texture"))
91
+ throw new Error(`Incompatible operation result ${name}`);
92
+ else if (existing instanceof import_gpu_graph_value.GPUGraphVector && descriptor.type === "vector")
93
+ values.set(name, program.constrainResult(existing, descriptor));
94
+ }
95
+ (0, import_gpu_operation_contract.validateGPUOperationContract)(program, contract);
96
+ for (const use of contract.values) {
97
+ const name = (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value);
98
+ const declaration = values.get(name);
99
+ if (use.access !== "read" && (declaration == null ? void 0 : declaration.role) === "input")
100
+ throw new Error(`Cannot write graph input ${name}`);
101
+ if (use.access !== "write" && (declaration == null ? void 0 : declaration.role) === "value" && !written.has(name))
102
+ throw new Error(`Reads ${name} before it is produced`);
103
+ }
104
+ const writes = new Set(contract.values.filter((use) => use.access !== "read").map((use) => (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value)));
105
+ for (const name of writes) {
106
+ if (((_b = values.get(name)) == null ? void 0 : _b.role) === "value" && written.has(name))
107
+ throw new Error(`Multiple writers for graph result ${name}`);
108
+ written.add(name);
109
+ }
110
+ } catch (error) {
111
+ throw new Error(`${operation.id}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
112
+ }
113
+ };
114
+ program.operations.forEach((operation) => visit(operation));
115
+ return program;
116
+ }
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ resolveGPUGraphDeclarations
120
+ });
@@ -0,0 +1,4 @@
1
+ import type { GPUGraph } from "./gpu-graph.js";
2
+ /** Resolve operation-owned logical results without modifying the authored graph. @internal */
3
+ export declare function resolveGPUGraphDeclarations(source: GPUGraph): GPUGraph;
4
+ //# sourceMappingURL=gpu-graph-declarations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-graph-declarations.d.ts","sourceRoot":"","sources":["../../src/gpu-core/gpu-graph-declarations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAC,uBAAoB;AAW1C,8FAA8F;AAC9F,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAwHtE"}
@@ -0,0 +1,110 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import { GPUGraphScalar, GPUGraphTexture, GPUGraphVector, gpuGraph } from "./gpu-graph-value.js";
5
+ import { GPUCompositeOperation, isGPUOperation } from "./gpu-operation.js";
6
+ import { getGPUOperationValueName, validateGPUOperationContract } from "./gpu-operation-contract.js";
7
+ /** Resolve operation-owned logical results without modifying the authored graph. @internal */
8
+ export function resolveGPUGraphDeclarations(source) {
9
+ const program = source.clone();
10
+ const values = new Map([...program.scalars, ...program.vectors, ...program.textures].map(value => [value.id, value]));
11
+ const written = new Set();
12
+ const visit = (operation, conditional = false) => {
13
+ if (operation instanceof GPUCompositeOperation) {
14
+ for (const child of operation.operations)
15
+ visit(child, conditional || operation.type !== 'composite');
16
+ return;
17
+ }
18
+ if (!isGPUOperation(operation))
19
+ return;
20
+ try {
21
+ const contract = operation.contract;
22
+ if (!contract)
23
+ return;
24
+ const outputs = typeof contract.outputs === 'function'
25
+ ? contract.outputs({
26
+ getValue(name) {
27
+ const value = values.get(name);
28
+ if (!value)
29
+ throw new Error(`Undeclared operation value ${name}`);
30
+ if (value instanceof GPUGraphTexture)
31
+ return (value.descriptor ??
32
+ gpuGraph.texture({
33
+ format: value.format,
34
+ dimension: value.dimension,
35
+ extent: { width: value.width, height: value.height, depth: value.depth },
36
+ mipLevels: value.mipLevels,
37
+ samples: value.samples
38
+ }));
39
+ return value instanceof GPUGraphScalar
40
+ ? gpuGraph.scalar(value.format)
41
+ : gpuGraph.vector(value.format, {
42
+ length: value.length,
43
+ chunkLengths: value.chunkLengths
44
+ });
45
+ }
46
+ })
47
+ : contract.outputs;
48
+ for (const [name, descriptor] of Object.entries(outputs ?? {})) {
49
+ if (!contract.values.some(use => use.access === 'write' && getGPUOperationValueName(use.value) === name))
50
+ throw new Error(`Operation result ${name} requires a write`);
51
+ if (descriptor.type === 'texture' && descriptor.extent && 'like' in descriptor.extent) {
52
+ const sourceName = descriptor.extent.like;
53
+ if (!(values.get(sourceName) instanceof GPUGraphTexture) ||
54
+ !contract.values.some(use => use.access !== 'write' && getGPUOperationValueName(use.value) === sourceName))
55
+ throw new Error(`Texture extent source ${sourceName} must be a declared texture read`);
56
+ }
57
+ const existing = values.get(name);
58
+ if (existing?.role === 'input' || existing?.role === 'state')
59
+ throw new Error(`Operation result conflicts with ${existing.role} ${name}`);
60
+ if (!existing) {
61
+ if (conditional)
62
+ throw new Error('Operation results inside control flow require explicit declarations');
63
+ const shape = contract.values.find(use => getGPUOperationValueName(use.value) === name && use.access === 'write')?.shape;
64
+ let resolvedDescriptor = descriptor;
65
+ if (descriptor.type === 'vector' && descriptor.length === undefined && shape) {
66
+ const source = 'like' in shape ? values.get(getGPUOperationValueName(shape.like)) : undefined;
67
+ const dimensions = 'length' in shape ? shape : source instanceof GPUGraphVector ? source : undefined;
68
+ if (dimensions?.length !== undefined)
69
+ resolvedDescriptor = {
70
+ ...descriptor,
71
+ length: dimensions.length,
72
+ chunkLengths: descriptor.chunkLengths ?? dimensions.chunkLengths
73
+ };
74
+ }
75
+ const declaration = program.addDeclaration(name, resolvedDescriptor, 'value');
76
+ values.set(name, declaration);
77
+ }
78
+ else if (existing.format !== descriptor.format ||
79
+ existing instanceof GPUGraphVector !== (descriptor.type === 'vector') ||
80
+ existing instanceof GPUGraphTexture !== (descriptor.type === 'texture'))
81
+ throw new Error(`Incompatible operation result ${name}`);
82
+ else if (existing instanceof GPUGraphVector && descriptor.type === 'vector')
83
+ values.set(name, program.constrainResult(existing, descriptor));
84
+ }
85
+ validateGPUOperationContract(program, contract);
86
+ for (const use of contract.values) {
87
+ const name = getGPUOperationValueName(use.value);
88
+ const declaration = values.get(name);
89
+ if (use.access !== 'read' && declaration?.role === 'input')
90
+ throw new Error(`Cannot write graph input ${name}`);
91
+ if (use.access !== 'write' && declaration?.role === 'value' && !written.has(name))
92
+ throw new Error(`Reads ${name} before it is produced`);
93
+ }
94
+ const writes = new Set(contract.values
95
+ .filter(use => use.access !== 'read')
96
+ .map(use => getGPUOperationValueName(use.value)));
97
+ for (const name of writes) {
98
+ if (values.get(name)?.role === 'value' && written.has(name))
99
+ throw new Error(`Multiple writers for graph result ${name}`);
100
+ written.add(name);
101
+ }
102
+ }
103
+ catch (error) {
104
+ throw new Error(`${operation.id}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
105
+ }
106
+ };
107
+ program.operations.forEach(operation => visit(operation));
108
+ return program;
109
+ }
110
+ //# sourceMappingURL=gpu-graph-declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-graph-declarations.js","sourceRoot":"","sources":["../../src/gpu-core/gpu-graph-declarations.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAG5D,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EAET,6BAA0B;AAC3B,OAAO,EAAC,qBAAqB,EAAE,cAAc,EAAy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AC;AACjB,CAAC"}
@@ -20,15 +20,46 @@ __export(gpu_graph_validation_exports, {
20
20
  validateGPUGraph: () => validateGPUGraph
21
21
  });
22
22
  module.exports = __toCommonJS(gpu_graph_validation_exports);
23
+ var import_gpu_graph_declarations = require("./gpu-graph-declarations.cjs");
23
24
  var import_gpu_operation_contract = require("./gpu-operation-contract.cjs");
24
25
  var import_gpu_operation = require("./gpu-operation.cjs");
25
26
  var import_gpu_control_flow_operation = require("./gpu-control-flow-operation.cjs");
26
27
  function validateGPUGraph(program, bindings = {}) {
27
- var _a;
28
+ var _a, _b, _c;
28
29
  const issues = [];
30
+ try {
31
+ program = (0, import_gpu_graph_declarations.resolveGPUGraphDeclarations)(program);
32
+ } catch (error) {
33
+ return {
34
+ valid: false,
35
+ issues: [
36
+ {
37
+ level: "error",
38
+ code: "invalid-operation-contract",
39
+ message: error instanceof Error ? error.message : String(error)
40
+ }
41
+ ]
42
+ };
43
+ }
44
+ for (const scalar of program.scalars) {
45
+ if (scalar.role === "input" && ((_a = bindings.scalars) == null ? void 0 : _a[scalar.id]) === void 0)
46
+ issues.push({
47
+ level: "error",
48
+ code: "missing-input",
49
+ valueId: scalar.id,
50
+ message: `Missing input binding ${scalar.id}`
51
+ });
52
+ if (scalar.role === "value" && ((_b = bindings.scalars) == null ? void 0 : _b[scalar.id]) !== void 0)
53
+ issues.push({
54
+ level: "error",
55
+ code: "result-binding",
56
+ valueId: scalar.id,
57
+ message: `Cannot initialize graph result ${scalar.id}`
58
+ });
59
+ }
29
60
  const scalars = new Set(program.scalars.map((value) => value.id));
30
61
  for (const vector of program.vectors)
31
- if (vector.external && !((_a = bindings.vectors) == null ? void 0 : _a[vector.id]))
62
+ if (vector.external && !((_c = bindings.vectors) == null ? void 0 : _c[vector.id]))
32
63
  issues.push({
33
64
  level: "error",
34
65
  code: "missing-external-vector",
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-graph-validation.d.ts","sourceRoot":"","sources":["../../src/gpu-core/gpu-graph-validation.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
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import { resolveGPUGraphDeclarations } from "./gpu-graph-declarations.js";
4
5
  import { validateGPUOperationContract } from "./gpu-operation-contract.js";
5
6
  import { GPUCompositeOperation, isGPUOperation } from "./gpu-operation.js";
6
7
  import { GPUConditionalOperation, GPULoopOperation } from "./gpu-control-flow-operation.js";
7
8
  /** Validates semantic structure and required external bindings before WebGPU graph allocation/lowering. */
8
9
  export function validateGPUGraph(program, bindings = {}) {
9
10
  const issues = [];
11
+ try {
12
+ program = resolveGPUGraphDeclarations(program);
13
+ }
14
+ catch (error) {
15
+ return {
16
+ valid: false,
17
+ issues: [
18
+ {
19
+ level: 'error',
20
+ code: 'invalid-operation-contract',
21
+ message: error instanceof Error ? error.message : String(error)
22
+ }
23
+ ]
24
+ };
25
+ }
26
+ for (const scalar of program.scalars) {
27
+ if (scalar.role === 'input' && bindings.scalars?.[scalar.id] === undefined)
28
+ issues.push({
29
+ level: 'error',
30
+ code: 'missing-input',
31
+ valueId: scalar.id,
32
+ message: `Missing input binding ${scalar.id}`
33
+ });
34
+ if (scalar.role === 'value' && bindings.scalars?.[scalar.id] !== undefined)
35
+ issues.push({
36
+ level: 'error',
37
+ code: 'result-binding',
38
+ valueId: scalar.id,
39
+ message: `Cannot initialize graph result ${scalar.id}`
40
+ });
41
+ }
10
42
  const scalars = new Set(program.scalars.map(value => value.id));
11
43
  for (const vector of program.vectors)
12
44
  if (vector.external && !bindings.vectors?.[vector.id])
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-graph-validation.js","sourceRoot":"","sources":["../../src/gpu-core/gpu-graph-validation.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAG5D,OAAO,EAAC,4BAA4B,EAAC,oCAAiC;AACtE,OAAO,EAAC,qBAAqB,EAAE,cAAc,EAAyB,2BAAwB;AAC9F,OAAO,EAAC,uBAAuB,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KAAK,CAAC,EAAE,GAAG;qBAChG,CAAC,CAAC;YACP,CAAC;QACH,CAAC;QACD,IAAI,SAAS,YAAY,qBAAqB;YAC5C,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,UAAU;gBAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU;QAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,OAAO,CAAC;QACrD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAC,GAAG,KAAK,EAAC,CAAC,CAAC,CAAC;KACtE,CAAC,CAAC;AACL,CAAC"}
@@ -20,13 +20,41 @@ __export(gpu_graph_value_exports, {
20
20
  GPUGraphScalar: () => GPUGraphScalar,
21
21
  GPUGraphTexture: () => GPUGraphTexture,
22
22
  GPUGraphTextureView: () => GPUGraphTextureView,
23
- GPUGraphVector: () => GPUGraphVector
23
+ GPUGraphVector: () => GPUGraphVector,
24
+ gpuGraph: () => gpuGraph
24
25
  });
25
26
  module.exports = __toCommonJS(gpu_graph_value_exports);
27
+ const gpuGraph = {
28
+ texture(props) {
29
+ return Object.freeze({
30
+ ...props,
31
+ type: "texture",
32
+ ...props.extent ? {
33
+ extent: Object.freeze({
34
+ ...props.extent,
35
+ ..."scale" in props.extent && props.extent.scale ? { scale: Object.freeze([...props.extent.scale]) } : {}
36
+ })
37
+ } : {}
38
+ });
39
+ },
40
+ scalar(format) {
41
+ return Object.freeze({ type: "scalar", format });
42
+ },
43
+ vector(format, shape = {}) {
44
+ return Object.freeze({
45
+ type: "vector",
46
+ format,
47
+ ...shape,
48
+ ...shape.chunkLengths ? { chunkLengths: Object.freeze([...shape.chunkLengths]) } : {}
49
+ });
50
+ }
51
+ };
26
52
  class GPUGraphScalar {
53
+ role;
27
54
  id;
28
55
  format;
29
- constructor(id, format) {
56
+ constructor(id, format, role) {
57
+ this.role = role;
30
58
  if (!id)
31
59
  throw new Error("GPUGraphScalar id is required");
32
60
  this.id = id;
@@ -39,6 +67,7 @@ class GPUGraphVector {
39
67
  /** Optional fixed-length constraint; undefined means execution-sized. */
40
68
  length;
41
69
  external;
70
+ role;
42
71
  /** Optional physical partition lengths; omitted external topology is supplied by its binding. */
43
72
  chunkLengths;
44
73
  constructor(props) {
@@ -51,6 +80,7 @@ class GPUGraphVector {
51
80
  this.format = props.format;
52
81
  this.length = props.length;
53
82
  this.external = props.external ?? false;
83
+ this.role = props.role;
54
84
  if (props.chunkLengths) {
55
85
  if (props.chunkLengths.some((length) => !Number.isSafeInteger(length) || length < 0) || props.length !== void 0 && props.chunkLengths.reduce((sum, length) => sum + length, 0) !== props.length) {
56
86
  throw new Error(`${props.id} chunk lengths must partition its logical length`);
@@ -64,6 +94,8 @@ class GPUGraphTexture {
64
94
  format;
65
95
  width;
66
96
  height;
97
+ role;
98
+ descriptor;
67
99
  usage;
68
100
  dimension;
69
101
  depth;
@@ -72,6 +104,8 @@ class GPUGraphTexture {
72
104
  /** Caller-owned storage, optionally bound at compilation or supplied when encoding. */
73
105
  external;
74
106
  constructor(props) {
107
+ this.role = props.role;
108
+ this.descriptor = props.descriptor ? gpuGraph.texture(props.descriptor) : void 0;
75
109
  this.id = props.id;
76
110
  this.format = props.format;
77
111
  this.width = props.width;
@@ -97,5 +131,6 @@ class GPUGraphTextureView {
97
131
  GPUGraphScalar,
98
132
  GPUGraphTexture,
99
133
  GPUGraphTextureView,
100
- GPUGraphVector
134
+ GPUGraphVector,
135
+ gpuGraph
101
136
  });
@@ -3,11 +3,49 @@ import type { GraphTextureDescriptor, GraphTextureDimension, GraphTextureViewPro
3
3
  /** Scalar/vector formats portable across current Jarnevon execution backends. */
4
4
  export type GPUGraphScalarFormat = 'float32' | 'uint32' | 'sint32';
5
5
  export type GPUGraphVectorFormat = GPUGraphScalarFormat | `${GPUGraphScalarFormat}x${2 | 3 | 4}`;
6
+ export type GPUGraphValueRole = 'input' | 'state' | 'value';
7
+ export type GPUGraphScalarDescriptor<T extends GPUGraphScalarFormat = GPUGraphScalarFormat> = Readonly<{
8
+ type: 'scalar';
9
+ format: T;
10
+ }>;
11
+ export type GPUGraphVectorDescriptor<T extends GPUGraphVectorFormat = GPUGraphVectorFormat> = Readonly<{
12
+ type: 'vector';
13
+ format: T;
14
+ length?: number;
15
+ chunkLengths?: readonly number[];
16
+ }>;
17
+ export type GPUGraphTextureExtent = Readonly<{
18
+ width: number;
19
+ height: number;
20
+ depth?: number;
21
+ }> | Readonly<{
22
+ like: string;
23
+ scale?: readonly [number, number];
24
+ }>;
25
+ export type GPUGraphTextureDescriptor<Format extends TextureFormat = TextureFormat> = Readonly<{
26
+ type: 'texture';
27
+ format: Format;
28
+ dimension?: GraphTextureDimension;
29
+ extent?: GPUGraphTextureExtent;
30
+ mipLevels?: number;
31
+ samples?: number;
32
+ }>;
33
+ export type GPUGraphValueDescriptor = GPUGraphScalarDescriptor | GPUGraphVectorDescriptor | GPUGraphTextureDescriptor;
34
+ /** Pure logical descriptors: no allocation, device, or registration. */
35
+ export declare const gpuGraph: {
36
+ texture<Format extends TextureFormat>(props: Omit<GPUGraphTextureDescriptor<Format>, "type">): GPUGraphTextureDescriptor<Format>;
37
+ scalar<T extends GPUGraphScalarFormat>(format: T): GPUGraphScalarDescriptor<T>;
38
+ vector<T extends GPUGraphVectorFormat>(format: T, shape?: {
39
+ length?: number;
40
+ chunkLengths?: readonly number[];
41
+ }): GPUGraphVectorDescriptor<T>;
42
+ };
6
43
  /** Backend-independent scalar state owned by a GPUGraph. */
7
44
  export declare class GPUGraphScalar<T extends GPUGraphScalarFormat = GPUGraphScalarFormat> {
45
+ readonly role?: GPUGraphValueRole | undefined;
8
46
  readonly id: string;
9
47
  readonly format: T;
10
- constructor(id: string, format: T);
48
+ constructor(id: string, format: T, role?: GPUGraphValueRole | undefined);
11
49
  }
12
50
  /**
13
51
  * Backend-independent dense one-dimensional value array.
@@ -23,6 +61,7 @@ export declare class GPUGraphVector<T extends GPUGraphVectorFormat = GPUGraphVec
23
61
  /** Optional fixed-length constraint; undefined means execution-sized. */
24
62
  readonly length?: number;
25
63
  readonly external: boolean;
64
+ readonly role?: GPUGraphValueRole;
26
65
  /** Optional physical partition lengths; omitted external topology is supplied by its binding. */
27
66
  readonly chunkLengths?: readonly number[];
28
67
  constructor(props: {
@@ -31,14 +70,17 @@ export declare class GPUGraphVector<T extends GPUGraphVectorFormat = GPUGraphVec
31
70
  length?: number;
32
71
  external?: boolean;
33
72
  chunkLengths?: readonly number[];
73
+ role?: GPUGraphValueRole;
34
74
  });
35
75
  }
36
76
  /** Logical texture storage. Allocation and device validation belong to the graph compiler. */
37
77
  export declare class GPUGraphTexture<Format extends TextureFormat = TextureFormat> {
38
78
  readonly id: string;
39
79
  readonly format: Format;
40
- readonly width: number;
41
- readonly height: number;
80
+ readonly width?: number;
81
+ readonly height?: number;
82
+ readonly role?: GPUGraphValueRole;
83
+ readonly descriptor?: GPUGraphTextureDescriptor<Format>;
42
84
  readonly usage: number;
43
85
  readonly dimension?: GraphTextureDimension;
44
86
  readonly depth?: number;
@@ -46,8 +88,12 @@ export declare class GPUGraphTexture<Format extends TextureFormat = TextureForma
46
88
  readonly samples?: number;
47
89
  /** Caller-owned storage, optionally bound at compilation or supplied when encoding. */
48
90
  readonly external: boolean;
49
- constructor(props: GPUGraphTextureProps<Format> & {
91
+ constructor(props: Omit<GPUGraphTextureProps<Format>, 'width' | 'height'> & {
50
92
  id: string;
93
+ width?: number;
94
+ height?: number;
95
+ role?: GPUGraphValueRole;
96
+ descriptor?: GPUGraphTextureDescriptor<Format>;
51
97
  });
52
98
  }
53
99
  /** Uses the same descriptor vocabulary as GPUCommandGraph; def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,CAAC;QAChB,IAAI,CAAC,EAAE,iBAAiB,CAAC;QACzB,UAAU,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC;KAChD;CAeJ;AAED,oGAAoG;AACpG,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,IAAI,IAAI,CACnF,sBAAsB,CAAC,MAAM,CAAC,EAC9B,IAAI,CACL,GAAG;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAC,CAAC;AAEzB,sFAAsF;AACtF,qBAAa,mBAAmB,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa;IAC3E,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;gBAEpC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,KAAK,GAAE,qBAA0B;CAIhF"}
@@ -1,11 +1,43 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /** Pure logical descriptors: no allocation, device, or registration. */
5
+ export const gpuGraph = {
6
+ texture(props) {
7
+ return Object.freeze({
8
+ ...props,
9
+ type: 'texture',
10
+ ...(props.extent
11
+ ? {
12
+ extent: Object.freeze({
13
+ ...props.extent,
14
+ ...('scale' in props.extent && props.extent.scale
15
+ ? { scale: Object.freeze([...props.extent.scale]) }
16
+ : {})
17
+ })
18
+ }
19
+ : {})
20
+ });
21
+ },
22
+ scalar(format) {
23
+ return Object.freeze({ type: 'scalar', format });
24
+ },
25
+ vector(format, shape = {}) {
26
+ return Object.freeze({
27
+ type: 'vector',
28
+ format,
29
+ ...shape,
30
+ ...(shape.chunkLengths ? { chunkLengths: Object.freeze([...shape.chunkLengths]) } : {})
31
+ });
32
+ }
33
+ };
4
34
  /** Backend-independent scalar state owned by a GPUGraph. */
5
35
  export class GPUGraphScalar {
36
+ role;
6
37
  id;
7
38
  format;
8
- constructor(id, format) {
39
+ constructor(id, format, role) {
40
+ this.role = role;
9
41
  if (!id)
10
42
  throw new Error('GPUGraphScalar id is required');
11
43
  this.id = id;
@@ -26,6 +58,7 @@ export class GPUGraphVector {
26
58
  /** Optional fixed-length constraint; undefined means execution-sized. */
27
59
  length;
28
60
  external;
61
+ role;
29
62
  /** Optional physical partition lengths; omitted external topology is supplied by its binding. */
30
63
  chunkLengths;
31
64
  constructor(props) {
@@ -38,6 +71,7 @@ export class GPUGraphVector {
38
71
  this.format = props.format;
39
72
  this.length = props.length;
40
73
  this.external = props.external ?? false;
74
+ this.role = props.role;
41
75
  if (props.chunkLengths) {
42
76
  if (props.chunkLengths.some(length => !Number.isSafeInteger(length) || length < 0) ||
43
77
  (props.length !== undefined &&
@@ -54,6 +88,8 @@ export class GPUGraphTexture {
54
88
  format;
55
89
  width;
56
90
  height;
91
+ role;
92
+ descriptor;
57
93
  usage;
58
94
  dimension;
59
95
  depth;
@@ -62,6 +98,8 @@ export class GPUGraphTexture {
62
98
  /** Caller-owned storage, optionally bound at compilation or supplied when encoding. */
63
99
  external;
64
100
  constructor(props) {
101
+ this.role = props.role;
102
+ this.descriptor = props.descriptor ? gpuGraph.texture(props.descriptor) : undefined;
65
103
  this.id = props.id;
66
104
  this.format = props.format;
67
105
  this.width = props.width;