@luma.gl/graph 10.0.0-beta.1 → 10.0.0-beta.2

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 (327) hide show
  1. package/dist/experimental-models.cjs +21 -0
  2. package/dist/experimental-models.d.ts +2 -0
  3. package/dist/experimental-models.d.ts.map +1 -0
  4. package/dist/experimental-models.js +5 -0
  5. package/dist/experimental-models.js.map +1 -0
  6. package/dist/experimental-simulation.cjs +21 -0
  7. package/dist/experimental-simulation.d.ts +2 -0
  8. package/dist/experimental-simulation.d.ts.map +1 -0
  9. package/dist/experimental-simulation.js +5 -0
  10. package/dist/experimental-simulation.js.map +1 -0
  11. package/dist/gpu-dataframe/gpu-data-frame-query.cjs +7 -3
  12. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
  13. package/dist/gpu-dataframe/gpu-data-frame-query.js +14 -4
  14. package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
  15. package/dist/gpu-dataframe/gpu-expression-shader.cjs +87 -5
  16. package/dist/gpu-dataframe/gpu-expression-shader.d.ts +2 -1
  17. package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
  18. package/dist/gpu-dataframe/gpu-expression-shader.js +101 -5
  19. package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
  20. package/dist/gpu-dataframe/gpu-expression.cjs +86 -0
  21. package/dist/gpu-dataframe/gpu-expression.d.ts +23 -2
  22. package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
  23. package/dist/gpu-dataframe/gpu-expression.js +81 -0
  24. package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
  25. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +0 -1
  26. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  27. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +0 -1
  28. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  29. package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
  30. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
  31. package/dist/gpu-dataframe/gpu-global-aggregation-query.js +5 -3
  32. package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
  33. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +23 -11
  34. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +1 -1
  35. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  36. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +24 -12
  37. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  38. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +0 -1
  39. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  40. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +0 -1
  41. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  42. package/dist/gpu-dataframe/gpu-group-by-query.cjs +2 -2
  43. package/dist/gpu-dataframe/gpu-group-by-query.js +5 -3
  44. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  45. package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
  46. package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
  47. package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
  48. package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
  49. package/dist/gpu-dataframe/gpu-join-compiler.cjs +0 -2
  50. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  51. package/dist/gpu-dataframe/gpu-join-compiler.js +0 -2
  52. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  53. package/dist/gpu-dataframe/gpu-query-compiler.cjs +3 -1
  54. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +0 -1
  55. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  56. package/dist/gpu-dataframe/gpu-query-compiler.js +3 -1
  57. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  58. package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
  59. package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
  60. package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
  61. package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
  62. package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
  63. package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
  64. package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
  65. package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
  66. package/dist/gpu-dataframe/gpu-sort-query.js.map +1 -1
  67. package/dist/gpu-dataframe/index.cjs +8 -0
  68. package/dist/gpu-dataframe/index.cjs.map +2 -2
  69. package/dist/gpu-dataframe/index.d.ts +2 -2
  70. package/dist/gpu-dataframe/index.d.ts.map +1 -1
  71. package/dist/gpu-dataframe/index.js +1 -1
  72. package/dist/gpu-dataframe/index.js.map +1 -1
  73. package/dist/gpu-dataframe/portable-expression.cjs +68 -4
  74. package/dist/gpu-dataframe/portable-expression.d.ts +3 -1
  75. package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -1
  76. package/dist/gpu-dataframe/portable-expression.js +69 -5
  77. package/dist/gpu-dataframe/portable-expression.js.map +1 -1
  78. package/dist/gpu-dggs-benchmarks.cjs +21 -0
  79. package/dist/gpu-dggs-benchmarks.d.ts +2 -0
  80. package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
  81. package/dist/gpu-dggs-benchmarks.js +5 -0
  82. package/dist/gpu-dggs-benchmarks.js.map +1 -0
  83. package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
  84. package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
  85. package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
  86. package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
  87. package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
  88. package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
  89. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
  90. package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
  91. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
  92. package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
  93. package/dist/gpu-physics/gpu-physics-ensemble.cjs +97 -5
  94. package/dist/gpu-physics/gpu-physics-ensemble.d.ts +31 -2
  95. package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
  96. package/dist/gpu-physics/gpu-physics-ensemble.js +99 -3
  97. package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
  98. package/dist/gpu-physics/gpu-rigid-body-world.cjs +483 -152
  99. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +64 -3
  100. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  101. package/dist/gpu-physics/gpu-rigid-body-world.js +523 -161
  102. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  103. package/dist/gpu-physics/index.cjs +23 -2
  104. package/dist/gpu-physics/index.cjs.map +3 -3
  105. package/dist/gpu-physics/index.d.ts +8 -2
  106. package/dist/gpu-physics/index.d.ts.map +1 -1
  107. package/dist/gpu-physics/index.js +6 -1
  108. package/dist/gpu-physics/index.js.map +1 -1
  109. package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
  110. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
  111. package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
  112. package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
  113. package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
  114. package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
  115. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
  116. package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
  117. package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
  118. package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
  119. package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +36 -7
  120. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
  121. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
  122. package/dist/gpu-physics/rigid-body-ensemble-reset.js +42 -7
  123. package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
  124. package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +23 -1
  125. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +4 -1
  126. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
  127. package/dist/gpu-physics/rigid-body-ensemble-transaction.js +25 -1
  128. package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
  129. package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
  130. package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
  131. package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
  132. package/dist/gpu-physics/rigid-body-geometry.js +44 -3
  133. package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
  134. package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
  135. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
  136. package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
  137. package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
  138. package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
  139. package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
  140. package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
  141. package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
  142. package/dist/gpu-physics/rigid-body-height-field.js +184 -0
  143. package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
  144. package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
  145. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
  146. package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
  147. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
  148. package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
  149. package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
  150. package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
  151. package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
  152. package/dist/gpu-physics/rigid-body-mesh.js +76 -20
  153. package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
  154. package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
  155. package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
  156. package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
  157. package/dist/gpu-physics/rigid-body-properties.js +1 -1
  158. package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
  159. package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
  160. package/dist/gpu-physics/rigid-body-publication.js +1 -1
  161. package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
  162. package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
  163. package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
  164. package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
  165. package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
  166. package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
  167. package/dist/gpu-physics/rigid-body-shaders.cjs +11 -5
  168. package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
  169. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  170. package/dist/gpu-physics/rigid-body-shaders.js +14 -6
  171. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  172. package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
  173. package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
  174. package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
  175. package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
  176. package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
  177. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
  178. package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
  179. package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
  180. package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
  181. package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
  182. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
  183. package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
  184. package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
  185. package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
  186. package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
  187. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
  188. package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
  189. package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
  190. package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
  191. package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
  192. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
  193. package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
  194. package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
  195. package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
  196. package/dist/gpu-physics/rigid-body-triggers.cjs +1 -0
  197. package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
  198. package/dist/gpu-physics/rigid-body-triggers.js +1 -0
  199. package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
  200. package/dist/gpu-physics/rigid-body-vehicle.cjs +99 -44
  201. package/dist/gpu-physics/rigid-body-vehicle.d.ts +15 -3
  202. package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -1
  203. package/dist/gpu-physics/rigid-body-vehicle.js +93 -40
  204. package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -1
  205. package/dist/gpu-project/cpu-geometry-pipelines.d.ts +1 -1
  206. package/dist/gpu-project/cpu-projection-operation.d.ts +1 -1
  207. package/dist/gpu-project/crs.cjs.map +2 -2
  208. package/dist/gpu-project/crs.d.ts +1 -1
  209. package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
  210. package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
  211. package/dist/gpu-project/projection-crs-benchmark.js +1 -1
  212. package/dist/gpu-project/projection-crs-input.cjs +7 -7
  213. package/dist/gpu-project/projection-crs-input.d.ts +1 -1
  214. package/dist/gpu-project/projection-crs-input.js +4 -4
  215. package/dist/gpu-project/projection-engine.d.ts +2 -2
  216. package/dist/gpu-project-benchmarks.cjs +21 -0
  217. package/dist/gpu-project-benchmarks.d.ts +2 -0
  218. package/dist/gpu-project-benchmarks.d.ts.map +1 -0
  219. package/dist/gpu-project-benchmarks.js +5 -0
  220. package/dist/gpu-project-benchmarks.js.map +1 -0
  221. package/dist/gpu-project-crs.cjs +21 -0
  222. package/dist/gpu-project-crs.d.ts +2 -0
  223. package/dist/gpu-project-crs.d.ts.map +1 -0
  224. package/dist/gpu-project-crs.js +5 -0
  225. package/dist/gpu-project-crs.js.map +1 -0
  226. package/dist/gpu-project-geoarrow.cjs +21 -0
  227. package/dist/gpu-project-geoarrow.d.ts +2 -0
  228. package/dist/gpu-project-geoarrow.d.ts.map +1 -0
  229. package/dist/gpu-project-geoarrow.js +5 -0
  230. package/dist/gpu-project-geoarrow.js.map +1 -0
  231. package/dist/gpu-project-graph.cjs +21 -0
  232. package/dist/gpu-project-graph.d.ts +2 -0
  233. package/dist/gpu-project-graph.d.ts.map +1 -0
  234. package/dist/gpu-project-graph.js +5 -0
  235. package/dist/gpu-project-graph.js.map +1 -0
  236. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
  237. package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
  238. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
  239. package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
  240. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +1 -1
  241. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
  242. package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
  243. package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
  244. package/dist/gpu-simple-graph-cpu.cjs +21 -0
  245. package/dist/gpu-simple-graph-cpu.d.ts +2 -0
  246. package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
  247. package/dist/gpu-simple-graph-cpu.js +5 -0
  248. package/dist/gpu-simple-graph-cpu.js.map +1 -0
  249. package/dist/gpu-simple-graph-webgl.cjs +21 -0
  250. package/dist/gpu-simple-graph-webgl.d.ts +2 -0
  251. package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
  252. package/dist/gpu-simple-graph-webgl.js +5 -0
  253. package/dist/gpu-simple-graph-webgl.js.map +1 -0
  254. package/dist/gpu-simple-graph-webgpu.cjs +21 -0
  255. package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
  256. package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
  257. package/dist/gpu-simple-graph-webgpu.js +5 -0
  258. package/dist/gpu-simple-graph-webgpu.js.map +1 -0
  259. package/dist/gpu-sql/gpu-sql.cjs +76 -122
  260. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  261. package/dist/gpu-sql/gpu-sql.js +99 -130
  262. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  263. package/dist/gpu-sql/index.cjs.map +2 -2
  264. package/package.json +19 -19
  265. package/src/experimental-models.ts +5 -0
  266. package/src/experimental-simulation.ts +5 -0
  267. package/src/gpu-dataframe/gpu-data-frame-query.ts +18 -5
  268. package/src/gpu-dataframe/gpu-expression-shader.ts +128 -7
  269. package/src/gpu-dataframe/gpu-expression.ts +124 -1
  270. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +0 -1
  271. package/src/gpu-dataframe/gpu-global-aggregation-query.ts +5 -3
  272. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +26 -12
  273. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +0 -1
  274. package/src/gpu-dataframe/gpu-group-by-query.ts +5 -3
  275. package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
  276. package/src/gpu-dataframe/gpu-join-compiler.ts +0 -2
  277. package/src/gpu-dataframe/gpu-query-compiler.ts +3 -3
  278. package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
  279. package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
  280. package/src/gpu-dataframe/index.ts +15 -2
  281. package/src/gpu-dataframe/portable-expression.ts +81 -4
  282. package/src/gpu-dggs-benchmarks.ts +5 -0
  283. package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
  284. package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
  285. package/src/gpu-physics/gpu-physics-ensemble.ts +147 -4
  286. package/src/gpu-physics/gpu-rigid-body-world.ts +668 -198
  287. package/src/gpu-physics/index.ts +37 -0
  288. package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
  289. package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
  290. package/src/gpu-physics/rigid-body-ensemble-reset.ts +48 -8
  291. package/src/gpu-physics/rigid-body-ensemble-transaction.ts +34 -1
  292. package/src/gpu-physics/rigid-body-geometry.ts +49 -4
  293. package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
  294. package/src/gpu-physics/rigid-body-height-field.ts +257 -0
  295. package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
  296. package/src/gpu-physics/rigid-body-mesh.ts +97 -26
  297. package/src/gpu-physics/rigid-body-properties.ts +5 -2
  298. package/src/gpu-physics/rigid-body-publication.ts +1 -1
  299. package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
  300. package/src/gpu-physics/rigid-body-shaders.ts +17 -6
  301. package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
  302. package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
  303. package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
  304. package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
  305. package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
  306. package/src/gpu-physics/rigid-body-triggers.ts +1 -0
  307. package/src/gpu-physics/rigid-body-vehicle.ts +108 -41
  308. package/src/gpu-project/README.md +2 -2
  309. package/src/gpu-project/cpu-geometry-pipelines.ts +1 -1
  310. package/src/gpu-project/cpu-projection-operation.ts +1 -1
  311. package/src/gpu-project/crs.ts +2 -2
  312. package/src/gpu-project/projection-crs-benchmark.ts +2 -2
  313. package/src/gpu-project/projection-crs-input.ts +4 -4
  314. package/src/gpu-project/projection-engine.ts +2 -2
  315. package/src/gpu-project-benchmarks.ts +5 -0
  316. package/src/gpu-project-crs.ts +5 -0
  317. package/src/gpu-project-geoarrow.ts +5 -0
  318. package/src/gpu-project-graph.ts +5 -0
  319. package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
  320. package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
  321. package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +1 -1
  322. package/src/gpu-simple-graph/operation/operation.ts +1 -1
  323. package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
  324. package/src/gpu-simple-graph-cpu.ts +5 -0
  325. package/src/gpu-simple-graph-webgl.ts +5 -0
  326. package/src/gpu-simple-graph-webgpu.ts +5 -0
  327. package/src/gpu-sql/gpu-sql.ts +150 -152
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "10.0.0-beta.1",
6
+ "version": "10.0.0-beta.2",
7
7
  "type": "module",
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -60,7 +60,7 @@
60
60
  "import": "./dist/gpu-graph/index.js",
61
61
  "require": "./dist/gpu-graph/index.cjs"
62
62
  },
63
- "./gpu-graph-algorithms/benchmarks": {
63
+ "./gpu-graph-algorithms-benchmarks": {
64
64
  "types": "./dist/gpu-graph-algorithms/benchmarks.d.ts",
65
65
  "import": "./dist/gpu-graph-algorithms/benchmarks.js",
66
66
  "require": "./dist/gpu-graph-algorithms/benchmarks.cjs"
@@ -75,7 +75,7 @@
75
75
  "import": "./dist/gpu-dggs/index.js",
76
76
  "require": "./dist/gpu-dggs/index.cjs"
77
77
  },
78
- "./gpu-dggs/benchmarks": {
78
+ "./gpu-dggs-benchmarks": {
79
79
  "types": "./dist/gpu-dggs/benchmarks.d.ts",
80
80
  "import": "./dist/gpu-dggs/benchmarks.js",
81
81
  "require": "./dist/gpu-dggs/benchmarks.cjs"
@@ -135,22 +135,22 @@
135
135
  "import": "./dist/gpu-project/index.js",
136
136
  "require": "./dist/gpu-project/index.cjs"
137
137
  },
138
- "./gpu-project/benchmarks": {
138
+ "./gpu-project-benchmarks": {
139
139
  "types": "./dist/gpu-project/benchmarks.d.ts",
140
140
  "import": "./dist/gpu-project/benchmarks.js",
141
141
  "require": "./dist/gpu-project/benchmarks.cjs"
142
142
  },
143
- "./gpu-project/geoarrow": {
143
+ "./gpu-project-geoarrow": {
144
144
  "types": "./dist/gpu-project/geoarrow.d.ts",
145
145
  "import": "./dist/gpu-project/geoarrow.js",
146
146
  "require": "./dist/gpu-project/geoarrow.cjs"
147
147
  },
148
- "./gpu-project/graph": {
148
+ "./gpu-project-graph": {
149
149
  "types": "./dist/gpu-project/graph.d.ts",
150
150
  "import": "./dist/gpu-project/graph.js",
151
151
  "require": "./dist/gpu-project/graph.cjs"
152
152
  },
153
- "./gpu-project/crs": {
153
+ "./gpu-project-crs": {
154
154
  "types": "./dist/gpu-project/crs.d.ts",
155
155
  "import": "./dist/gpu-project/crs.js",
156
156
  "require": "./dist/gpu-project/crs.cjs"
@@ -190,12 +190,12 @@
190
190
  "import": "./dist/gpu-simple-graph/index.js",
191
191
  "require": "./dist/gpu-simple-graph/index.cjs"
192
192
  },
193
- "./experimental/simulation": {
193
+ "./experimental-simulation": {
194
194
  "types": "./dist/experimental/simulation/index.d.ts",
195
195
  "import": "./dist/experimental/simulation/index.js",
196
196
  "require": "./dist/experimental/simulation/index.cjs"
197
197
  },
198
- "./experimental/models": {
198
+ "./experimental-models": {
199
199
  "types": "./dist/experimental/models/index.d.ts",
200
200
  "import": "./dist/experimental/models/index.js",
201
201
  "require": "./dist/experimental/models/index.cjs"
@@ -225,25 +225,25 @@
225
225
  "import": "./dist/execution/*.js",
226
226
  "require": "./dist/execution/*.cjs"
227
227
  },
228
- "./gpu-simple-graph/cpu": {
228
+ "./gpu-simple-graph-cpu": {
229
229
  "types": "./dist/gpu-simple-graph/operations/cpu/index.d.ts",
230
230
  "import": "./dist/gpu-simple-graph/operations/cpu/index.js",
231
231
  "require": "./dist/gpu-simple-graph/operations/cpu/index.cjs"
232
232
  },
233
- "./gpu-simple-graph/webgl": {
233
+ "./gpu-simple-graph-webgl": {
234
234
  "types": "./dist/gpu-simple-graph/operations/webgl/index.d.ts",
235
235
  "import": "./dist/gpu-simple-graph/operations/webgl/index.js",
236
236
  "require": "./dist/gpu-simple-graph/operations/webgl/index.cjs"
237
237
  },
238
- "./gpu-simple-graph/webgpu": {
238
+ "./gpu-simple-graph-webgpu": {
239
239
  "types": "./dist/gpu-simple-graph/operations/webgpu/index.d.ts",
240
240
  "import": "./dist/gpu-simple-graph/operations/webgpu/index.js",
241
241
  "require": "./dist/gpu-simple-graph/operations/webgpu/index.cjs"
242
242
  }
243
243
  },
244
244
  "peerDependencies": {
245
- "@luma.gl/core": "~10.0.0-beta.1",
246
- "@luma.gl/shaders": "~10.0.0-beta.1",
245
+ "@luma.gl/core": "~10.0.0-beta.2",
246
+ "@luma.gl/shaders": "~10.0.0-beta.2",
247
247
  "apache-arrow": ">=17.0.0"
248
248
  },
249
249
  "peerDependenciesMeta": {
@@ -252,11 +252,11 @@
252
252
  }
253
253
  },
254
254
  "dependencies": {
255
- "@math.gl/core": "~5.0.0-rc.2",
256
- "@math.gl/geometry": "~5.0.0-rc.2",
257
- "@math.gl/geospatial": "~5.0.0-rc.2",
258
- "@math.gl/sql": "~5.0.0-rc.2",
255
+ "@math.gl/core": "^5.0.0",
256
+ "@math.gl/geometry": "^5.0.0",
257
+ "@math.gl/geospatial": "^5.0.0",
258
+ "@math.gl/sql": "^5.0.0",
259
259
  "probe.gl": "^5.0.0"
260
260
  },
261
- "gitHead": "36a0b0408f543cf231e2266e4854b6cd19016c19"
261
+ "gitHead": "adb406995f3eb63419a54246fa9c13f36ad0064b"
262
262
  }
@@ -0,0 +1,5 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ export * from './experimental/models/index';
@@ -0,0 +1,5 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ export * from './experimental/simulation/index';
@@ -8,8 +8,10 @@ import type {GPUCommandGraph} from '@luma.gl/graph/gpu-core';
8
8
  import type {GPUDataFrame} from './gpu-data-frame';
9
9
  import {
10
10
  getGPUExpressionColumnNames,
11
+ getGPUExpressionResultFormats,
11
12
  GPUExpression,
12
13
  isBooleanExpressionNode,
14
+ isGPUScalarFunction,
13
15
  type GPUExpressionNode
14
16
  } from './gpu-expression';
15
17
  import {
@@ -336,10 +338,9 @@ function assertDataFrameDerivedColumns<T extends GPUTypeMap>(
336
338
  }
337
339
  assertDataFrameDerivedExpression(derivedColumn.expression, logicalColumns);
338
340
 
339
- const referencedFormats = new Set(
340
- getGPUExpressionColumnNames(derivedColumn.expression).map(columnName =>
341
- logicalFormats.get(columnName)
342
- )
341
+ const referencedFormats = getGPUExpressionResultFormats(
342
+ derivedColumn.expression.node,
343
+ logicalFormats
343
344
  );
344
345
  if (referencedFormats.size > 1) {
345
346
  throw new Error(`GPUDataFrame derived column "${derivedColumn.name}" mixes scalar formats`);
@@ -421,15 +422,27 @@ function assertSelectedQueryColumns(
421
422
 
422
423
  function isNumericExpressionNode(node: GPUExpressionNode): boolean {
423
424
  switch (node.kind) {
425
+ case 'conditional':
426
+ return (
427
+ (isBooleanExpressionNode(node.condition) ||
428
+ ((node.condition.kind === 'literal' || node.condition.kind === 'parameter') &&
429
+ node.condition.value === null)) &&
430
+ isNumericExpressionNode(node.whenTrue) &&
431
+ isNumericExpressionNode(node.otherwise)
432
+ );
433
+ case 'cast':
434
+ return !node.format.includes('x') && isNumericExpressionNode(node.operand);
424
435
  case 'column':
425
436
  return true;
426
437
  case 'literal':
427
438
  case 'parameter':
428
439
  return node.value === null || typeof node.value === 'number';
429
440
  case 'unary':
430
- return node.operator === 'negate';
441
+ return node.operator === 'negate' || isGPUScalarFunction(node.operator);
431
442
  case 'binary':
432
443
  return (
444
+ node.operator === 'coalesce' ||
445
+ node.operator === 'nullif' ||
433
446
  node.operator === 'add' ||
434
447
  node.operator === 'subtract' ||
435
448
  node.operator === 'multiply' ||
@@ -5,7 +5,9 @@
5
5
 
6
6
  import type {GPUTypeMap} from '@luma.gl/graph/gpu-tables';
7
7
  import type {GPUDataFrame} from './gpu-data-frame';
8
+ import {getGPUExpressionCastWGSL} from '../gpu-core/gpu-expression-cast';
8
9
  import type {GPUDataFrameDerivedColumn} from './gpu-data-frame-query';
10
+ import {isGPUScalarFunction, type GPUExpressionUnaryOperator} from './gpu-expression';
9
11
  import type {
10
12
  GPUExpression,
11
13
  GPUExpressionBinaryOperator,
@@ -52,6 +54,7 @@ export type GPUQueryExpressionShaderPlan = {
52
54
  controls: readonly GPUQueryExpressionControl[];
53
55
  outputs: readonly GPUQueryExpressionOutput[];
54
56
  statements: readonly string[];
57
+ usesCasts: boolean;
55
58
  condition: string;
56
59
  };
57
60
 
@@ -74,13 +77,8 @@ export function makeGPUQueryExpressionShaderPlan<T extends GPUTypeMap>(
74
77
  source: GPUDataFrame<T>,
75
78
  predicates: readonly GPUExpression<boolean, string>[],
76
79
  derivedColumns: readonly GPUDataFrameDerivedColumn[] = [],
77
- selectedColumns: readonly string[] = [],
78
- allowEmptyPredicates = false
80
+ selectedColumns: readonly string[] = []
79
81
  ): GPUQueryExpressionShaderPlan {
80
- if (predicates.length === 0 && derivedColumns.length === 0 && !allowEmptyPredicates) {
81
- throw new Error('GPUDataFrame filtering requires at least one predicate');
82
- }
83
-
84
82
  const planner = new GPUQueryExpressionShaderPlanner(source, derivedColumns);
85
83
  const outputs = selectedColumns.flatMap(name => {
86
84
  const derived = derivedColumns.find(column => column.name === name);
@@ -118,6 +116,7 @@ export function makeGPUQueryExpressionShaderPlan<T extends GPUTypeMap>(
118
116
  controls: planner.controls,
119
117
  outputs,
120
118
  statements: planner.statements,
119
+ usesCasts: planner.usesCasts,
121
120
  condition: conditions.join(' && ') || 'true'
122
121
  };
123
122
  }
@@ -178,6 +177,7 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
178
177
  readonly columns: GPUQueryExpressionColumn[] = [];
179
178
  readonly controls: GPUQueryExpressionControl[] = [];
180
179
  readonly statements: string[] = [];
180
+ usesCasts = false;
181
181
 
182
182
  private readonly source: GPUDataFrame<T>;
183
183
  private readonly columnsByName = new Map<string, GPUQueryExpressionColumn>();
@@ -231,6 +231,43 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
231
231
  return this.emitControl(node.value, undefined, expected);
232
232
  case 'parameter':
233
233
  return this.emitControl(node.value, node.name, expected);
234
+ case 'cast': {
235
+ const format = node.format;
236
+ if (format !== 'float32' && format !== 'sint32' && format !== 'uint32') {
237
+ throw new Error('GPUDataFrame casts require scalar 32-bit formats');
238
+ }
239
+ const operand = this.emit(node.operand, this.inferFormat(node.operand) ?? 'float32');
240
+ if (operand.format === 'boolean') {
241
+ throw new Error('GPUDataFrame casts require numeric expressions');
242
+ }
243
+ const floatToInteger = operand.format === 'float32' && format !== 'float32';
244
+ const valid = floatToInteger
245
+ ? `(${operand.valid} && (bitcast<u32>(${operand.value}) & 0x7fffffffu) < 0x7f800000u)`
246
+ : operand.valid;
247
+ const input = floatToInteger ? `select(0.0, ${operand.value}, ${valid})` : operand.value;
248
+ this.usesCasts ||= floatToInteger;
249
+ return this.addValue(
250
+ format,
251
+ getGPUExpressionCastWGSL(input, operand.format, format, 'truncate'),
252
+ valid,
253
+ operand.nullable || floatToInteger
254
+ );
255
+ }
256
+ case 'conditional': {
257
+ const condition = this.emit(node.condition, 'boolean');
258
+ this.assertBoolean(condition);
259
+ const format =
260
+ this.inferFormat(node) ?? (expected === 'boolean' ? undefined : expected) ?? 'float32';
261
+ const whenTrue = this.emit(node.whenTrue, format);
262
+ const otherwise = this.emit(node.otherwise, format);
263
+ const match = `(${condition.valid} && ${condition.value})`;
264
+ return this.addValue(
265
+ format,
266
+ `select(${otherwise.value}, ${whenTrue.value}, ${match})`,
267
+ `select(${otherwise.valid}, ${whenTrue.valid}, ${match})`,
268
+ whenTrue.nullable || otherwise.nullable
269
+ );
270
+ }
234
271
  case 'unary':
235
272
  return this.emitUnary(node.operator, node.operand, expected);
236
273
  case 'binary':
@@ -297,7 +334,7 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
297
334
  }
298
335
 
299
336
  private emitUnary(
300
- operator: 'not' | 'is-valid' | 'is-null' | 'negate',
337
+ operator: GPUExpressionUnaryOperator,
301
338
  operandNode: GPUExpressionNode,
302
339
  expected?: GPUQueryValueFormat
303
340
  ): GPUQueryExpressionShaderValue {
@@ -315,6 +352,52 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
315
352
  const operand = this.emit(operandNode, this.inferFormat(operandNode));
316
353
  return this.addValue('boolean', `!${operand.valid}`, 'true');
317
354
  }
355
+ case 'sqrt':
356
+ case 'ln':
357
+ case 'log10':
358
+ case 'asin':
359
+ case 'acos': {
360
+ const operand = this.emit(operandNode, this.inferFormat(operandNode) ?? 'float32');
361
+ if (operand.format !== 'float32') {
362
+ throw new Error('GPUDataFrame domain-sensitive functions require Float32 input');
363
+ }
364
+ const value = operand.value;
365
+ const domain =
366
+ operator === 'sqrt'
367
+ ? `${value} >= 0.0`
368
+ : operator === 'ln' || operator === 'log10'
369
+ ? `${value} > 0.0`
370
+ : `abs(${value}) <= 1.0`;
371
+ const valid = `(${operand.valid} && (bitcast<u32>(${value}) & 0x7fffffffu) < 0x7f800000u && (${domain}))`;
372
+ const input = `select(1.0, ${value}, ${valid})`;
373
+ const result =
374
+ operator === 'log10'
375
+ ? `(log2(${input}) / log2(10.0))`
376
+ : `${operator === 'ln' ? 'log' : operator}(${input})`;
377
+ return this.addValue('float32', result, valid, true);
378
+ }
379
+ case 'abs':
380
+ case 'floor':
381
+ case 'ceiling':
382
+ case 'round':
383
+ case 'trunc': {
384
+ const format = this.inferFormat(operandNode) ?? 'float32';
385
+ if (format === 'boolean' || (operator === 'abs' && format === 'sint32')) {
386
+ throw new Error('GPUDataFrame scalar function requires a supported numeric format');
387
+ }
388
+ const operand = this.emit(operandNode, format);
389
+ if (format !== 'float32') {
390
+ return operand;
391
+ }
392
+ const value = operand.value;
393
+ const functionName = operator === 'ceiling' ? 'ceil' : operator;
394
+ const rounded = `trunc(${value})`;
395
+ const result =
396
+ operator === 'round'
397
+ ? `(${rounded} + select(0.0, sign(${value}), abs(${value} - ${rounded}) >= 0.5))`
398
+ : `${functionName}(${value})`;
399
+ return this.addValue(format, result, operand.valid, operand.nullable);
400
+ }
318
401
  case 'negate': {
319
402
  const format = this.inferFormat(operandNode) ?? expected ?? 'float32';
320
403
  if (format === 'boolean' || format === 'uint32') {
@@ -369,6 +452,22 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
369
452
  }
370
453
  const left = this.emit(leftNode, format);
371
454
  const right = this.emit(rightNode, format);
455
+ if (operator === 'coalesce') {
456
+ return this.addValue(
457
+ format,
458
+ `select(${right.value}, ${left.value}, ${left.valid})`,
459
+ `(${left.valid} || ${right.valid})`,
460
+ left.nullable && right.nullable
461
+ );
462
+ }
463
+ if (operator === 'nullif') {
464
+ return this.addValue(
465
+ format,
466
+ left.value,
467
+ `(${left.valid} && !(${right.valid} && ${left.value} == ${right.value}))`,
468
+ true
469
+ );
470
+ }
372
471
  const symbol = getGPUQueryBinaryOperator(operator);
373
472
  const value = `(${left.value} ${symbol} ${right.value})`;
374
473
  const valid = `${left.valid} && ${right.valid}`;
@@ -389,10 +488,32 @@ class GPUQueryExpressionShaderPlanner<T extends GPUTypeMap> {
389
488
  case 'literal':
390
489
  case 'parameter':
391
490
  return typeof node.value === 'boolean' ? 'boolean' : undefined;
491
+ case 'cast':
492
+ if (node.format === 'float32' || node.format === 'sint32' || node.format === 'uint32') {
493
+ return node.format;
494
+ }
495
+ throw new Error('GPUDataFrame casts require scalar 32-bit formats');
496
+ case 'conditional': {
497
+ const whenTrue = this.inferFormat(node.whenTrue);
498
+ const otherwise = this.inferFormat(node.otherwise);
499
+ if (
500
+ whenTrue === 'boolean' ||
501
+ otherwise === 'boolean' ||
502
+ (whenTrue && otherwise && whenTrue !== otherwise)
503
+ ) {
504
+ throw new Error('GPUDataFrame CASE branches require matching numeric formats');
505
+ }
506
+ return whenTrue ?? otherwise;
507
+ }
392
508
  case 'unary':
509
+ if (isGPUScalarFunction(node.operator)) {
510
+ return this.inferFormat(node.operand) ?? 'float32';
511
+ }
393
512
  return node.operator === 'negate' ? this.inferFormat(node.operand) : 'boolean';
394
513
  case 'binary':
395
514
  if (
515
+ node.operator === 'coalesce' ||
516
+ node.operator === 'nullif' ||
396
517
  node.operator === 'add' ||
397
518
  node.operator === 'subtract' ||
398
519
  node.operator === 'multiply' ||
@@ -15,10 +15,46 @@ export type GPUExpressionNumericValue = number | readonly number[] | null;
15
15
  export type GPUExpressionValue = number | boolean | null;
16
16
 
17
17
  /** Closed unary operations that can be lowered safely into generated WGSL. */
18
- export type GPUExpressionUnaryOperator = 'not' | 'is-valid' | 'is-null' | 'negate';
18
+ export type GPUExpressionUnaryOperator =
19
+ | 'not'
20
+ | 'is-valid'
21
+ | 'is-null'
22
+ | 'negate'
23
+ | GPUScalarFunction;
24
+
25
+ const scalarFunctions = [
26
+ 'abs',
27
+ 'floor',
28
+ 'ceiling',
29
+ 'round',
30
+ 'trunc',
31
+ 'sqrt',
32
+ 'ln',
33
+ 'log10',
34
+ 'asin',
35
+ 'acos'
36
+ ] as const;
37
+
38
+ /** Numeric functions supported by GPU DataFrame expressions. */
39
+ export type GPUScalarFunction = (typeof scalarFunctions)[number];
40
+
41
+ /** Tests a canonical, lowercase scalar function name. @internal */
42
+ export function isGPUScalarFunction(name: unknown): name is GPUScalarFunction {
43
+ return scalarFunctions.some(functionName => functionName === name);
44
+ }
45
+
46
+ /** Applies a supported numeric function while preserving the operand's format and nulls. */
47
+ export function scalarFunction<Columns extends string>(
48
+ name: GPUScalarFunction,
49
+ expression: GPUExpression<number | null, Columns>
50
+ ): GPUExpression<number | null, Columns> {
51
+ return makeUnaryExpression(name, expression);
52
+ }
19
53
 
20
54
  /** Closed binary operations that can be lowered safely into generated WGSL. */
21
55
  export type GPUExpressionBinaryOperator =
56
+ | 'coalesce'
57
+ | 'nullif'
22
58
  | 'add'
23
59
  | 'subtract'
24
60
  | 'multiply'
@@ -40,6 +76,12 @@ export type GPUExpressionNode =
40
76
  components: readonly GPUExpressionNode[];
41
77
  }>
42
78
  | Readonly<{kind: 'cast'; format: GPUExpressionNumericFormat; operand: GPUExpressionNode}>
79
+ | Readonly<{
80
+ kind: 'conditional';
81
+ condition: GPUExpressionNode;
82
+ whenTrue: GPUExpressionNode;
83
+ otherwise: GPUExpressionNode;
84
+ }>
43
85
  | Readonly<{kind: 'column'; name: string}>
44
86
  | Readonly<{kind: 'literal'; value: GPUExpressionValue}>
45
87
  | Readonly<{kind: 'parameter'; name: string; value: GPUExpressionValue}>
@@ -247,6 +289,39 @@ export function getGPUExpressionColumnNames(expression: GPUExpression<any, strin
247
289
  return Array.from(columnNames);
248
290
  }
249
291
 
292
+ /** Resolves format constraints from result-producing nodes. @internal */
293
+ export function getGPUExpressionResultFormats(
294
+ node: GPUExpressionNode,
295
+ columns: ReadonlyMap<string, string | undefined>,
296
+ formats = new Set<string | undefined>()
297
+ ): Set<string | undefined> {
298
+ switch (node.kind) {
299
+ case 'column':
300
+ formats.add(columns.get(node.name));
301
+ break;
302
+ case 'cast':
303
+ formats.add(node.format);
304
+ break;
305
+ case 'unary':
306
+ if (isGPUScalarFunction(node.operator)) {
307
+ const input = getGPUExpressionResultFormats(node.operand, columns);
308
+ for (const format of input.size ? input : ['float32']) formats.add(format);
309
+ } else {
310
+ getGPUExpressionResultFormats(node.operand, columns, formats);
311
+ }
312
+ break;
313
+ case 'binary':
314
+ getGPUExpressionResultFormats(node.left, columns, formats);
315
+ getGPUExpressionResultFormats(node.right, columns, formats);
316
+ break;
317
+ case 'conditional':
318
+ getGPUExpressionResultFormats(node.whenTrue, columns, formats);
319
+ getGPUExpressionResultFormats(node.otherwise, columns, formats);
320
+ break;
321
+ }
322
+ return formats;
323
+ }
324
+
250
325
  /** Clones every closed node so caller-owned child objects cannot alter an immutable query plan. */
251
326
  function cloneFrozenGPUExpressionNode(node: GPUExpressionNode): GPUExpressionNode {
252
327
  switch (node.kind) {
@@ -262,6 +337,13 @@ function cloneFrozenGPUExpressionNode(node: GPUExpressionNode): GPUExpressionNod
262
337
  format: node.format,
263
338
  operand: cloneFrozenGPUExpressionNode(node.operand)
264
339
  });
340
+ case 'conditional':
341
+ return Object.freeze({
342
+ kind: 'conditional',
343
+ condition: cloneFrozenGPUExpressionNode(node.condition),
344
+ whenTrue: cloneFrozenGPUExpressionNode(node.whenTrue),
345
+ otherwise: cloneFrozenGPUExpressionNode(node.otherwise)
346
+ });
265
347
  case 'column':
266
348
  return Object.freeze({kind: 'column', name: node.name});
267
349
  case 'literal':
@@ -295,6 +377,11 @@ function collectGPUExpressionColumnNames(node: GPUExpressionNode, columnNames: S
295
377
  case 'cast':
296
378
  collectGPUExpressionColumnNames(node.operand, columnNames);
297
379
  break;
380
+ case 'conditional':
381
+ collectGPUExpressionColumnNames(node.condition, columnNames);
382
+ collectGPUExpressionColumnNames(node.whenTrue, columnNames);
383
+ collectGPUExpressionColumnNames(node.otherwise, columnNames);
384
+ break;
298
385
  case 'column':
299
386
  columnNames.add(node.name);
300
387
  break;
@@ -396,6 +483,8 @@ function getKnownExpressionWidth(node: GPUExpressionNode): number | undefined {
396
483
  case 'vector':
397
484
  case 'cast':
398
485
  return getGPUVectorWGSLLayout(node.format).components;
486
+ case 'conditional':
487
+ return 1;
399
488
  case 'literal':
400
489
  case 'parameter':
401
490
  return node.value === null ? undefined : 1;
@@ -417,6 +506,40 @@ function getKnownExpressionWidth(node: GPUExpressionNode): number | undefined {
417
506
  }
418
507
  }
419
508
 
509
+ /** Selects a scalar value when the condition is true. A null condition selects the fallback. */
510
+ export function caseWhen<
511
+ ConditionColumns extends string,
512
+ TrueColumns extends string,
513
+ OtherwiseColumns extends string
514
+ >(
515
+ condition: GPUExpression<boolean | null, ConditionColumns>,
516
+ whenTrue: GPUExpression<number | null, TrueColumns>,
517
+ otherwise: GPUExpression<number | null, OtherwiseColumns>
518
+ ): GPUExpression<number | null, ConditionColumns | TrueColumns | OtherwiseColumns> {
519
+ return new GPUExpression({
520
+ kind: 'conditional',
521
+ condition: condition.node,
522
+ whenTrue: whenTrue.node,
523
+ otherwise: otherwise.node
524
+ });
525
+ }
526
+
527
+ /** Returns the first valid scalar value, falling back when the first input is null. */
528
+ export function coalesce<LeftColumns extends string, RightColumns extends string>(
529
+ value: GPUExpression<number | null, LeftColumns>,
530
+ fallback: GPUExpression<number | null, RightColumns>
531
+ ): GPUExpression<number | null, LeftColumns | RightColumns> {
532
+ return makeBinaryExpression('coalesce', value, fallback);
533
+ }
534
+
535
+ /** Returns null when two valid scalar values compare equal. */
536
+ export function nullIf<LeftColumns extends string, RightColumns extends string>(
537
+ value: GPUExpression<number | null, LeftColumns>,
538
+ sentinel: GPUExpression<number | null, RightColumns>
539
+ ): GPUExpression<number | null, LeftColumns | RightColumns> {
540
+ return makeBinaryExpression('nullif', value, sentinel);
541
+ }
542
+
420
543
  /** Checks whether the expression produces a boolean result. */
421
544
  export function isBooleanExpressionNode(node: GPUExpressionNode): boolean {
422
545
  switch (node.kind) {
@@ -74,7 +74,6 @@ export function compileGPUDataFrameAggregation<
74
74
  Result,
75
75
  CompiledGPUDataFrameAggregation<Result>
76
76
  >(source, predicates, selectedColumns, graph, derivedColumns, {
77
- allowEmptyPredicates: true,
78
77
  prepare: context => addGPUGlobalAggregationsToGraph<Selection, Result>(context, definitions)
79
78
  });
80
79
  }
@@ -6,7 +6,7 @@
6
6
  import type {GPUTypeMap} from '@luma.gl/graph/gpu-tables';
7
7
  import type {GPUCommandGraph} from '@luma.gl/graph/gpu-core';
8
8
  import type {GPUDataFrameQuery} from './gpu-data-frame-query';
9
- import {getGPUExpressionColumnNames} from './gpu-expression';
9
+ import {getGPUExpressionResultFormats} from './gpu-expression';
10
10
  import {
11
11
  compileGPUDataFrameAggregation,
12
12
  type CompiledGPUDataFrameAggregation
@@ -128,8 +128,10 @@ export function getGPUDataFrameAnalyticColumnFormat<
128
128
  )
129
129
  );
130
130
  for (const definition of query.derivedColumns) {
131
- const firstReference = getGPUExpressionColumnNames(definition.expression)[0];
132
- formats.set(definition.name, definition.format ?? formats.get(firstReference) ?? 'float32');
131
+ const inferred = getGPUExpressionResultFormats(definition.expression.node, formats)
132
+ .values()
133
+ .next().value;
134
+ formats.set(definition.name, definition.format ?? inferred ?? 'float32');
133
135
  }
134
136
  const format = formats.get(name);
135
137
  return format === 'float32' || format === 'sint32' || format === 'uint32' ? format : undefined;