@luma.gl/graph 10.0.0-alpha.12 → 10.0.0-alpha.14

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 (145) hide show
  1. package/LICENSE +4 -4
  2. package/THIRD-PARTY-NOTICES.md +19 -0
  3. package/dist/arrow/arrow-colors.cjs +99 -18
  4. package/dist/arrow/arrow-colors.d.ts +27 -10
  5. package/dist/arrow/arrow-colors.d.ts.map +1 -1
  6. package/dist/arrow/arrow-colors.js +107 -24
  7. package/dist/arrow/arrow-colors.js.map +1 -1
  8. package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +8 -6
  9. package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
  10. package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
  11. package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +17 -7
  12. package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
  13. package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +35 -5
  14. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
  15. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
  16. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +40 -5
  17. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
  18. package/dist/arrow/index.cjs.map +3 -3
  19. package/dist/arrow/internal.cjs.map +2 -2
  20. package/dist/dist.dev.js +1506 -163
  21. package/dist/dist.min.js +401 -105
  22. package/dist/gpu-core/gpu-expression-operation.cjs +1 -1
  23. package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
  24. package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
  25. package/dist/gpu-core/gpu-expression-operation.js +1 -1
  26. package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
  27. package/dist/gpu-core/gpu-graph-compiler.cjs +48 -0
  28. package/dist/gpu-core/gpu-graph-compiler.d.ts +1 -0
  29. package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
  30. package/dist/gpu-core/gpu-graph-compiler.js +50 -0
  31. package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
  32. package/dist/gpu-core/gpu-group-aggregation.cjs +7 -15
  33. package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
  34. package/dist/gpu-core/gpu-group-aggregation.js +7 -18
  35. package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
  36. package/dist/gpu-core/gpu-reduction.cjs +6 -14
  37. package/dist/gpu-core/gpu-reduction.d.ts.map +1 -1
  38. package/dist/gpu-core/gpu-reduction.js +6 -15
  39. package/dist/gpu-core/gpu-reduction.js.map +1 -1
  40. package/dist/gpu-core/gpu-semantic-aggregation-operation.cjs +112 -0
  41. package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts +71 -0
  42. package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts.map +1 -0
  43. package/dist/gpu-core/gpu-semantic-aggregation-operation.js +92 -0
  44. package/dist/gpu-core/gpu-semantic-aggregation-operation.js.map +1 -0
  45. package/dist/gpu-core/index.cjs +5 -0
  46. package/dist/gpu-core/index.cjs.map +3 -3
  47. package/dist/gpu-core/index.d.ts +2 -0
  48. package/dist/gpu-core/index.d.ts.map +1 -1
  49. package/dist/gpu-core/index.js +1 -0
  50. package/dist/gpu-core/index.js.map +1 -1
  51. package/dist/gpu-data/color-conversion.cjs +105 -0
  52. package/dist/gpu-data/color-conversion.d.ts +30 -0
  53. package/dist/gpu-data/color-conversion.d.ts.map +1 -0
  54. package/dist/gpu-data/color-conversion.js +109 -0
  55. package/dist/gpu-data/color-conversion.js.map +1 -0
  56. package/dist/gpu-data/cpu-gpu-vector-transfer.cjs +7 -2
  57. package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts.map +1 -1
  58. package/dist/gpu-data/cpu-gpu-vector-transfer.js +9 -6
  59. package/dist/gpu-data/cpu-gpu-vector-transfer.js.map +1 -1
  60. package/dist/gpu-data/gpu-data-buffer-props.cjs +41 -0
  61. package/dist/gpu-data/gpu-data-buffer-props.d.ts +5 -0
  62. package/dist/gpu-data/gpu-data-buffer-props.d.ts.map +1 -0
  63. package/dist/gpu-data/gpu-data-buffer-props.js +19 -0
  64. package/dist/gpu-data/gpu-data-buffer-props.js.map +1 -0
  65. package/dist/gpu-data/index.cjs +7 -2
  66. package/dist/gpu-data/index.cjs.map +3 -3
  67. package/dist/gpu-data/index.d.ts +2 -0
  68. package/dist/gpu-data/index.d.ts.map +1 -1
  69. package/dist/gpu-data/index.js +1 -0
  70. package/dist/gpu-data/index.js.map +1 -1
  71. package/dist/gpu-graph/index.cjs +5 -0
  72. package/dist/gpu-graph/index.cjs.map +3 -3
  73. package/dist/gpu-graph/index.d.ts +2 -0
  74. package/dist/gpu-graph/index.d.ts.map +1 -1
  75. package/dist/gpu-graph/index.js +1 -0
  76. package/dist/gpu-graph/index.js.map +1 -1
  77. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +1 -1
  78. package/dist/gpu-graph-algorithms/index.cjs.map +1 -1
  79. package/dist/gpu-project/benchmarks.cjs.map +2 -2
  80. package/dist/gpu-project/crs.cjs.map +2 -2
  81. package/dist/gpu-project/graph.cjs.map +3 -3
  82. package/dist/gpu-project/index.cjs.map +2 -2
  83. package/dist/gpu-simple-graph/index.cjs.map +3 -3
  84. package/dist/gpu-simple-graph/index.d.ts +1 -1
  85. package/dist/gpu-simple-graph/index.d.ts.map +1 -1
  86. package/dist/gpu-simple-graph/index.js.map +1 -1
  87. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +2 -0
  88. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +3 -0
  89. package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
  90. package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
  91. package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
  92. package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
  93. package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
  94. package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
  95. package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
  96. package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
  97. package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
  98. package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
  99. package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
  100. package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
  101. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
  102. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
  103. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
  104. package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
  105. package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
  106. package/dist/gpu-sql/gpu-sql.cjs +112 -100
  107. package/dist/gpu-sql/gpu-sql.d.ts +1 -1
  108. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  109. package/dist/gpu-sql/gpu-sql.js +120 -102
  110. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  111. package/dist/gpu-sql/index.cjs.map +2 -2
  112. package/dist/gpu-tables/index.cjs.map +2 -2
  113. package/dist/gpu-tables/table/gpu-table.cjs +2 -2
  114. package/dist/gpu-tables/table/gpu-table.d.ts.map +1 -1
  115. package/dist/gpu-tables/table/gpu-table.js +2 -2
  116. package/dist/gpu-tables/table/gpu-table.js.map +1 -1
  117. package/dist/index.cjs +5 -0
  118. package/dist/index.cjs.map +3 -3
  119. package/dist/index.d.ts +2 -0
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +1 -0
  122. package/dist/index.js.map +1 -1
  123. package/package.json +11 -8
  124. package/src/arrow/arrow-colors.ts +194 -33
  125. package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +20 -7
  126. package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +49 -6
  127. package/src/gpu-core/gpu-expression-operation.ts +1 -1
  128. package/src/gpu-core/gpu-graph-compiler.ts +61 -0
  129. package/src/gpu-core/gpu-group-aggregation.ts +38 -50
  130. package/src/gpu-core/gpu-reduction.ts +32 -42
  131. package/src/gpu-core/gpu-semantic-aggregation-operation.ts +150 -0
  132. package/src/gpu-core/index.ts +6 -0
  133. package/src/gpu-data/color-conversion.ts +158 -0
  134. package/src/gpu-data/cpu-gpu-vector-transfer.ts +10 -7
  135. package/src/gpu-data/gpu-data-buffer-props.ts +25 -0
  136. package/src/gpu-data/index.ts +3 -0
  137. package/src/gpu-graph/index.ts +9 -0
  138. package/src/gpu-simple-graph/index.ts +1 -0
  139. package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +2 -0
  140. package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
  141. package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
  142. package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
  143. package/src/gpu-sql/gpu-sql.ts +130 -103
  144. package/src/gpu-tables/table/gpu-table.ts +2 -1
  145. package/src/index.ts +9 -0
package/dist/index.d.ts CHANGED
@@ -33,4 +33,6 @@ export type { GPUGraphTextureDescriptor, GPUGraphTextureExtent } from "./gpu-cor
33
33
  export type { GPUGraphTextureBinding, GPUGraphOutput, GPUGraphOutputs } from "./gpu-core/gpu-texture-plan.js";
34
34
  export { GPUCPUOperation } from "./gpu-core/gpu-cpu-operation.js";
35
35
  export type { GPUCPUOperationProps, GPUCPUArray, GPUCPUVector, GPUCPUResult } from "./gpu-core/gpu-cpu-operation.js";
36
+ export { GPUGraphGroupAggregation, GPUGraphReduction } from "./gpu-core/gpu-semantic-aggregation-operation.js";
37
+ export type { GPUGraphGroupAggregationProps, GPUGraphReductionProps } from "./gpu-core/gpu-semantic-aggregation-operation.js";
36
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,cAAc,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,E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B,EACvB,iBAAiB,EAClB,sCAAmC;AACpC,YAAY,EAAC,yBAAyB,EAAC,0CAAuC;AAC9E,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,EAC5B,6CAA0C;AAE3C,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAC,6CAA0C;AACvF,OAAO,EAAC,sBAAsB,EAAC,gDAA6C;AAC5E,YAAY,EAAC,2BAA2B,EAAC,gDAA6C;AACtF,YAAY,EACV,uBAAuB,EACvB,qBAAqB,EACtB,6CAA0C;AAC3C,OAAO,EAAC,sBAAsB,EAAC,+CAA4C;AAC3E,YAAY,EAAC,2BAA2B,EAAC,+CAA4C;AAErF,YAAY,EAAC,yBAAyB,EAAE,qBAAqB,EAAC,sCAAmC;AACjG,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,eAAe,EAChB,uCAAoC;AAErC,OAAO,EAAC,eAAe,EAAC,wCAAqC;AAC7D,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,YAAY,EACb,wCAAqC;AAEtC,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EAClB,yDAAsD;AACvD,YAAY,EACV,6BAA6B,EAC7B,sBAAsB,EACvB,yDAAsD"}
package/dist/index.js CHANGED
@@ -17,4 +17,5 @@ export { GPUUploadOperation, GPUCopyOperation } from "./gpu-core/gpu-transfer-op
17
17
  export { GPUShaderPassOperation } from "./gpu-core/gpu-shader-pass-operation.js";
18
18
  export { GPUCompactionOperation } from "./gpu-core/gpu-compaction-operation.js";
19
19
  export { GPUCPUOperation } from "./gpu-core/gpu-cpu-operation.js";
20
+ export { GPUGraphGroupAggregation, GPUGraphReduction } from "./gpu-core/gpu-semantic-aggregation-operation.js";
20
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,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,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EAInB,gBAAgB,EAUhB,0BAA0B,EAE1B,gBAAgB,EAqDjB,6BAA0B;AAC3B,OAAO,EACL,iCAAiC,EASjC,wBAAwB,EACzB,kDAA+C;AAChD,OAAO,EAGL,wCAAwC,EACzC,0DAAuD;AACxD,OAAO,EAaL,wBAAwB,EACzB,kDAA+C;AAchD,OAAO,EAAC,cAAc,EAAC,uDAAoD;AAU3E,OAAO,EAAC,aAAa,EAAC,qDAAkD;AACxE,OAAO,EAAC,eAAe,EAAC,+CAA4C;AAMpE,OAAO,EAAC,MAAM,EAAC,sCAAmC;AAClD,OAAO,EAAC,YAAY,EAAC,6CAA0C;AAO/D,OAAO,EAAC,sBAAsB,EAAC,+CAA4C;AAK3E,OAAO,EAAC,gBAAgB,EAAE,yBAAyB,EAAC,yCAAsC;AAe1F,OAAO,EAAC,QAAQ,EAAC,sCAAmC;AAapD,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAC,6CAA0C;AACvF,OAAO,EAAC,sBAAsB,EAAC,gDAA6C;AAM5E,OAAO,EAAC,sBAAsB,EAAC,+CAA4C;AAU3E,OAAO,EAAC,eAAe,EAAC,wCAAqC;AAQ7D,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EAClB,yDAAsD"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "10.0.0-alpha.12",
6
+ "version": "10.0.0-alpha.14",
7
7
  "type": "module",
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -23,7 +23,9 @@
23
23
  "src",
24
24
  "dist",
25
25
  "dist.min.js",
26
- "README.md"
26
+ "README.md",
27
+ "LICENSE",
28
+ "THIRD-PARTY-NOTICES.md"
27
29
  ],
28
30
  "sideEffects": false,
29
31
  "scripts": {
@@ -240,8 +242,8 @@
240
242
  }
241
243
  },
242
244
  "peerDependencies": {
243
- "@luma.gl/core": "~10.0.0-alpha.12",
244
- "@luma.gl/shaders": "~10.0.0-alpha.12",
245
+ "@luma.gl/core": "~10.0.0-alpha.14",
246
+ "@luma.gl/shaders": "~10.0.0-alpha.14",
245
247
  "apache-arrow": ">=17.0.0"
246
248
  },
247
249
  "peerDependenciesMeta": {
@@ -250,10 +252,11 @@
250
252
  }
251
253
  },
252
254
  "dependencies": {
253
- "@math.gl/arrow": "~5.0.0-beta.6",
254
- "@math.gl/core": "~5.0.0-beta.6",
255
- "@math.gl/geospatial": "~5.0.0-beta.6",
255
+ "@math.gl/arrow": "~5.0.0-beta.8",
256
+ "@math.gl/core": "~5.0.0-beta.8",
257
+ "@math.gl/expressions": "~5.0.0-beta.8",
258
+ "@math.gl/geospatial": "~5.0.0-beta.8",
256
259
  "probe.gl": "^5.0.0"
257
260
  },
258
- "gitHead": "7a2a8a50666ead2337dac60f378dcd920587310e"
261
+ "gitHead": "8d01b6b1f5dc0300a3980328f93bfbb0009134c9"
259
262
  }
@@ -9,20 +9,40 @@ import {
9
9
  } from '../gpu-simple-graph/operations/convert-colors';
10
10
  import {GPUDataEvaluator} from '../gpu-simple-graph/operation/gpu-data-evaluator';
11
11
  import {GPUVectorEvaluator} from '../gpu-simple-graph/operation/gpu-vector-evaluator';
12
- import {GPUData, GPUVector, type GPUVectorBufferProps} from '@luma.gl/graph/gpu-data';
12
+ import {
13
+ CPUData,
14
+ CPUVector,
15
+ resolveColorOutputFormat,
16
+ getGPUVectorFormatInfo,
17
+ GPUData,
18
+ GPUVector,
19
+ type ColorConversionOptions,
20
+ type ColorOutputFormat,
21
+ type GPUVectorBufferProps
22
+ } from '@luma.gl/graph/gpu-data';
13
23
  import {DataType, Field, FixedSizeList, Float16, Float32, Uint8, Vector} from 'apache-arrow';
14
- import {makeGPUVectorFromArrow, readArrowGPUVectorAsync} from './gpu/arrow-gpu-vector-adapters';
24
+ import {
25
+ makeArrowGPUValidityBitmap,
26
+ makeGPUVectorFromArrow,
27
+ readArrowGPUVectorAsync
28
+ } from './gpu/arrow-gpu-vector-adapters';
29
+ import {getArrowDataBufferSource, getArrowFixedSizeListRowValidity} from './gpu/arrow-gpu-data';
15
30
  import type {GPUDataReadbackMetadata} from './gpu/arrow-gpu-data';
31
+ import type {AttributeArrowType} from './arrow-utils/arrow-types';
32
+ import type {Data} from 'apache-arrow';
33
+ import {convertCPUColorData} from '../gpu-data/color-conversion';
16
34
 
17
35
  export type ArrowColorType = FixedSizeList<Uint8> | FixedSizeList<Float16> | FixedSizeList<Float32>;
18
36
  type ArrowUint8ColorType = FixedSizeList<Uint8>;
19
37
 
20
- type ConvertColorsProps = {
38
+ type ConvertColorsProps = ColorConversionOptions & {
21
39
  name?: string;
22
40
  inputFormat?: ColorInputFormat;
23
41
  };
24
42
 
25
- type ConvertArrowColorsProps = {
43
+ type ConvertArrowColorsProps = ColorConversionOptions & {
44
+ /** Convert Arrow payloads before uploading; avoids source upload and readback on CPU backends. */
45
+ preferCPU?: boolean;
26
46
  name?: string;
27
47
  bufferProps?: GPUVectorBufferProps;
28
48
  };
@@ -32,45 +52,76 @@ const ARROW_UINT8_COLOR_TYPE = new FixedSizeList(
32
52
  new Field('value', new Uint8(), false)
33
53
  ) as ArrowUint8ColorType;
34
54
 
35
- /** Converts fixed-width GPU RGB/RGBA chunks to materialized normalized Uint8 RGBA chunks. */
55
+ /** Converts fixed-width GPU RGB/RGBA chunks; preserve returns a borrowed wrapper when compatible. */
56
+ export function convertColors(
57
+ device: Device,
58
+ colors: GPUVector,
59
+ props?: ConvertColorsProps & {format?: 'unorm8x4'}
60
+ ): Promise<GPUVector<'unorm8x4'>>;
61
+ export function convertColors<T extends ColorOutputFormat>(
62
+ device: Device,
63
+ colors: GPUVector,
64
+ props: ConvertColorsProps & {format: T}
65
+ ): Promise<GPUVector<T>>;
66
+ export function convertColors(
67
+ device: Device,
68
+ colors: GPUVector,
69
+ props: ConvertColorsProps
70
+ ): Promise<GPUVector<ColorOutputFormat>>;
36
71
  export async function convertColors(
37
72
  device: Device,
38
73
  colors: GPUVector,
39
74
  props: ConvertColorsProps = {}
40
- ): Promise<GPUVector<'unorm8x4'>> {
75
+ ): Promise<GPUVector<ColorOutputFormat>> {
76
+ const format = resolveColorOutputFormat(
77
+ props.inputFormat?.startsWith('float16') ? 'float16x4' : colors.format!,
78
+ props
79
+ );
80
+ const outputType = getColorArrowType(format);
81
+ const byteStride = getGPUVectorFormatInfo(format).byteLength;
82
+ if (props.format === 'preserve' && colors.format === format) {
83
+ return new GPUVector<ColorOutputFormat>({
84
+ type: 'data',
85
+ name: props.name ?? colors.name,
86
+ format,
87
+ dataType: outputType,
88
+ data: colors.data as GPUData<ColorOutputFormat>[],
89
+ ownsData: false
90
+ });
91
+ }
41
92
  const source = GPUVectorEvaluator.fromGPUVector(colors);
42
93
  const converted = source.mapGPUData(data =>
43
- convertColorData(data, {inputFormat: props.inputFormat})
94
+ convertColorData(data, {inputFormat: props.inputFormat, format})
44
95
  );
45
- const outputBuffers = converted.gpuDataEvaluators.map((evaluator, chunkIndex) => {
46
- const buffer = device.createBuffer({
47
- id: `${props.name ?? 'colors'}-${chunkIndex}`,
48
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
49
- byteLength: evaluator.byteLength
50
- });
51
- evaluator.setTargetBuffer({buffer});
52
- return buffer;
53
- });
54
-
96
+ const outputBuffers: Buffer[] = [];
55
97
  try {
98
+ converted.gpuDataEvaluators.forEach((evaluator, chunkIndex) => {
99
+ const buffer = device.createBuffer({
100
+ id: `${props.name ?? 'colors'}-${chunkIndex}`,
101
+ usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
102
+ byteLength: Math.max(evaluator.byteLength, 4)
103
+ });
104
+ evaluator.setTargetBuffer({buffer});
105
+ outputBuffers.push(buffer);
106
+ });
56
107
  const evaluated = await converted.evaluate(device, {
57
108
  name: props.name ?? 'colors',
58
- format: 'unorm8x4'
109
+ format
59
110
  });
60
111
  const data = evaluated.data.map((chunk, chunkIndex) => {
61
112
  const sourceData = colors.data[chunkIndex];
62
113
  const readbackMetadata = sourceData
63
114
  ? getConvertedColorReadbackMetadata(sourceData)
64
115
  : undefined;
65
- return new GPUData<'unorm8x4'>({
116
+ return new GPUData<ColorOutputFormat>({
66
117
  buffer: outputBuffers[chunkIndex],
67
- dataType: ARROW_UINT8_COLOR_TYPE,
68
- format: 'unorm8x4',
118
+ dataType: outputType,
119
+ format,
69
120
  length: chunk.length,
70
121
  stride: 4,
71
122
  byteOffset: chunk.byteOffset,
72
- byteStride: 4,
73
- rowByteLength: 4,
123
+ byteStride,
124
+ rowByteLength: byteStride,
74
125
  ownsBuffer: true,
75
126
  nullBitmap: readbackMetadata?.nullBitmap,
76
127
  readbackMetadata
@@ -80,8 +131,8 @@ export async function convertColors(
80
131
  return new GPUVector({
81
132
  type: 'data',
82
133
  name: evaluated.name,
83
- dataType: ARROW_UINT8_COLOR_TYPE,
84
- format: 'unorm8x4',
134
+ dataType: outputType,
135
+ format,
85
136
  data,
86
137
  ownsData: true
87
138
  });
@@ -96,7 +147,7 @@ export async function convertColors(
96
147
  }
97
148
  }
98
149
 
99
- /** Returns true when an Arrow vector or fixed-width GPUVector can be converted to Uint8 RGBA. */
150
+ /** Returns true for supported fixed-width RGB/RGBA Arrow or GPU inputs. */
100
151
  export function canConvertColors(colors: GPUVector | Vector): boolean {
101
152
  try {
102
153
  if (colors instanceof GPUVector) {
@@ -117,14 +168,105 @@ export function canConvertColors(colors: GPUVector | Vector): boolean {
117
168
  }
118
169
  }
119
170
 
120
- /** Uploads Arrow RGB/RGBA chunks unchanged, converts each chunk, and returns Uint8 RGBA rows. */
171
+ /** Converts Arrow RGB/RGBA chunks to selected storage without changing color space or alpha convention. */
172
+ export function convertArrowColors(
173
+ device: Device,
174
+ colors: Vector<ArrowColorType>,
175
+ props?: ConvertArrowColorsProps & {format?: 'unorm8x4'}
176
+ ): Promise<GPUVector<'unorm8x4'>>;
177
+ export function convertArrowColors<T extends ColorOutputFormat>(
178
+ device: Device,
179
+ colors: Vector<ArrowColorType>,
180
+ props: ConvertArrowColorsProps & {format: T}
181
+ ): Promise<GPUVector<T>>;
182
+ export function convertArrowColors(
183
+ device: Device,
184
+ colors: Vector<ArrowColorType>,
185
+ props: ConvertArrowColorsProps
186
+ ): Promise<GPUVector<ColorOutputFormat>>;
121
187
  export async function convertArrowColors(
122
188
  device: Device,
123
189
  colors: Vector<ArrowColorType>,
124
190
  props: ConvertArrowColorsProps = {}
125
- ): Promise<GPUVector<'unorm8x4'>> {
191
+ ): Promise<GPUVector<ColorOutputFormat>> {
126
192
  validateArrowColorType(colors.type, 'convertArrowColors');
127
193
  const inputFormat = getArrowColorInputFormat(colors.type);
194
+ const sourceFormat = getArrowColorGPUFormat(inputFormat);
195
+ const format = resolveColorOutputFormat(
196
+ inputFormat.startsWith('float16') ? 'float16x4' : sourceFormat,
197
+ props
198
+ );
199
+ if (
200
+ props.format === 'preserve' &&
201
+ (sourceFormat === format || (sourceFormat === 'uint8x4' && format === 'unorm8x4'))
202
+ ) {
203
+ return makeGPUVectorFromArrow(device, colors, {
204
+ ...props.bufferProps,
205
+ name: props.name ?? 'colors',
206
+ format,
207
+ preserveDataChunks: true
208
+ });
209
+ }
210
+ if (props.preferCPU || device.type !== 'webgpu') {
211
+ const cpuSource = new CPUVector({
212
+ name: props.name ?? 'colors',
213
+ format: sourceFormat,
214
+ data: colors.data.map(
215
+ chunk =>
216
+ new CPUData({
217
+ buffer: getArrowDataBufferSource(chunk as Data<AttributeArrowType>),
218
+ format: sourceFormat,
219
+ length: chunk.length,
220
+ nullBitmap: makeArrowGPUValidityBitmap(getArrowFixedSizeListRowValidity(chunk))
221
+ })
222
+ )
223
+ });
224
+ const data: GPUData<ColorOutputFormat>[] = [];
225
+ try {
226
+ for (const chunk of cpuSource.data) {
227
+ const converted = convertCPUColorData(chunk, format, inputFormat);
228
+ const bytes = new Uint8Array(
229
+ converted.buffer,
230
+ converted.byteOffset,
231
+ converted.length * converted.byteStride
232
+ );
233
+ const readbackMetadata = getConvertedColorReadbackMetadata({
234
+ nullBitmap: chunk.nullBitmap,
235
+ length: chunk.length
236
+ });
237
+ data.push(
238
+ new GPUData({
239
+ buffer: device.createBuffer({
240
+ ...props.bufferProps,
241
+ byteLength: Math.max(bytes.length, 4),
242
+ data: bytes.length ? bytes : new Uint8Array(4),
243
+ usage:
244
+ props.bufferProps?.usage ??
245
+ Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC
246
+ }),
247
+ format,
248
+ dataType: getColorArrowType(format),
249
+ length: chunk.length,
250
+ ownsBuffer: true,
251
+ nullBitmap: readbackMetadata?.nullBitmap,
252
+ readbackMetadata
253
+ })
254
+ );
255
+ }
256
+ return new GPUVector({
257
+ type: 'data',
258
+ name: props.name ?? 'colors',
259
+ format,
260
+ dataType: getColorArrowType(format),
261
+ data,
262
+ ownsData: true
263
+ });
264
+ } catch (error) {
265
+ for (const chunk of data) chunk.destroy();
266
+ throw error;
267
+ }
268
+ }
269
+
128
270
  const source = makeGPUVectorFromArrow(device, colors, {
129
271
  ...props.bufferProps,
130
272
  name: props.name ? `${props.name}-source` : 'colors-source',
@@ -135,22 +277,33 @@ export async function convertArrowColors(
135
277
  try {
136
278
  return await convertColors(device, source, {
137
279
  name: props.name ?? 'colors',
138
- inputFormat
280
+ inputFormat,
281
+ format
139
282
  });
140
283
  } finally {
141
284
  source.destroy();
142
285
  }
143
286
  }
144
287
 
145
- /** Normalizes Arrow RGB/RGBA rows and reads the canonical Uint8 RGBA rows back to Arrow. */
288
+ /** Converts color storage and reads it back; floating outputs retain HDR and negative channels. */
289
+ export function convertArrowColorsToArrow(
290
+ device: Device,
291
+ colors: Vector<ArrowColorType>,
292
+ props?: ConvertArrowColorsProps & {format?: 'unorm8x4'}
293
+ ): Promise<Vector<ArrowUint8ColorType>>;
294
+ export function convertArrowColorsToArrow(
295
+ device: Device,
296
+ colors: Vector<ArrowColorType>,
297
+ props: ConvertArrowColorsProps
298
+ ): Promise<Vector<ArrowColorType>>;
146
299
  export async function convertArrowColorsToArrow(
147
300
  device: Device,
148
301
  colors: Vector<ArrowColorType>,
149
302
  props: ConvertArrowColorsProps = {}
150
- ): Promise<Vector<ArrowUint8ColorType>> {
303
+ ): Promise<Vector<ArrowColorType>> {
151
304
  const converted = await convertArrowColors(device, colors, props);
152
305
  try {
153
- return await readArrowGPUVectorAsync<ArrowUint8ColorType>(converted);
306
+ return await readArrowGPUVectorAsync<ArrowColorType>(converted);
154
307
  } finally {
155
308
  converted.destroy();
156
309
  }
@@ -213,7 +366,7 @@ function getArrowColorGPUFormat(inputFormat: ColorInputFormat): VertexFormat {
213
366
  }
214
367
 
215
368
  function getConvertedColorReadbackMetadata(
216
- source: GPUData
369
+ source: Pick<GPUData, 'nullBitmap' | 'length'>
217
370
  ): Extract<GPUDataReadbackMetadata, {kind: 'fixed-size-list'}> | undefined {
218
371
  const sourceNullBitmap = source.nullBitmap;
219
372
  if (!sourceNullBitmap) {
@@ -231,3 +384,11 @@ function getConvertedColorReadbackMetadata(
231
384
  ? {kind: 'fixed-size-list', nullCount, nullBitmap, childNullCount: 0}
232
385
  : undefined;
233
386
  }
387
+
388
+ function getColorArrowType(format: ColorOutputFormat): ArrowColorType {
389
+ return format === 'unorm8x4'
390
+ ? ARROW_UINT8_COLOR_TYPE
391
+ : format === 'float16x4'
392
+ ? new FixedSizeList(4, new Field('value', new Float16(), false))
393
+ : new FixedSizeList(4, new Field('value', new Float32(), false));
394
+ }
@@ -2,7 +2,8 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import {Buffer, Device, type SignedDataType, type VertexFormat} from '@luma.gl/core';
5
+ import {getGPUDataBufferProps} from '../../gpu-data/gpu-data-buffer-props';
6
+ import {Device, type SignedDataType, type VertexFormat} from '@luma.gl/core';
6
7
  import {DynamicBuffer} from '@luma.gl/core/dynamic';
7
8
  import {
8
9
  GPUData,
@@ -210,7 +211,9 @@ export function makeGPUDataFromArrowData<T extends DataType>(
210
211
  const byteStride = getArrowTypeByteStride(arrowType.indices);
211
212
  return new GPUData({
212
213
  buffer: new DynamicBuffer(device, {
213
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
214
+ ...(bufferProps.usage === undefined
215
+ ? getGPUDataBufferProps(device, format === 'uint16' ? 'uint16' : 'uint32')
216
+ : {}),
214
217
  ...bufferProps,
215
218
  data: getArrowDictionaryIndexBufferSource(data as unknown as Data<ArrowUtf8Dictionary>)
216
219
  }),
@@ -227,7 +230,9 @@ export function makeGPUDataFromArrowData<T extends DataType>(
227
230
  if (DataType.isUtf8(arrowType)) {
228
231
  return new GPUData({
229
232
  buffer: new DynamicBuffer(device, {
230
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
233
+ ...(bufferProps.usage === undefined
234
+ ? getGPUDataBufferProps(device, format === 'uint16' ? 'uint16' : 'uint32')
235
+ : {}),
231
236
  ...bufferProps,
232
237
  data: getArrowUtf8DataBufferSource(data as Data<Utf8>)
233
238
  }),
@@ -254,7 +259,9 @@ export function makeGPUDataFromArrowData<T extends DataType>(
254
259
  const byteStride = getArrowTypeByteStride(arrowType);
255
260
  return new GPUData({
256
261
  buffer: new DynamicBuffer(device, {
257
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
262
+ ...(bufferProps.usage === undefined
263
+ ? getGPUDataBufferProps(device, format === 'uint16' ? 'uint16' : 'uint32')
264
+ : {}),
258
265
  ...bufferProps,
259
266
  data: getArrowVariableLengthAttributeDataBufferSource(
260
267
  data as unknown as Data<VariableLengthAttributeArrowType>
@@ -278,7 +285,9 @@ export function makeGPUDataFromArrowData<T extends DataType>(
278
285
  const byteStride = getArrowTypeByteStride(arrowType);
279
286
  return new GPUData({
280
287
  buffer: new DynamicBuffer(device, {
281
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
288
+ ...(bufferProps.usage === undefined
289
+ ? getGPUDataBufferProps(device, format === 'uint16' ? 'uint16' : 'uint32')
290
+ : {}),
282
291
  ...bufferProps,
283
292
  data: getArrowDataBufferSource(data as unknown as Data<AttributeArrowType>)
284
293
  }),
@@ -385,7 +394,9 @@ export function makeGPUVectorFromArrow<T extends DataType>(
385
394
  }
386
395
 
387
396
  const buffer = device.createBuffer({
388
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
397
+ ...(bufferProps.usage === undefined
398
+ ? getGPUDataBufferProps(device, vectorFormat === 'uint16' ? 'uint16' : 'uint32')
399
+ : {}),
389
400
  ...bufferProps,
390
401
  data: getArrowVectorBufferSource(vector as unknown as Vector<AttributeArrowType>)
391
402
  });
@@ -496,7 +507,9 @@ function getArrowDataValueLength(data: Data): number {
496
507
  return Math.max(0, lastValueOffset - firstValueOffset);
497
508
  }
498
509
 
499
- function makeArrowGPUValidityBitmap(validity: Uint32Array | undefined): Uint8Array | undefined {
510
+ export function makeArrowGPUValidityBitmap(
511
+ validity: Uint32Array | undefined
512
+ ): Uint8Array | undefined {
500
513
  if (!validity) {
501
514
  return undefined;
502
515
  }
@@ -3,6 +3,7 @@
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {Buffer, type Device} from '@luma.gl/core';
6
+ import {getGPUDataBufferProps} from '../../gpu-data/gpu-data-buffer-props';
6
7
  import {DynamicBuffer} from '@luma.gl/core/dynamic';
7
8
  import {
8
9
  GPUData,
@@ -12,6 +13,7 @@ import {
12
13
  type GPUVectorBufferProps,
13
14
  type GPUVectorFormat
14
15
  } from '@luma.gl/graph/gpu-data';
16
+ import {resolveColorOutputFormat, type ColorOutputFormat} from '../../gpu-data/color-conversion';
15
17
  import {castData} from '../../gpu-simple-graph/operations/cast-data';
16
18
  import {fround} from '../../gpu-simple-graph/operations/fround';
17
19
  import {GPUDataEvaluator} from '../../gpu-simple-graph/operation/gpu-data-evaluator';
@@ -112,7 +114,11 @@ export type ArrowGPUConversionOptions = {
112
114
  /** Semantic conversion family. `auto` recognizes temporal and metadata-tagged matrices. */
113
115
  semantic?: ArrowGPUConversionSemantic;
114
116
  /** One required output memory format. */
115
- format?: GPUVectorFormat;
117
+ format?: GPUVectorFormat | 'preserve';
118
+ /** Consumer color storage capabilities, checked independently of the requested policy. */
119
+ acceptedFormats?: readonly ColorOutputFormat[];
120
+ /** Explicit fallback when preserved color precision is not accepted. */
121
+ fallbackFormat?: ColorOutputFormat;
116
122
  /** Ordered acceptable output formats. The planner selects the first compatible format. */
117
123
  formats?: readonly GPUVectorFormat[];
118
124
  /** Strategy constraint. */
@@ -264,9 +270,14 @@ export async function convertArrowToGPUVector(
264
270
  case 'convert-color': {
265
271
  const vector =
266
272
  source instanceof GPUVector
267
- ? await convertColors(device, source, {name})
273
+ ? await convertColors(device, source, {
274
+ name,
275
+ format: plan.targetFormat as ColorOutputFormat
276
+ })
268
277
  : await convertArrowColors(device, source as Parameters<typeof convertArrowColors>[1], {
269
278
  name,
279
+ format: plan.targetFormat as ColorOutputFormat,
280
+ preferCPU: plan.backend === 'cpu',
270
281
  bufferProps: options.bufferProps
271
282
  });
272
283
  return makePreparedArrowGPUVector(vector, plan, true);
@@ -367,10 +378,33 @@ function resolveTargetFormat(
367
378
  options: ArrowGPUConversionOptions
368
379
  ): GPUVectorFormat {
369
380
  const canonicalFormat = getCanonicalSemanticFormat(semantic, source, sourceFormat, options.field);
381
+ if (semantic === 'color') {
382
+ const requested =
383
+ options.format ??
384
+ options.formats?.find(format => ['unorm8x4', 'float16x4', 'float32x4'].includes(format)) ??
385
+ 'unorm8x4';
386
+ if (!['preserve', 'unorm8x4', 'float16x4', 'float32x4'].includes(requested))
387
+ throw new Error('Unsupported color output format');
388
+ if (options.formats && !options.formats.includes(requested as GPUVectorFormat))
389
+ throw new Error('No compatible color output format');
390
+ return resolveColorOutputFormat(
391
+ source instanceof Vector &&
392
+ DataType.isFixedSizeList(source.type) &&
393
+ source.type.children[0].type instanceof Float16
394
+ ? 'float16x4'
395
+ : (sourceFormat ?? canonicalFormat),
396
+ {
397
+ format: requested as ColorOutputFormat | 'preserve',
398
+ acceptedFormats: options.acceptedFormats,
399
+ fallbackFormat: options.fallbackFormat
400
+ }
401
+ );
402
+ }
403
+ if (options.format === 'preserve') throw new Error('preserve requires color semantics');
370
404
  const requestedFormats = options.format ? [options.format] : options.formats;
371
405
  if (!requestedFormats?.length) return canonicalFormat;
372
406
 
373
- if (semantic === 'color' || semantic === 'matrix' || semantic === 'temporal') {
407
+ if (semantic === 'matrix' || semantic === 'temporal') {
374
408
  if (!requestedFormats.includes(canonicalFormat)) {
375
409
  throw new Error(
376
410
  `Arrow ${semantic} conversion produces ${canonicalFormat}, not ${requestedFormats.join(', ')}`
@@ -434,7 +468,8 @@ function resolveConversionStrategy(
434
468
  if (!sourceFormat || !areGPUFormatsByteCompatible(sourceFormat, targetFormat)) {
435
469
  return 'convert-color';
436
470
  }
437
- if (source instanceof GPUVector) return 'borrow';
471
+ if (source instanceof GPUVector)
472
+ return sourceFormat === targetFormat ? 'borrow' : 'convert-color';
438
473
  return sourceFormat === targetFormat ? 'upload' : 'reinterpret-upload';
439
474
  }
440
475
  if (semantic === 'matrix') {
@@ -477,6 +512,8 @@ function resolveConversionBackend(
477
512
  if (strategy === 'borrow') return 'none';
478
513
  if (strategy === 'upload' || strategy === 'reinterpret-upload') return 'upload';
479
514
  if (strategy === 'convert-matrix' && source instanceof Vector) return 'cpu';
515
+ if (strategy === 'convert-color' && source instanceof Vector && policy === 'prefer-cpu')
516
+ return 'cpu';
480
517
  if (
481
518
  strategy === 'convert-numeric' &&
482
519
  source instanceof Vector &&
@@ -707,7 +744,7 @@ async function convertArrowFloat64VectorOnGPU(
707
744
  const outputBuffer = device.createBuffer({
708
745
  ...options.bufferProps,
709
746
  id: `${options.name}-${chunkIndex}`,
710
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
747
+ ...getGPUDataBufferProps(device),
711
748
  byteLength: Math.max(Float32Array.BYTES_PER_ELEMENT, split.byteLength)
712
749
  });
713
750
  outputBuffers.push(outputBuffer);
@@ -846,7 +883,7 @@ async function convertArrowNumericVectorOnGPU(
846
883
  const outputBuffer = device.createBuffer({
847
884
  ...options.bufferProps,
848
885
  id: `${options.name}-${chunkIndex}`,
849
- usage: Buffer.VERTEX | Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
886
+ ...getGPUDataBufferProps(device, targetElementFormat === 'uint16' ? 'uint16' : 'uint32'),
850
887
  byteLength: Math.max(4, converted.byteLength)
851
888
  });
852
889
  outputBuffers.push(outputBuffer);
@@ -1059,6 +1096,12 @@ function getConversionWarnings(
1059
1096
  backend: ArrowGPUConversionBackend
1060
1097
  ): string[] {
1061
1098
  const warnings: string[] = [];
1099
+ if (strategy === 'convert-color') {
1100
+ if (targetFormat === 'unorm8x4')
1101
+ warnings.push('floating color channels are clamped and quantized to RGBA8');
1102
+ if (targetFormat === 'float16x4')
1103
+ warnings.push('color channels are rounded to binary16; out-of-range values may overflow');
1104
+ }
1062
1105
  const sourceType = getSourceArrowType(source);
1063
1106
  const leafType = sourceType ? getArrowNumericLeafType(sourceType) : undefined;
1064
1107
  if (
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import {parse, type Expression} from '@math.gl/core/expressions';
5
+ import {parse, type Expression} from '@math.gl/expressions';
6
6
  import {getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
7
7
  import {gpuGraph, type GPUGraphVectorFormat} from './gpu-graph-value';
8
8
  import type {GPUOperationContract} from './gpu-operation-contract';