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

visgl / luma.gl / 29646907050

18 Jul 2026 01:50PM UTC coverage: 71.874% (-0.4%) from 72.255%
29646907050

Pull #2746

github

web-flow
Merge 136cf5204 into 5d8d46193
Pull Request #2746: feat: add WebGL extension and WebGPU feature support

11338 of 17802 branches covered (63.69%)

Branch coverage included in aggregate %.

76 of 194 new or added lines in 20 files covered. (39.18%)

5 existing lines in 1 file now uncovered.

21918 of 28468 relevant lines covered (76.99%)

5571.34 hits per line

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

74.07
/modules/webgpu/src/adapter/resources/webgpu-sampler.ts
1
// luma.gl, MIT license
2
// Copyright (c) vis.gl contributors
3

4
import {Sampler, SamplerProps} from '@luma.gl/core';
5
import type {WebGPUDevice} from '../webgpu-device';
6

7
export type WebGPUSamplerProps = SamplerProps & {
8
  handle?: GPUSampler;
9
};
10

11
/**
12
 * A WebGPU sampler object
13
 */
14
export class WebGPUSampler extends Sampler {
15
  readonly device: WebGPUDevice;
16
  readonly handle: GPUSampler;
17

18
  constructor(device: WebGPUDevice, props: WebGPUSamplerProps) {
19
    super(device, props);
148✔
20
    this.device = device;
148✔
21

22
    if (
148!
23
      [props.addressModeU, props.addressModeV, props.addressModeW].includes(
24
        'mirror-clamp-to-edge-webgl'
25
      )
26
    ) {
NEW
27
      throw new Error('mirror-clamp-to-edge-webgl is only supported in WebGL');
×
28
    }
29

30
    // Prepare sampler props. Mostly identical
31
    const samplerDescriptor: Partial<GPUSamplerDescriptor> = {
148✔
32
      ...this.props,
33
      addressModeU: this.props.addressModeU as GPUAddressMode,
34
      addressModeV: this.props.addressModeV as GPUAddressMode,
35
      addressModeW: this.props.addressModeW as GPUAddressMode,
36
      mipmapFilter: undefined
37
    };
38

39
    // props.compare automatically turns this into a comparison sampler
40
    if (props.type !== 'comparison-sampler') {
148✔
41
      delete samplerDescriptor.compare;
145✔
42
    }
43

44
    // disable mipmapFilter if not set
45
    if (props.mipmapFilter && props.mipmapFilter !== 'none') {
148!
46
      samplerDescriptor.mipmapFilter = props.mipmapFilter;
×
47
    }
48

49
    this.handle = props.handle || this.device.handle.createSampler(samplerDescriptor);
148✔
50
    this.handle.label = this.props.id;
148✔
51
  }
52

53
  override destroy(): void {
54
    if (this.destroyed) {
47!
55
      return;
×
56
    }
57

58
    this.destroyResource();
47✔
59
    // GPUSampler does not have a destroy method
60
    // this.handle.destroy();
61
    // @ts-expect-error readonly
62
    this.handle = null;
47✔
63
  }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc