@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
@@ -1,12 +1,31 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import { parse } from '@math.gl/expressions';
4
+ import { parse } from '@math.gl/core';
5
5
  import { getGPUVectorFormatInfo } from '@luma.gl/graph/gpu-data';
6
+ import { gpuGraph } from "./gpu-graph-value.js";
6
7
  /** A named, backend-independent numeric expression. Parsing and validation happen at compilation. */
7
8
  export class GPUExpressionOperation {
8
9
  get contract() {
10
+ const expression = parseGPUExpression(this.expression);
11
+ const references = getGPUExpressionReferences(expression);
9
12
  return {
13
+ outputs: ({ getValue }) => {
14
+ const inputs = references.map(name => {
15
+ const value = getValue(name);
16
+ if (value.type === 'texture')
17
+ throw new Error('Numeric expressions cannot read textures');
18
+ return [name, value];
19
+ });
20
+ const format = getGPUExpressionFormat(expression, new Map(inputs.map(([name, value]) => [name, value.format])));
21
+ const vector = inputs.some(([, value]) => value.type === 'vector');
22
+ // A multi-component constant is a one-row vector, not a scalar.
23
+ return {
24
+ [this.output]: vector || !isGPUExpressionFormat(format)
25
+ ? gpuGraph.vector(format, vector ? {} : { length: 1 })
26
+ : gpuGraph.scalar(format)
27
+ };
28
+ },
10
29
  values: [
11
30
  ...getGPUExpressionReferences(parseGPUExpression(this.expression)).map(value => ({
12
31
  value,
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-expression-operation.js","sourceRoot":"","sources":["../../src/gpu-core/gpu-expression-operation.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,KAAK,EAAkB,MAAM,sB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AAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;YACnF,IACE,aAAa,CAAC,IAAI,CAChB,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,CAAC,IAAI,QAAQ,CAAC,UAAU,KAAK,UAAU,CAC5E;gBAED,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;YACtF,OAAO,0BAA0B,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -23,20 +23,29 @@ __export(gpu_expression_plan_exports, {
23
23
  module.exports = __toCommonJS(gpu_expression_plan_exports);
24
24
  var import_core = require("@luma.gl/core");
25
25
  var import_gpu_data = require("@luma.gl/graph/gpu-data");
26
+ var import_gpu_transfer_operation = require("./gpu-transfer-operation.cjs");
27
+ var import_gpu_texture_copy = require("./gpu-texture-copy.cjs");
28
+ var import_gpu_texture_plan = require("./gpu-texture-plan.cjs");
29
+ var import_gpu_graph_declarations = require("./gpu-graph-declarations.cjs");
30
+ var import_gpu_graph_value = require("./gpu-graph-value.cjs");
26
31
  var import_gpu_operation = require("./gpu-operation.cjs");
27
32
  var import_gpu_control_flow_operation = require("./gpu-control-flow-operation.cjs");
28
33
  var import_gpu_expression_operation = require("./gpu-expression-operation.cjs");
29
34
  var import_gpu_operation_contract = require("./gpu-operation-contract.cjs");
30
35
  class GPUExpressionProgram {
31
36
  contracts = /* @__PURE__ */ new Map();
37
+ resultNames;
32
38
  expressions;
33
39
  operations;
34
40
  outputs;
35
41
  scalars;
36
42
  vectors;
43
+ textures;
37
44
  constructor(program, options = {}) {
45
+ program = (0, import_gpu_graph_declarations.resolveGPUGraphDeclarations)(program);
38
46
  this.scalars = program.scalars;
39
47
  this.vectors = program.vectors;
48
+ this.textures = program.textures;
40
49
  const operations = [];
41
50
  const flatten = (operation) => {
42
51
  if (operation instanceof import_gpu_operation.GPUCompositeOperation && operation.type === "composite")
@@ -52,7 +61,7 @@ class GPUExpressionProgram {
52
61
  };
53
62
  program.operations.forEach(flatten);
54
63
  this.operations = operations;
55
- const declarations = new Map([...this.scalars, ...this.vectors].map((value) => [value.id, value]));
64
+ const declarations = new Map([...this.scalars, ...this.vectors, ...this.textures].map((value) => [value.id, value]));
56
65
  const expressions = operations.filter((operation) => operation instanceof import_gpu_expression_operation.GPUExpressionOperation);
57
66
  const scalarProducers = /* @__PURE__ */ new Set();
58
67
  const precedingScalarProducers = /* @__PURE__ */ new Map();
@@ -82,7 +91,10 @@ class GPUExpressionProgram {
82
91
  throw new Error(`Multiple expression writers for ${operation.output}`);
83
92
  producers.add(operation.output);
84
93
  }
85
- const available = new Set([...declarations.keys()].filter((name) => !producers.has(name)));
94
+ const available = new Set([...declarations.keys()].filter((name) => {
95
+ var _a;
96
+ return !producers.has(name) && ((_a = declarations.get(name)) == null ? void 0 : _a.role) !== "value";
97
+ }));
86
98
  const expressionPlans = [];
87
99
  for (const operation of operations) {
88
100
  const contract = this.contracts.get(operation);
@@ -116,7 +128,7 @@ class GPUExpressionProgram {
116
128
  }
117
129
  if (this.scalars.some((scalar) => scalar.id === output.id) && references.some((name) => this.vectors.some((vector) => vector.id === name)))
118
130
  throw new Error(`Vector expression cannot write scalar ${operation.output}`);
119
- if (this.vectors.some((vector) => vector.id === operation.output) && !references.some((name) => this.vectors.some((vector) => vector.id === name)))
131
+ if (this.vectors.some((vector) => vector.id === operation.output) && !references.some((name) => this.vectors.some((vector) => vector.id === name)) && !(output instanceof import_gpu_graph_value.GPUGraphVector && output.role === "value" && output.length !== void 0))
120
132
  throw new Error(`Vector expression ${operation.output} requires a vector input to determine its shape`);
121
133
  const format = (0, import_gpu_expression_operation.getGPUExpressionFormat)(expression, formats);
122
134
  if (output.format !== format)
@@ -131,7 +143,15 @@ class GPUExpressionProgram {
131
143
  }
132
144
  }
133
145
  this.expressions = expressionPlans;
134
- this.outputs = [...options.outputs ?? expressions.map((operation) => operation.output)];
146
+ const producedValues = [...declarations.values()].filter((value) => value.role === "value");
147
+ this.resultNames = new Set([...this.contracts.values()].flatMap((contract) => contract.values.filter((use) => use.access !== "read").map((use) => (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value))).filter((name) => {
148
+ var _a, _b;
149
+ return ((_a = declarations.get(name)) == null ? void 0 : _a.role) !== "input" && ((_b = declarations.get(name)) == null ? void 0 : _b.role) !== "state";
150
+ }));
151
+ const consumed = new Set([...this.contracts.values()].flatMap((contract) => contract.values.filter((use) => use.access !== "write").map((use) => (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value))));
152
+ this.outputs = [
153
+ ...options.outputs ?? (producedValues.length ? [...this.resultNames].filter((name) => !consumed.has(name)) : expressions.map((operation) => operation.output))
154
+ ];
135
155
  for (const name of this.outputs) {
136
156
  if (!declarations.has(name))
137
157
  throw new Error(`Undeclared output ${name}`);
@@ -139,17 +159,86 @@ class GPUExpressionProgram {
139
159
  throw new Error(`Selected scalar ${name} must be produced by a graph operation`);
140
160
  }
141
161
  }
142
- prepare(device, bindings, options = {}) {
162
+ resolveBindings(supplied, options = {}) {
143
163
  var _a;
164
+ const declarations = [...this.scalars, ...this.vectors, ...this.textures];
165
+ const explicit = declarations.some((value) => value.role === "input" || value.role === "state");
166
+ const grouped = explicit || Object.values(supplied).some((value) => value !== void 0 && typeof value === "object" && !(value instanceof import_gpu_data.GPUVector) && !(value instanceof import_core.Texture) && !(value instanceof import_core.TextureView));
167
+ if (!grouped) {
168
+ for (const name of Object.keys(supplied))
169
+ if (((_a = declarations.find((value) => value.id === name)) == null ? void 0 : _a.role) === "value")
170
+ throw new Error(`Use outputTargets for graph result ${name}`);
171
+ return { bindings: supplied, options };
172
+ }
173
+ for (const name of Object.keys(supplied))
174
+ if (!["inputs", "state", "outputTargets"].includes(name))
175
+ throw new Error(`Unknown execution option ${name}`);
176
+ const execution = supplied;
177
+ const bindings = /* @__PURE__ */ Object.create(null);
178
+ for (const [role, group] of [
179
+ ["input", execution.inputs],
180
+ ["state", execution.state]
181
+ ]) {
182
+ for (const [name, value] of Object.entries(group ?? {})) {
183
+ const declaration = declarations.find((value2) => value2.id === name);
184
+ const bindingRole = (declaration == null ? void 0 : declaration.role) ?? (this.resultNames.has(name) ? "value" : "input");
185
+ if (!declaration || bindingRole !== role)
186
+ throw new Error(`Invalid ${role} binding ${name}`);
187
+ bindings[name] = value;
188
+ }
189
+ }
190
+ for (const declaration of declarations)
191
+ if ((declaration.role === "input" || declaration.role === "state") && bindings[declaration.id] === void 0)
192
+ throw new Error(`Missing ${declaration.role} binding ${declaration.id}`);
193
+ if (options.outputTargets && execution.outputTargets)
194
+ throw new Error("Duplicate output targets");
195
+ const outputTargets = execution.outputTargets ?? options.outputTargets;
196
+ for (const name of Object.keys(outputTargets ?? {}))
197
+ if (!this.resultNames.has(name) || !this.outputs.includes(name))
198
+ throw new Error(`Invalid graph output target ${name}`);
199
+ return { bindings, options: { outputTargets } };
200
+ }
201
+ prepare(device, bindings, options = {}, deferIntermediateStorage = false) {
202
+ var _a;
203
+ const textures = new import_gpu_texture_plan.GPUTextureInvocation(device, this.textures, [...this.contracts.values()], bindings, options.outputTargets ?? {});
144
204
  const values = /* @__PURE__ */ new Map();
145
205
  const owned = /* @__PURE__ */ new Set();
206
+ const transientVectors = /* @__PURE__ */ new Map();
207
+ const deferStorage = deferIntermediateStorage && !this.operations.some((operation) => operation instanceof import_gpu_operation.GPUCompositeOperation);
208
+ const getShape = (name) => {
209
+ const value = values.get(name);
210
+ return value instanceof import_gpu_data.GPUVector ? { length: value.length, chunkLengths: value.data.map((chunk) => chunk.length) } : transientVectors.get(name);
211
+ };
212
+ const allocateOutput = (name, chunkLengths, format) => {
213
+ if (deferStorage && !this.outputs.includes(name) && this.vectors.some((vector) => vector.id === name && vector.role === "value")) {
214
+ transientVectors.set(name, {
215
+ length: chunkLengths.reduce((sum, count) => sum + count, 0),
216
+ chunkLengths
217
+ });
218
+ } else {
219
+ const output = allocateVector(device, name, chunkLengths, format);
220
+ owned.add(output);
221
+ values.set(name, output);
222
+ }
223
+ };
146
224
  const produced = new Set(this.expressions.map((plan) => plan.operation.output));
147
- const targets = new Map(Object.entries(options.outputTargets ?? {}));
225
+ const targets = /* @__PURE__ */ new Map();
226
+ for (const [name, target] of Object.entries(options.outputTargets ?? {})) {
227
+ if (this.textures.some((texture) => texture.id === name))
228
+ continue;
229
+ if (!(target instanceof import_gpu_data.GPUVector)) {
230
+ textures.destroy();
231
+ throw new Error(`Expected GPUVector ${name}`);
232
+ }
233
+ targets.set(name, target);
234
+ }
148
235
  const writableVectors = new Set([...this.contracts.values()].flatMap((contract) => contract.values.filter((use) => use.access !== "read" && this.vectors.some((vector) => vector.id === (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value))).map((use) => (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value))));
149
236
  const availableScalars = /* @__PURE__ */ new Set();
150
237
  const readVectors = /* @__PURE__ */ new Set();
151
238
  try {
152
239
  for (const [name, binding] of Object.entries(bindings)) {
240
+ if (this.textures.some((texture) => texture.id === name))
241
+ continue;
153
242
  if (produced.has(name))
154
243
  throw new Error(`Use outputTargets for expression output ${name}`);
155
244
  const scalar = this.scalars.find((value) => value.id === name);
@@ -168,6 +257,8 @@ class GPUExpressionProgram {
168
257
  values.set(name, binding);
169
258
  }
170
259
  for (const operation of this.operations) {
260
+ if (operation instanceof import_gpu_transfer_operation.GPUCopyOperation && textures.values.has(operation.input))
261
+ (0, import_gpu_texture_copy.validateTextureCopy)(textures.values.get(operation.input), textures.values.get(operation.output));
171
262
  for (const use of ((_a = this.contracts.get(operation)) == null ? void 0 : _a.values) ?? []) {
172
263
  const name = (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value);
173
264
  if (use.access !== "write" && values.get(name) instanceof import_gpu_data.GPUVector)
@@ -177,7 +268,7 @@ class GPUExpressionProgram {
177
268
  const contract = this.contracts.get(operation);
178
269
  for (const use of (contract == null ? void 0 : contract.values) ?? []) {
179
270
  const name = (0, import_gpu_operation_contract.getGPUOperationValueName)(use.value);
180
- if (use.access !== "write" && !values.has(name) && !availableScalars.has(name))
271
+ if (use.access !== "write" && !values.has(name) && !textures.values.has(name) && !transientVectors.has(name) && !availableScalars.has(name))
181
272
  throw new Error(`Missing ${use.access === "read-write" ? "read-write" : "execution"} binding ${name}`);
182
273
  }
183
274
  for (const use of (contract == null ? void 0 : contract.values) ?? []) {
@@ -197,10 +288,10 @@ class GPUExpressionProgram {
197
288
  const existing = values.get(declaration2.id);
198
289
  const target2 = targets.get(declaration2.id) ?? (existing instanceof import_gpu_data.GPUVector ? existing : void 0);
199
290
  const shape = use.shape;
200
- const template2 = shape && "like" in shape ? values.get((0, import_gpu_operation_contract.getGPUOperationValueName)(shape.like)) : void 0;
201
- if (shape && "like" in shape && !(template2 instanceof import_gpu_data.GPUVector))
291
+ const template2 = shape && "like" in shape ? getShape((0, import_gpu_operation_contract.getGPUOperationValueName)(shape.like)) : void 0;
292
+ if (shape && "like" in shape && !template2)
202
293
  throw new Error(`Missing shape input ${(0, import_gpu_operation_contract.getGPUOperationValueName)(shape.like)}`);
203
- const chunks = template2 instanceof import_gpu_data.GPUVector ? template2.data.map((chunk) => chunk.length) : shape && "length" in shape ? shape.chunkLengths ?? declaration2.chunkLengths ?? [shape.length] : declaration2.chunkLengths ?? (declaration2.length === void 0 ? void 0 : [declaration2.length]);
294
+ const chunks = template2 ? template2.chunkLengths : shape && "length" in shape ? shape.chunkLengths ?? declaration2.chunkLengths ?? [shape.length] : declaration2.chunkLengths ?? (declaration2.length === void 0 ? void 0 : [declaration2.length]);
204
295
  if (use.access === "read-write" && !(existing instanceof import_gpu_data.GPUVector))
205
296
  throw new Error(`Missing read-write binding ${declaration2.id}`);
206
297
  if (use.access === "read-write" && target2 !== existing)
@@ -219,9 +310,7 @@ class GPUExpressionProgram {
219
310
  validateWritableTarget(declaration2.id, target2, values);
220
311
  values.set(declaration2.id, target2);
221
312
  } else {
222
- const output = allocateVector(device, declaration2.id, chunks, declaration2.format);
223
- owned.add(output);
224
- values.set(declaration2.id, output);
313
+ allocateOutput(declaration2.id, chunks, declaration2.format);
225
314
  }
226
315
  }
227
316
  continue;
@@ -230,18 +319,19 @@ class GPUExpressionProgram {
230
319
  const vectorInputs = [];
231
320
  for (const name of plan.references) {
232
321
  const value = values.get(name);
233
- if (value === void 0 && !plan.gpuScalarInputs.includes(name))
322
+ if (value === void 0 && !transientVectors.has(name) && !plan.gpuScalarInputs.includes(name))
234
323
  throw new Error(`Missing execution binding ${name}`);
235
- if (value instanceof import_gpu_data.GPUVector && this.vectors.some((vector) => vector.id === name))
236
- vectorInputs.push(value);
324
+ const shape = getShape(name);
325
+ if (shape && this.vectors.some((vector) => vector.id === name))
326
+ vectorInputs.push(shape);
237
327
  }
238
328
  const declaration = this.vectors.find((value) => value.id === plan.operation.output);
239
329
  const template = vectorInputs[0];
240
- const chunkLengths = declaration ? (template == null ? void 0 : template.data.map((chunk) => chunk.length)) ?? declaration.chunkLengths ?? (declaration.length === void 0 ? void 0 : [declaration.length]) : [1];
330
+ const chunkLengths = declaration ? (template == null ? void 0 : template.chunkLengths) ?? declaration.chunkLengths ?? (declaration.length === void 0 ? void 0 : [declaration.length]) : [1];
241
331
  if (!chunkLengths)
242
332
  throw new Error(`Cannot infer length of ${plan.operation.output}`);
243
333
  for (const vector of vectorInputs) {
244
- if (vector.data.length !== chunkLengths.length || vector.data.some((chunk, index) => chunk.length !== chunkLengths[index]))
334
+ if (vector.chunkLengths.length !== chunkLengths.length || vector.chunkLengths.some((length2, index) => length2 !== chunkLengths[index]))
245
335
  throw new Error(`Expression ${plan.operation.id} requires matching vector chunk boundaries`);
246
336
  }
247
337
  const length = chunkLengths.reduce((total, count) => total + count, 0);
@@ -255,24 +345,31 @@ class GPUExpressionProgram {
255
345
  validateWritableTarget(plan.operation.output, target, values);
256
346
  values.set(plan.operation.output, target);
257
347
  } else {
258
- const output = allocateVector(device, plan.operation.output, chunkLengths, plan.format);
259
- owned.add(output);
260
- values.set(plan.operation.output, output);
348
+ allocateOutput(plan.operation.output, chunkLengths, plan.format);
261
349
  }
262
350
  }
263
351
  for (const name of Object.keys(options.outputTargets ?? {})) {
264
- if (!produced.has(name) && !writableVectors.has(name))
352
+ const scalarOutput = this.outputs.includes(name) && this.scalars.some((scalar) => scalar.id === name);
353
+ if (!produced.has(name) && !writableVectors.has(name) && !scalarOutput && !this.textures.some((texture) => texture.id === name && texture.role === "value"))
265
354
  throw new Error(`Unknown graph output target ${name}`);
266
355
  }
267
356
  for (const name of this.outputs) {
268
357
  if (!(values.get(name) instanceof import_gpu_data.GPUVector) && this.scalars.some((scalar) => scalar.id === name)) {
358
+ const target = targets.get(name);
359
+ if (target) {
360
+ validateVector(device, target, this.scalars.find((scalar) => scalar.id === name).format, 1, [1]);
361
+ validateWritableTarget(name, target, values);
362
+ values.set(name, target);
363
+ continue;
364
+ }
269
365
  const output = allocateVector(device, name, [1], this.scalars.find((scalar) => scalar.id === name).format);
270
366
  owned.add(output);
271
367
  values.set(name, output);
272
368
  }
273
369
  }
274
- return new GPUExpressionInvocation(this, values, owned);
370
+ return new GPUExpressionInvocation(this, values, owned, transientVectors, textures);
275
371
  } catch (error) {
372
+ textures.destroy();
276
373
  for (const vector of owned)
277
374
  vector.destroy();
278
375
  throw error;
@@ -308,25 +405,39 @@ class GPUExpressionInvocation {
308
405
  program;
309
406
  values;
310
407
  owned;
311
- constructor(program, values, owned) {
408
+ transientVectors;
409
+ textures;
410
+ constructor(program, values, owned, transientVectors = /* @__PURE__ */ new Map(), textures) {
312
411
  this.program = program;
313
412
  this.values = values;
314
413
  this.owned = owned;
414
+ this.transientVectors = transientVectors;
415
+ this.textures = textures;
315
416
  }
316
- finish() {
417
+ getOutputs() {
418
+ var _a;
317
419
  const outputs = /* @__PURE__ */ Object.create(null);
318
420
  for (const name of this.program.outputs) {
319
- const value = this.values.get(name);
320
- if (!(value instanceof import_gpu_data.GPUVector))
321
- throw new Error(`Output ${name} has no materialized vector`);
421
+ const value = ((_a = this.textures) == null ? void 0 : _a.values.get(name)) ?? this.values.get(name);
422
+ if (!(value instanceof import_gpu_data.GPUVector || value instanceof import_core.Texture || value instanceof import_core.TextureView))
423
+ throw new Error(`Output ${name} has no materialized resource`);
322
424
  outputs[name] = value;
323
425
  }
426
+ return outputs;
427
+ }
428
+ finish() {
429
+ var _a;
430
+ const outputs = this.getOutputs();
324
431
  for (const value of Object.values(outputs))
325
- this.owned.delete(value);
432
+ if (value instanceof import_gpu_data.GPUVector)
433
+ this.owned.delete(value);
434
+ (_a = this.textures) == null ? void 0 : _a.finish(this.program.outputs);
326
435
  this.destroy();
327
436
  return outputs;
328
437
  }
329
438
  destroy() {
439
+ var _a;
440
+ (_a = this.textures) == null ? void 0 : _a.destroy();
330
441
  for (const vector of this.owned)
331
442
  vector.destroy();
332
443
  this.owned.clear();
@@ -1,17 +1,24 @@
1
1
  import { type Device } from '@luma.gl/core';
2
2
  import { GPUVector } from '@luma.gl/graph/gpu-data';
3
3
  import type { GPUGraph } from "./gpu-graph.js";
4
+ import { GPUTextureInvocation, type GPUGraphTextureBinding, type GPUGraphOutput, type GPUGraphOutputs } from "./gpu-texture-plan.js";
5
+ import type { GPUGraphTexture } from "./gpu-graph-value.js";
4
6
  import { GPUGraphVector, type GPUGraphScalar } from "./gpu-graph-value.js";
5
7
  import { type GPUGraphOperation } from "./gpu-operation.js";
6
8
  import { GPUExpressionOperation, type GPUExpression, type GPUExpressionRowFormat } from "./gpu-expression-operation.js";
7
9
  import type { GPUOperationLowering } from "./gpu-graph-lowering.js";
8
- export type GPUGraphRunBindings = Readonly<Record<string, GPUVector | number>>;
10
+ export type GPUGraphRunBindings = Readonly<Record<string, GPUVector | number | GPUGraphTextureBinding>>;
11
+ export type GPUGraphExecutionBindings = {
12
+ inputs?: GPUGraphRunBindings;
13
+ state?: Readonly<Record<string, GPUVector>>;
14
+ outputTargets?: Readonly<Record<string, GPUGraphOutput>>;
15
+ };
9
16
  export type GPUGraphCompileOptions = {
10
17
  outputs?: readonly string[];
11
18
  lowerings?: readonly GPUOperationLowering[];
12
19
  };
13
20
  export type GPUGraphRunOptions = {
14
- outputTargets?: Readonly<Record<string, GPUVector>>;
21
+ outputTargets?: Readonly<Record<string, GPUGraphOutput>>;
15
22
  };
16
23
  /** @internal */
17
24
  export type GPUExpressionPlan = {
@@ -22,24 +29,38 @@ export type GPUExpressionPlan = {
22
29
  references: readonly string[];
23
30
  gpuScalarInputs: readonly string[];
24
31
  };
32
+ /** CPU-known dimensions for an unallocated operation result. @internal */
33
+ export type GPUExpressionVectorShape = {
34
+ length: number;
35
+ chunkLengths: readonly number[];
36
+ };
25
37
  /** Snapshot of declarations and checked expressions; contains no bound resources. @internal */
26
38
  export declare class GPUExpressionProgram {
27
39
  private readonly contracts;
40
+ private readonly resultNames;
28
41
  readonly expressions: readonly GPUExpressionPlan[];
29
42
  readonly operations: readonly GPUGraphOperation[];
30
43
  readonly outputs: readonly string[];
31
44
  readonly scalars: readonly GPUGraphScalar[];
32
45
  readonly vectors: readonly GPUGraphVector[];
46
+ readonly textures: readonly GPUGraphTexture[];
33
47
  constructor(program: GPUGraph, options?: GPUGraphCompileOptions);
34
- prepare(device: Device, bindings: GPUGraphRunBindings, options?: GPUGraphRunOptions): GPUExpressionInvocation;
48
+ resolveBindings(supplied: GPUGraphRunBindings | GPUGraphExecutionBindings, options?: GPUGraphRunOptions): {
49
+ bindings: GPUGraphRunBindings;
50
+ options: GPUGraphRunOptions;
51
+ };
52
+ prepare(device: Device, bindings: GPUGraphRunBindings, options?: GPUGraphRunOptions, deferIntermediateStorage?: boolean): GPUExpressionInvocation;
35
53
  }
36
54
  /** Per-run owned storage; selected outputs transfer to the caller after successful execution. @internal */
37
55
  export declare class GPUExpressionInvocation {
38
56
  readonly program: GPUExpressionProgram;
39
57
  readonly values: Map<string, GPUVector | number>;
40
58
  private readonly owned;
41
- constructor(program: GPUExpressionProgram, values: Map<string, GPUVector | number>, owned: Set<GPUVector>);
42
- finish(): Record<string, GPUVector>;
59
+ readonly transientVectors: ReadonlyMap<string, GPUExpressionVectorShape>;
60
+ readonly textures?: GPUTextureInvocation | undefined;
61
+ constructor(program: GPUExpressionProgram, values: Map<string, GPUVector | number>, owned: Set<GPUVector>, transientVectors?: ReadonlyMap<string, GPUExpressionVectorShape>, textures?: GPUTextureInvocation | undefined);
62
+ getOutputs<Outputs extends GPUGraphOutputs = Record<string, GPUVector>>(): Outputs;
63
+ finish<Outputs extends GPUGraphOutputs = Record<string, GPUVector>>(): Outputs;
43
64
  destroy(): void;
44
65
  }
45
66
  //# sourceMappingURL=gpu-expression-plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-expression-plan.d.ts","sourceRoot":"","sources":["../../src/gpu-core/gpu-expression-plan.ts"],"names":[],"mappings":"AAIA,OAAO,EAAS,KAAK,MAAM,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAU,SAAS,EAAyB,MAAM,yBAAyB,CAAC;AACnF,OAAO,KAAK,EAAC,QAAQ,EAAC,uBAAoB;AAC1C,OAAO,EAAC,cAAc,EAAE,KAAK,cAAc,EAA4B,6BAA0B;AACjG,OAAO,EAAwC,KAAK,iBAAiB,EAAC,2BAAwB;AAE9F,OAAO,EACL,sBAAsB,EAGtB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAI5B,sCAAmC;AAEpC,OAAO,KAAK,EAAC,oBAAoB,EAAC,gCAA6B;AAO/D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC7C,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG;IAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;CAAC,CAAC;AAEvF,gBAA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