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

visgl / luma.gl / 23981506010

04 Apr 2026 03:07PM UTC coverage: 74.219% (+0.03%) from 74.193%
23981506010

push

github

web-flow
fix: predraw() buffer overwrites (#2590)

5169 of 7877 branches covered (65.62%)

Branch coverage included in aggregate %.

45 of 59 new or added lines in 12 files covered. (76.27%)

1 existing line in 1 file now uncovered.

11692 of 14841 relevant lines covered (78.78%)

750.87 hits per line

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

77.5
/modules/webgpu/src/adapter/webgpu-device.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
// biome-ignore format: preserve layout
6
// / <reference types="@webgpu/types" />
7

8
import type {
9
  Bindings,
10
  ComputePipeline,
11
  ComputeShaderLayout,
12
  DeviceInfo,
13
  DeviceLimits,
14
  DeviceFeature,
15
  DeviceTextureFormatCapabilities,
16
  VertexFormat,
17
  CanvasContextProps,
18
  PresentationContextProps,
19
  PresentationContext,
20
  BufferProps,
21
  SamplerProps,
22
  ShaderProps,
23
  TextureProps,
24
  Texture,
25
  ExternalTextureProps,
26
  FramebufferProps,
27
  RenderPipelineProps,
28
  ComputePipelineProps,
29
  VertexArrayProps,
30
  TransformFeedback,
31
  TransformFeedbackProps,
32
  QuerySet,
33
  QuerySetProps,
34
  DeviceProps,
35
  CommandEncoderProps,
36
  CommandEncoder,
37
  PipelineLayoutProps,
38
  RenderPipeline,
39
  ShaderLayout
40
} from '@luma.gl/core';
41
import {Buffer, Device, DeviceFeatures} from '@luma.gl/core';
42
import {WebGPUBuffer} from './resources/webgpu-buffer';
43
import {WebGPUTexture} from './resources/webgpu-texture';
44
import {WebGPUExternalTexture} from './resources/webgpu-external-texture';
45
import {WebGPUSampler} from './resources/webgpu-sampler';
46
import {WebGPUShader} from './resources/webgpu-shader';
47
import {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';
48
import {WebGPUFramebuffer} from './resources/webgpu-framebuffer';
49
import {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';
50
import {WebGPUVertexArray} from './resources/webgpu-vertex-array';
51

52
import {WebGPUCanvasContext} from './webgpu-canvas-context';
53
import {WebGPUPresentationContext} from './webgpu-presentation-context';
54
import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder';
55
import {WebGPUCommandBuffer} from './resources/webgpu-command-buffer';
56
import {WebGPUQuerySet} from './resources/webgpu-query-set';
57
import {WebGPUPipelineLayout} from './resources/webgpu-pipeline-layout';
58
import {WebGPUFence} from './resources/webgpu-fence';
59

60
import {getShaderLayoutFromWGSL} from '../wgsl/get-shader-layout-wgsl';
61
import {generateMipmapsWebGPU} from './helpers/generate-mipmaps-webgpu';
62
import {getBindGroup} from './helpers/get-bind-group';
63
import {
64
  getCpuHotspotProfiler as getWebGPUCpuHotspotProfiler,
65
  getCpuHotspotSubmitReason as getWebGPUCpuHotspotSubmitReason,
66
  getTimestamp
67
} from './helpers/cpu-hotspot-profiler';
68

69
/** WebGPU Device implementation */
70
export class WebGPUDevice extends Device {
71
  /** The underlying WebGPU device */
72
  readonly handle: GPUDevice;
73
  /* The underlying WebGPU adapter */
74
  readonly adapter: GPUAdapter;
75
  /* The underlying WebGPU adapter's info */
76
  readonly adapterInfo: GPUAdapterInfo;
77

78
  /** type of this device */
79
  readonly type = 'webgpu';
26✔
80

81
  readonly preferredColorFormat = navigator.gpu.getPreferredCanvasFormat() as
26✔
82
    | 'rgba8unorm'
83
    | 'bgra8unorm';
84
  readonly preferredDepthFormat = 'depth24plus';
26✔
85

86
  readonly features: DeviceFeatures;
87
  readonly info: DeviceInfo;
88
  readonly limits: DeviceLimits;
89

90
  readonly lost: Promise<{reason: 'destroyed'; message: string}>;
91

92
  override canvasContext: WebGPUCanvasContext | null = null;
26✔
93

94
  private _isLost: boolean = false;
26✔
95
  private _defaultSampler: WebGPUSampler | null = null;
26✔
96
  commandEncoder: WebGPUCommandEncoder;
97

98
  override get [Symbol.toStringTag](): string {
99
    return 'WebGPUDevice';
×
100
  }
101

102
  override toString(): string {
103
    return `WebGPUDevice(${this.id})`;
×
104
  }
105

106
  constructor(
107
    props: DeviceProps,
108
    device: GPUDevice,
109
    adapter: GPUAdapter,
110
    adapterInfo: GPUAdapterInfo
111
  ) {
112
    super({...props, id: props.id || 'webgpu-device'});
26!
113
    this.handle = device;
26✔
114
    this.adapter = adapter;
26✔
115
    this.adapterInfo = adapterInfo;
26✔
116

117
    this.info = this._getInfo();
26✔
118
    this.features = this._getFeatures();
26✔
119
    this.limits = this.handle.limits;
26✔
120

121
    // Listen for uncaptured WebGPU errors
122
    device.addEventListener('uncapturederror', (event: Event) => {
26✔
123
      event.preventDefault();
×
124
      // TODO is this the right way to make sure the error is an Error instance?
125
      const errorMessage =
126
        event instanceof GPUUncapturedErrorEvent ? event.error.message : 'Unknown WebGPU error';
×
127
      this.reportError(new Error(errorMessage), this)();
×
128
      this.debug();
×
129
    });
130

131
    // "Context" loss handling
132
    this.lost = this.handle.lost.then(lostInfo => {
26✔
133
      this._isLost = true;
7✔
134
      return {reason: 'destroyed', message: lostInfo.message};
7✔
135
    });
136

137
    // Note: WebGPU devices can be created without a canvas, for compute shader purposes
138
    const canvasContextProps = Device._getCanvasContextProps(props);
26✔
139
    if (canvasContextProps) {
26!
140
      this.canvasContext = new WebGPUCanvasContext(this, this.adapter, canvasContextProps);
26✔
141
    }
142

143
    this.commandEncoder = this.createCommandEncoder({});
26✔
144
  }
145

146
  // TODO
147
  // Load the glslang module now so that it is available synchronously when compiling shaders
148
  // const {glsl = true} = props;
149
  // this.glslang = glsl && await loadGlslangModule();
150

151
  destroy(): void {
152
    this.commandEncoder?.destroy();
×
153
    this._defaultSampler?.destroy();
×
154
    this._defaultSampler = null;
×
155
    this.handle.destroy();
×
156
  }
157

158
  get isLost(): boolean {
159
    return this._isLost;
118✔
160
  }
161

162
  getShaderLayout(source: string) {
163
    return getShaderLayoutFromWGSL(source);
15✔
164
  }
165

166
  override isVertexFormatSupported(format: VertexFormat): boolean {
167
    const info = this.getVertexFormatInfo(format);
×
168
    return !info.webglOnly;
×
169
  }
170

171
  createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer {
172
    const newProps = this._normalizeBufferProps(props);
140✔
173
    return new WebGPUBuffer(this, newProps);
140✔
174
  }
175

176
  createTexture(props: TextureProps): WebGPUTexture {
177
    return new WebGPUTexture(this, props);
128✔
178
  }
179

180
  createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {
181
    return new WebGPUExternalTexture(this, props);
×
182
  }
183

184
  createShader(props: ShaderProps): WebGPUShader {
185
    return new WebGPUShader(this, props);
55✔
186
  }
187

188
  createSampler(props: SamplerProps): WebGPUSampler {
189
    return new WebGPUSampler(this, props);
7✔
190
  }
191

192
  getDefaultSampler(): WebGPUSampler {
193
    this._defaultSampler ||= new WebGPUSampler(this, {
98✔
194
      id: `${this.id}-default-sampler`
195
    });
196
    return this._defaultSampler;
98✔
197
  }
198

199
  createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {
200
    return new WebGPURenderPipeline(this, props);
23✔
201
  }
202

203
  createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {
204
    return new WebGPUFramebuffer(this, props);
37✔
205
  }
206

207
  createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {
208
    return new WebGPUComputePipeline(this, props);
7✔
209
  }
210

211
  createVertexArray(props: VertexArrayProps): WebGPUVertexArray {
212
    return new WebGPUVertexArray(this, props);
10✔
213
  }
214

215
  override createCommandEncoder(props?: CommandEncoderProps): WebGPUCommandEncoder {
216
    return new WebGPUCommandEncoder(this, props);
115✔
217
  }
218

219
  override writeBufferViaCommandEncoder(
220
    commandEncoder: CommandEncoder,
221
    destinationBuffer: Buffer,
222
    data: ArrayBufferLike | ArrayBufferView | SharedArrayBuffer,
223
    byteOffset: number = 0
1✔
224
  ): void {
225
    const webgpuCommandEncoder = commandEncoder as WebGPUCommandEncoder;
1✔
226
    const uploadData = ArrayBuffer.isView(data)
1!
227
      ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)
228
      : new Uint8Array(data);
229
    // WebGPU cannot encode CPU writes directly on a command encoder. Record the
230
    // upload as a staging-buffer copy so it stays ordered with the draw/dispatch
231
    // commands that will consume the destination buffer.
232
    const uploadBuffer = this.createBuffer({
1✔
233
      usage: Buffer.COPY_SRC,
234
      data: uploadData
235
    });
236

237
    webgpuCommandEncoder.trackTransientUploadBuffer(uploadBuffer);
1✔
238
    webgpuCommandEncoder.copyBufferToBuffer({
1✔
239
      sourceBuffer: uploadBuffer,
240
      destinationBuffer,
241
      destinationOffset: byteOffset,
242
      size: uploadData.byteLength
243
    });
244
  }
245

246
  // WebGPU specifics
247

248
  createTransformFeedback(props: TransformFeedbackProps): TransformFeedback {
249
    throw new Error('Transform feedback not supported in WebGPU');
×
250
  }
251

252
  override createQuerySet(props: QuerySetProps): QuerySet {
253
    return new WebGPUQuerySet(this, props);
6✔
254
  }
255

256
  override createFence(): WebGPUFence {
257
    return new WebGPUFence(this);
1✔
258
  }
259

260
  createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {
261
    return new WebGPUCanvasContext(this, this.adapter, props);
×
262
  }
263

264
  createPresentationContext(props?: PresentationContextProps): PresentationContext {
265
    return new WebGPUPresentationContext(this, props);
2✔
266
  }
267

268
  createPipelineLayout(props: PipelineLayoutProps): WebGPUPipelineLayout {
269
    return new WebGPUPipelineLayout(this, props);
23✔
270
  }
271

272
  override generateMipmapsWebGPU(texture: Texture): void {
273
    generateMipmapsWebGPU(this, texture);
12✔
274
  }
275

276
  override _createBindGroupLayoutWebGPU(
277
    pipeline: RenderPipeline | ComputePipeline,
278
    group: number
279
  ): GPUBindGroupLayout {
280
    return (pipeline as WebGPURenderPipeline | WebGPUComputePipeline).handle.getBindGroupLayout(
19✔
281
      group
282
    );
283
  }
284

285
  override _createBindGroupWebGPU(
286
    bindGroupLayout: unknown,
287
    shaderLayout: ShaderLayout | ComputeShaderLayout,
288
    bindings: Bindings,
289
    group: number,
290
    label?: string
291
  ): GPUBindGroup | null {
292
    if (Object.keys(bindings).length === 0) {
45✔
293
      return this.handle.createBindGroup({
7✔
294
        label,
295
        layout: bindGroupLayout as GPUBindGroupLayout,
296
        entries: []
297
      });
298
    }
299

300
    return getBindGroup(
38✔
301
      this,
302
      bindGroupLayout as GPUBindGroupLayout,
303
      shaderLayout,
304
      bindings,
305
      group,
306
      label
307
    );
308
  }
309

310
  submit(commandBuffer?: WebGPUCommandBuffer): void {
311
    let submittedCommandEncoder: WebGPUCommandEncoder | null = null;
84✔
312
    if (!commandBuffer) {
84✔
313
      ({submittedCommandEncoder, commandBuffer} = this._finalizeDefaultCommandEncoderForSubmit());
81✔
314
    }
315

316
    const profiler = getWebGPUCpuHotspotProfiler(this);
84✔
317
    const startTime = profiler ? getTimestamp() : 0;
84✔
318
    const submitReason = getWebGPUCpuHotspotSubmitReason(this);
84✔
319
    const transientUploadBuffers = commandBuffer.transientUploadBuffers;
84✔
320
    let didSubmit = false;
84✔
321
    try {
84✔
322
      this.pushErrorScope('validation');
84✔
323
      const queueSubmitStartTime = profiler ? getTimestamp() : 0;
84✔
324
      this.handle.queue.submit([commandBuffer.handle]);
84✔
325
      didSubmit = true;
84✔
326
      if (profiler) {
84✔
327
        profiler.queueSubmitCount = (profiler.queueSubmitCount || 0) + 1;
42✔
328
        profiler.queueSubmitTimeMs =
42✔
329
          (profiler.queueSubmitTimeMs || 0) + (getTimestamp() - queueSubmitStartTime);
53✔
330
      }
331
      this.popErrorScope((error: GPUError) => {
84✔
332
        this.reportError(new Error(`${this} command submission: ${error.message}`), this)();
×
333
        this.debug();
×
334
      });
335

336
      if (submittedCommandEncoder) {
84✔
337
        const submitResolveKickoffStartTime = profiler ? getTimestamp() : 0;
81✔
338
        scheduleMicrotask(() => {
81✔
339
          submittedCommandEncoder
81✔
340
            .resolveTimeProfilingQuerySet()
341
            .then(() => {
342
              this.commandEncoder._gpuTimeMs = submittedCommandEncoder._gpuTimeMs;
81✔
343
            })
344
            .catch(() => {});
345
        });
346
        if (profiler) {
81✔
347
          profiler.submitResolveKickoffCount = (profiler.submitResolveKickoffCount || 0) + 1;
42✔
348
          profiler.submitResolveKickoffTimeMs =
42✔
349
            (profiler.submitResolveKickoffTimeMs || 0) +
73✔
350
            (getTimestamp() - submitResolveKickoffStartTime);
351
        }
352
      }
353
    } finally {
354
      if (transientUploadBuffers.length) {
84!
NEW
355
        if (didSubmit) {
×
356
          // The GPU may still be reading from the staging buffers after
357
          // queue.submit() returns, so defer destruction until the submitted
358
          // work has fully completed.
NEW
359
          this.handle.queue
×
360
            .onSubmittedWorkDone()
361
            .then(() => {
NEW
362
              for (const uploadBuffer of transientUploadBuffers) {
×
NEW
363
                uploadBuffer.destroy();
×
364
              }
365
            })
366
            .catch(() => {
NEW
367
              for (const uploadBuffer of transientUploadBuffers) {
×
NEW
368
                uploadBuffer.destroy();
×
369
              }
370
            });
371
        } else {
NEW
372
          for (const uploadBuffer of transientUploadBuffers) {
×
NEW
373
            uploadBuffer.destroy();
×
374
          }
375
        }
376
      }
377
      if (profiler) {
84✔
378
        profiler.submitCount = (profiler.submitCount || 0) + 1;
42✔
379
        profiler.submitTimeMs = (profiler.submitTimeMs || 0) + (getTimestamp() - startTime);
42✔
380
        const reasonCountKey =
381
          submitReason === 'query-readback' ? 'queryReadbackSubmitCount' : 'defaultSubmitCount';
42!
382
        const reasonTimeKey =
383
          submitReason === 'query-readback' ? 'queryReadbackSubmitTimeMs' : 'defaultSubmitTimeMs';
42!
384
        profiler[reasonCountKey] = (profiler[reasonCountKey] || 0) + 1;
42✔
385
        profiler[reasonTimeKey] = (profiler[reasonTimeKey] || 0) + (getTimestamp() - startTime);
42✔
386
      }
387
      const commandBufferDestroyStartTime = profiler ? getTimestamp() : 0;
84✔
388
      commandBuffer.destroy();
84✔
389
      if (profiler) {
84✔
390
        profiler.commandBufferDestroyCount = (profiler.commandBufferDestroyCount || 0) + 1;
42✔
391
        profiler.commandBufferDestroyTimeMs =
42✔
392
          (profiler.commandBufferDestroyTimeMs || 0) +
45✔
393
          (getTimestamp() - commandBufferDestroyStartTime);
394
      }
395
    }
396
  }
397

398
  private _finalizeDefaultCommandEncoderForSubmit(): {
399
    submittedCommandEncoder: WebGPUCommandEncoder;
400
    commandBuffer: WebGPUCommandBuffer;
401
  } {
402
    const submittedCommandEncoder = this.commandEncoder;
81✔
403
    if (
81!
404
      submittedCommandEncoder.getTimeProfilingSlotCount() > 0 &&
81!
405
      submittedCommandEncoder.getTimeProfilingQuerySet() instanceof WebGPUQuerySet
406
    ) {
407
      const querySet = submittedCommandEncoder.getTimeProfilingQuerySet() as WebGPUQuerySet;
×
408
      querySet._encodeResolveToReadBuffer(submittedCommandEncoder, {
×
409
        firstQuery: 0,
410
        queryCount: submittedCommandEncoder.getTimeProfilingSlotCount()
411
      });
412
    }
413

414
    const commandBuffer = submittedCommandEncoder.finish();
81✔
415
    this.commandEncoder.destroy();
81✔
416
    this.commandEncoder = this.createCommandEncoder({
81✔
417
      id: submittedCommandEncoder.props.id,
418
      timeProfilingQuerySet: submittedCommandEncoder.getTimeProfilingQuerySet()
419
    });
420

421
    return {submittedCommandEncoder, commandBuffer};
81✔
422
  }
423

424
  // WebGPU specific
425

426
  pushErrorScope(scope: 'validation' | 'out-of-memory'): void {
427
    if (!this.props.debug) {
1,580!
428
      return;
×
429
    }
430
    const profiler = getWebGPUCpuHotspotProfiler(this);
1,580✔
431
    const startTime = profiler ? getTimestamp() : 0;
1,580✔
432
    this.handle.pushErrorScope(scope);
1,580✔
433
    if (profiler) {
1,580✔
434
      profiler.errorScopePushCount = (profiler.errorScopePushCount || 0) + 1;
149✔
435
      profiler.errorScopeTimeMs = (profiler.errorScopeTimeMs || 0) + (getTimestamp() - startTime);
149✔
436
    }
437
  }
438

439
  popErrorScope(handler: (error: GPUError) => void): void {
440
    if (!this.props.debug) {
1,580!
441
      return;
×
442
    }
443
    const profiler = getWebGPUCpuHotspotProfiler(this);
1,580✔
444
    const startTime = profiler ? getTimestamp() : 0;
1,580✔
445
    this.handle
1,580✔
446
      .popErrorScope()
447
      .then((error: GPUError | null) => {
448
        if (error) {
1,178✔
449
          handler(error);
11✔
450
        }
451
      })
452
      .catch((error: unknown) => {
453
        if (this.shouldIgnoreDroppedInstanceError(error, 'popErrorScope')) {
402!
454
          return;
402✔
455
        }
456

457
        const errorMessage = error instanceof Error ? error.message : String(error);
×
458
        this.reportError(new Error(`${this} popErrorScope failed: ${errorMessage}`), this)();
402✔
459
        this.debug();
402✔
460
      });
461
    if (profiler) {
1,580✔
462
      profiler.errorScopePopCount = (profiler.errorScopePopCount || 0) + 1;
149✔
463
      profiler.errorScopeTimeMs = (profiler.errorScopeTimeMs || 0) + (getTimestamp() - startTime);
149✔
464
    }
465
  }
466

467
  // PRIVATE METHODS
468

469
  protected _getInfo(): DeviceInfo {
470
    const [driver, driverVersion] = ((this.adapterInfo as any).driver || '').split(' Version ');
26✔
471

472
    // See https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates
473
    const vendor = this.adapterInfo.vendor || this.adapter.__brand || 'unknown';
26!
474
    const renderer = driver || '';
26✔
475
    const version = driverVersion || '';
26✔
476
    const fallback = Boolean(
26✔
477
      (this.adapterInfo as any).isFallbackAdapter ??
26!
478
        (this.adapter as any).isFallbackAdapter ??
479
        false
480
    );
481
    const softwareRenderer = /SwiftShader/i.test(
26✔
482
      `${vendor} ${renderer} ${this.adapterInfo.architecture || ''}`
26!
483
    );
484

485
    const gpu =
486
      vendor === 'apple' ? 'apple' : softwareRenderer || fallback ? 'software' : 'unknown'; // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',
26!
487
    const gpuArchitecture = this.adapterInfo.architecture || 'unknown';
26!
488
    const gpuBackend = (this.adapterInfo as any).backend || 'unknown';
26✔
489
    const gpuType =
26✔
490
      ((this.adapterInfo as any).type || '').split(' ')[0].toLowerCase() ||
52✔
491
      (softwareRenderer || fallback ? 'cpu' : 'unknown');
52!
492

493
    return {
26✔
494
      type: 'webgpu',
495
      vendor,
496
      renderer,
497
      version,
498
      gpu,
499
      gpuType,
500
      gpuBackend,
501
      gpuArchitecture,
502
      fallback,
503
      shadingLanguage: 'wgsl',
504
      shadingLanguageVersion: 100
505
    };
506
  }
507

508
  shouldIgnoreDroppedInstanceError(error: unknown, operation?: string): boolean {
509
    const errorMessage = error instanceof Error ? error.message : String(error);
405!
510
    return (
405✔
511
      errorMessage.includes('Instance dropped') &&
1,620!
512
      (!operation || errorMessage.includes(operation)) &&
513
      (this._isLost ||
514
        this.info.gpu === 'software' ||
515
        this.info.gpuType === 'cpu' ||
516
        Boolean(this.info.fallback))
517
    );
518
  }
519

520
  protected _getFeatures(): DeviceFeatures {
521
    // Initialize with actual WebGPU Features (note that unknown features may not be in DeviceFeature type)
522
    const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);
26✔
523
    // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133
524
    // @ts-expect-error Chrome Canary v99
525
    if (features.has('depth-clamping')) {
26!
526
      // @ts-expect-error Chrome Canary v99
527
      features.delete('depth-clamping');
×
528
      features.add('depth-clip-control');
×
529
    }
530

531
    // Some subsets of WebGPU extensions correspond to WebGL extensions
532
    if (features.has('texture-compression-bc')) {
26!
533
      features.add('texture-compression-bc5-webgl');
26✔
534
    }
535

536
    if (this.handle.features.has('chromium-experimental-norm16-texture-formats')) {
26!
537
      features.add('norm16-renderable-webgl');
×
538
    }
539

540
    if (this.handle.features.has('chromium-experimental-snorm16-texture-formats')) {
26!
541
      features.add('snorm16-renderable-webgl');
×
542
    }
543

544
    const WEBGPU_ALWAYS_FEATURES: DeviceFeature[] = [
26✔
545
      'compilation-status-async-webgl',
546
      'float32-renderable-webgl',
547
      'float16-renderable-webgl',
548
      'norm16-renderable-webgl',
549
      'texture-filterable-anisotropic-webgl',
550
      'shader-noperspective-interpolation-webgl'
551
    ];
552

553
    for (const feature of WEBGPU_ALWAYS_FEATURES) {
26✔
554
      features.add(feature);
156✔
555
    }
556

557
    return new DeviceFeatures(Array.from(features), this.props._disabledFeatures);
26✔
558
  }
559

560
  override _getDeviceSpecificTextureFormatCapabilities(
561
    capabilities: DeviceTextureFormatCapabilities
562
  ): DeviceTextureFormatCapabilities {
563
    const {format} = capabilities;
72✔
564
    if (format.includes('webgl')) {
72✔
565
      return {format, create: false, render: false, filter: false, blend: false, store: false};
11✔
566
    }
567
    return capabilities;
61✔
568
  }
569
}
570

571
function scheduleMicrotask(callback: () => void): void {
572
  if (globalThis.queueMicrotask) {
81!
573
    globalThis.queueMicrotask(callback);
81✔
574
    return;
81✔
575
  }
576
  Promise.resolve()
×
577
    .then(callback)
578
    .catch(() => {});
579
}
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