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

visgl / luma.gl / 28184188856

25 Jun 2026 04:14PM UTC coverage: 70.439%. First build
28184188856

Pull #2695

github

web-flow
Merge 91ffb64e5 into c1545f9cf
Pull Request #2695: feat(tables): add GPU constant columns

9767 of 15720 branches covered (62.13%)

Branch coverage included in aggregate %.

245 of 321 new or added lines in 6 files covered. (76.32%)

19563 of 25919 relevant lines covered (75.48%)

4363.2 hits per line

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

78.57
/modules/tables/src/engine/gpu-input-schema.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import type {GPUVector} from '../table/gpu-vector';
6
import type {GPUConstant} from '../table/gpu-constant';
7
import type {GPUVectorFormat} from '../table/gpu-vector-format';
8

9
/** Semantic role consumed by one GPU input. */
10
export type GPUInputKind = 'positions' | 'colors' | 'scalars' | 'text' | 'time';
11

12
/** Runtime declaration for one prepared GPUVector consumed by a model or renderer. */
13
export type GPUInputDeclaration<
14
  ColumnName extends string = string,
15
  Format extends GPUVectorFormat = GPUVectorFormat
16
> = {
17
  /** Prepared GPUTable column and GPUVector map key. */
18
  columnName: ColumnName;
19
  /** Optional shader attribute supplied by this column. */
20
  attributeName?: string;
21
  /** Optional shader storage binding supplied by this column. */
22
  storageBindingName?: string;
23
  /** Semantic role consumed by the model or renderer. */
24
  kind: GPUInputKind;
25
  /** Whether callers must provide this prepared GPU input. */
26
  required: boolean;
27
  /** Accepted canonical GPUVector memory formats. */
28
  formats: readonly Format[];
29
  /**
30
   * Whether this input is generated during conversion or model preparation.
31
   * Omit for inputs that source mapping may resolve directly.
32
   */
33
  internal?: boolean;
34
};
35

36
/** Runtime prepared GPU input contract declared by one model or renderer. */
37
export type GPUInputSchema = readonly GPUInputDeclaration[];
38

39
/** Prepared varying GPU vectors keyed by declared GPU input column name. */
40
export type GPUInputVectors = Record<string, GPUVector | undefined>;
41

42
/** Prepared logical GPU columns keyed by declared GPU input column name. */
43
export type GPUInputColumns = Record<string, GPUVector | GPUConstant | undefined>;
44

45
/** Validates prepared GPU vectors against one runtime GPU input schema. */
46
export function validateGPUInputVectors(
47
  ownerName: string,
48
  schema: GPUInputSchema,
49
  vectors: GPUInputColumns
50
): void {
51
  for (const input of schema) {
71✔
52
    const column = vectors[input.columnName];
453✔
53
    if (!column) {
453✔
54
      if (input.required) {
277!
55
        throw new Error(`${ownerName} requires GPU input "${input.columnName}"`);
×
56
      }
57
      continue;
277✔
58
    }
59

60
    if ('isConstant' in column && input.required) {
176!
NEW
61
      throw new Error(
×
62
        `${ownerName} requires varying GPU input "${input.columnName}"; required inputs cannot be constant`
63
      );
64
    }
65

66
    const format = column.format;
176✔
67
    if (!format || !(input.formats as readonly GPUVectorFormat[]).includes(format)) {
176✔
68
      const columnType = 'isConstant' in column ? 'GPUConstant' : 'GPUVector';
3!
69
      throw new Error(
3✔
70
        `${ownerName} ${input.columnName} ${columnType}.format "${format ?? 'undefined'}" must be one of ${input.formats.join(', ')}`
3!
71
      );
72
    }
73
  }
74
}
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