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

visgl / luma.gl / 14540553142

18 Apr 2025 07:21PM UTC coverage: 74.858% (-0.3%) from 75.124%
14540553142

push

github

web-flow
feat(core): Pixel utils (#2369)

2059 of 2694 branches covered (76.43%)

Branch coverage included in aggregate %.

482 of 928 new or added lines in 27 files covered. (51.94%)

2 existing lines in 1 file now uncovered.

26515 of 35477 relevant lines covered (74.74%)

49.63 hits per line

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

0.0
/modules/core/src/adapter/types/buffer-layout.ts
1
// luma.gl
×
2
// SPDX-License-Identifier: MIT
×
3
// Copyright (c) vis.gl contributors
×
4

×
NEW
5
import type {VertexFormat} from '../../shadertypes/vertex-arrays/vertex-formats';
×
6

×
7
/**
×
8
 * Provides specific details about the memory layout of the actual buffers
×
9
 * that will be provided to a `RenderPipeline`.
×
10
 *
×
11
 * BufferLayout lets the application describe whether
×
12
 * - A single buffer can be used for multiple attributes (using interleaving or offsets),
×
13
 * - The data format of the memory being supplied to a specific shader attribute.
×
14
 *
×
15
 * `BufferLayout` complements the "static" attribute declarations in a ShaderLayout
×
16
 * with information about the "dynamic" memory layout of each buffer that will be bound
×
17
 * to the render pipeline.
×
18
 */
×
19

×
20
/** 
×
21
 * Specify memory layout for one buffer, describing how it is used by one or more attribute
×
22
 * @note Specifies format, stride, offset and step mode
×
23
 * @note The buffer can be set using the buffer name:`.setAttributes({[bufferName]: buffer})`.
×
24
 * @note Needs to match type/components of the ShaderLayout ('f32', 'i32', 's32')
×
25
 *
×
26
 * A buffer layout is used to specify "non-standard" buffer layouts (buffers with offsets, interleaved buffers etc)
×
27
 *
×
28
 * @example
×
29
 * ```
×
30
  device.createRenderPipeline({
×
31
    ...
×
32
    shaderLayout,
×
33
    bufferLayout: [
×
34
      {name: 'positions', stepMode: 'vertex', format: 'float32x3'},
×
35
      // interleaved bindings, auto offset
×
36
      {name: 'particles', stepMode: 'instance', byteStride: 32, attributes: [
×
37
        {name: 'instancePositions', format: 'float32x4', byteOffset: 0},
×
38
        {name: 'instanceVelocities', format: 'float32x4', byteOffset: 16}
×
39
      ]},
×
40
    ]
×
41
  ];
×
42
  ```
×
43
  */
×
44
export type BufferLayout = {
×
45
  /** Name of buffer */
×
46
  name: string;
×
47
  /** Is the attribute is instanced. Default: auto-deduced from shader name. */
×
48
  stepMode?: 'vertex' | 'instance';
×
49
  /** bytes between successive elements. If omitted, stride is set to reflect a "packed" buffer */
×
50
  byteStride?: number;
×
51
  /** Option 1: interleaved attributes that read from this buffer */
×
52
  attributes?: BufferAttributeLayout[];
×
53
  /** Option 2: Single attribute with same name as buffer. */
×
54
  format?: VertexFormat;
×
55
};
×
56

×
57
/** Specifies how the GPU should read one specific attribute from a buffer.  */
×
58
export type BufferAttributeLayout = {
×
59
  /** Name of attribute that maps to a "view" of this buffer */
×
60
  attribute: string;
×
61
  /** Data format of the memory in the buffer that is mapped to this attribute */
×
62
  format: VertexFormat;
×
63
  /** Sum up any the "global" offset (or 0) and the offset each stride (for interleaved data). */
×
64
  byteOffset: number;
×
65
};
×
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