• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / luma.gl / 26120831014

19 May 2026 07:40PM UTC coverage: 74.867% (-0.1%) from 74.965%
26120831014

push

github

ibgreen
feat(tables) Split out tables module from arrow

7324 of 11059 branches covered (66.23%)

Branch coverage included in aggregate %.

879 of 1079 new or added lines in 16 files covered. (81.46%)

22 existing lines in 2 files now uncovered.

15967 of 20051 relevant lines covered (79.63%)

1015.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.47
/modules/tables/src/table/gpu-data.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import {DynamicBuffer} from '@luma.gl/engine';
6
import * as arrow from 'apache-arrow';
7

8
/** Optional caller-owned metadata retained on a GPU data range. */
9
export type GPUDataReadbackMetadata = any;
10

11
/** Constructor props that wrap one existing GPU data buffer. */
12
export type GPUDataFromBufferProps<T extends arrow.DataType = arrow.DataType> = {
13
  /** Stable dynamic GPU buffer wrapper for this data range. */
14
  buffer: DynamicBuffer;
15
  /** Logical schema/type descriptor for the values in the data range. */
16
  dataType: T;
17
  /** Number of logical rows in the data range. */
18
  length: number;
19
  /** Number of scalar values represented by one logical row. */
20
  stride?: number;
21
  /** Byte offset of the first logical row. */
22
  byteOffset?: number;
23
  /** Bytes between adjacent logical rows. */
24
  byteStride: number;
25
  /** Number of bytes occupied by the logical row payload. */
26
  rowByteLength?: number;
27
  /** Whether this data view should destroy the buffer. */
28
  ownsBuffer?: boolean;
29
  /** Optional metadata owned by the producer, such as Arrow readback descriptors. */
30
  readbackMetadata?: GPUDataReadbackMetadata;
31
};
32

33
/**
34
 * GPU memory and logical type metadata for one contiguous data chunk.
35
 *
36
 * `GPUData` is format-agnostic. Format-specific upload and readback adapters
37
 * build these ranges and retain any extra metadata they need separately.
38
 */
39
export class GPUData<T extends arrow.DataType = arrow.DataType> {
40
  /** GPU buffer containing this chunk's bytes. */
41
  readonly buffer: DynamicBuffer;
42
  /** Logical schema/type descriptor for the bytes. */
43
  readonly type: T;
44
  /** Number of logical rows in this chunk. */
45
  readonly length: number;
46
  /** Number of scalar values represented by one logical row. */
47
  readonly stride: number;
48
  /** Byte offset of the first logical row in {@link buffer}. */
49
  readonly byteOffset: number;
50
  /** Bytes between adjacent logical rows in {@link buffer}. */
51
  readonly byteStride: number;
52
  /** Bytes occupied by one logical row payload. */
53
  readonly rowByteLength: number;
54
  /** Optional producer-owned metadata retained for adapter-level readback. */
55
  readonly readbackMetadata?: GPUDataReadbackMetadata;
56
  private ownsDataBuffer: boolean;
57

58
  constructor({
59
    buffer,
60
    dataType,
61
    length,
62
    stride = 1,
255✔
63
    byteOffset = 0,
255✔
64
    byteStride,
65
    rowByteLength = byteStride,
255✔
66
    ownsBuffer = false,
255✔
67
    readbackMetadata
68
  }: GPUDataFromBufferProps<T>) {
69
    this.buffer = buffer;
255✔
70
    this.type = dataType;
255✔
71
    this.length = length;
255✔
72
    this.stride = stride;
255✔
73
    this.byteOffset = byteOffset;
255✔
74
    this.byteStride = byteStride;
255✔
75
    this.rowByteLength = rowByteLength;
255✔
76
    this.readbackMetadata = readbackMetadata;
255✔
77
    this.ownsDataBuffer = ownsBuffer;
255✔
78
  }
79

80
  /** Whether this data range is responsible for destroying its backing buffer. */
81
  get ownsBuffer(): boolean {
NEW
82
    return this.ownsDataBuffer;
×
83
  }
84

85
  /** Releases the backing buffer when this data range owns it. */
86
  destroy(): void {
87
    if (this.ownsDataBuffer) {
42!
88
      this.buffer.destroy();
42✔
89
      this.ownsDataBuffer = false;
42✔
90
    }
91
  }
92
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc