@luma.gl/test-utils 9.2.0-alpha.1 → 9.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/create-test-device.d.ts +2 -1
  2. package/dist/create-test-device.d.ts.map +1 -1
  3. package/dist/create-test-device.js +29 -17
  4. package/dist/create-test-device.js.map +1 -1
  5. package/dist/index.cjs +80 -19
  6. package/dist/index.cjs.map +2 -2
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/null-device/null-device.d.ts +1 -0
  12. package/dist/null-device/null-device.d.ts.map +1 -1
  13. package/dist/null-device/null-device.js +4 -1
  14. package/dist/null-device/null-device.js.map +1 -1
  15. package/dist/null-device/resources/null-buffer.d.ts +8 -4
  16. package/dist/null-device/resources/null-buffer.d.ts.map +1 -1
  17. package/dist/null-device/resources/null-buffer.js +41 -4
  18. package/dist/null-device/resources/null-buffer.js.map +1 -1
  19. package/dist/null-device/resources/null-framebuffer.d.ts +1 -0
  20. package/dist/null-device/resources/null-framebuffer.d.ts.map +1 -1
  21. package/dist/null-device/resources/null-framebuffer.js +1 -0
  22. package/dist/null-device/resources/null-framebuffer.js.map +1 -1
  23. package/dist/null-device/resources/null-query-set.d.ts +1 -0
  24. package/dist/null-device/resources/null-query-set.d.ts.map +1 -1
  25. package/dist/null-device/resources/null-query-set.js +1 -0
  26. package/dist/null-device/resources/null-query-set.js.map +1 -1
  27. package/dist/null-device/resources/null-render-pass.d.ts +1 -0
  28. package/dist/null-device/resources/null-render-pass.d.ts.map +1 -1
  29. package/dist/null-device/resources/null-render-pass.js +1 -0
  30. package/dist/null-device/resources/null-render-pass.js.map +1 -1
  31. package/dist/null-device/resources/null-render-pipeline.d.ts +1 -0
  32. package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -1
  33. package/dist/null-device/resources/null-render-pipeline.js +1 -0
  34. package/dist/null-device/resources/null-render-pipeline.js.map +1 -1
  35. package/dist/null-device/resources/null-sampler.d.ts +1 -0
  36. package/dist/null-device/resources/null-sampler.d.ts.map +1 -1
  37. package/dist/null-device/resources/null-sampler.js +1 -0
  38. package/dist/null-device/resources/null-sampler.js.map +1 -1
  39. package/dist/null-device/resources/null-shader.d.ts +1 -0
  40. package/dist/null-device/resources/null-shader.d.ts.map +1 -1
  41. package/dist/null-device/resources/null-shader.js +1 -0
  42. package/dist/null-device/resources/null-shader.js.map +1 -1
  43. package/dist/null-device/resources/null-texture-view.d.ts +1 -0
  44. package/dist/null-device/resources/null-texture-view.d.ts.map +1 -1
  45. package/dist/null-device/resources/null-texture-view.js +1 -0
  46. package/dist/null-device/resources/null-texture-view.js.map +1 -1
  47. package/dist/null-device/resources/null-texture.d.ts +3 -1
  48. package/dist/null-device/resources/null-texture.d.ts.map +1 -1
  49. package/dist/null-device/resources/null-texture.js +4 -0
  50. package/dist/null-device/resources/null-texture.js.map +1 -1
  51. package/dist/null-device/resources/null-transform-feedback.d.ts +1 -0
  52. package/dist/null-device/resources/null-transform-feedback.d.ts.map +1 -1
  53. package/dist/null-device/resources/null-transform-feedback.js +1 -0
  54. package/dist/null-device/resources/null-transform-feedback.js.map +1 -1
  55. package/dist/null-device/resources/null-vertex-array.d.ts +1 -0
  56. package/dist/null-device/resources/null-vertex-array.d.ts.map +1 -1
  57. package/dist/null-device/resources/null-vertex-array.js +1 -0
  58. package/dist/null-device/resources/null-vertex-array.js.map +1 -1
  59. package/dist/performance-test-runner.js +1 -1
  60. package/dist/performance-test-runner.js.map +1 -1
  61. package/package.json +7 -7
  62. package/src/create-test-device.ts +42 -28
  63. package/src/index.ts +1 -0
  64. package/src/null-device/null-device.ts +5 -1
  65. package/src/null-device/resources/null-buffer.ts +60 -8
  66. package/src/null-device/resources/null-framebuffer.ts +1 -0
  67. package/src/null-device/resources/null-query-set.ts +1 -0
  68. package/src/null-device/resources/null-render-pass.ts +1 -0
  69. package/src/null-device/resources/null-render-pipeline.ts +2 -0
  70. package/src/null-device/resources/null-sampler.ts +1 -0
  71. package/src/null-device/resources/null-shader.ts +1 -0
  72. package/src/null-device/resources/null-texture-view.ts +2 -0
  73. package/src/null-device/resources/null-texture.ts +10 -3
  74. package/src/null-device/resources/null-transform-feedback.ts +1 -0
  75. package/src/null-device/resources/null-vertex-array.ts +1 -0
  76. package/src/performance-test-runner.ts +1 -1
@@ -3,7 +3,8 @@ import { WebGLDevice } from '@luma.gl/webgl';
3
3
  import { WebGPUDevice } from '@luma.gl/webgpu';
4
4
  import { NullDevice } from "./null-device/null-device.js";
5
5
  /** Includes WebGPU device if available */
6
- export declare function getTestDevices(types?: ('webgl' | 'webgpu' | 'null' | 'unknown')[]): Promise<Device[]>;
6
+ export declare function getTestDevices(types?: Readonly<('webgl' | 'webgpu' | 'null' | 'unknown')[]>): Promise<Device[]>;
7
+ export declare function getTestDevice(type: 'webgl' | 'webgpu' | 'null' | 'unknown'): Promise<Device | null>;
7
8
  /** returns WebGPU device promise, if available */
8
9
  export declare function getWebGPUTestDevice(): Promise<WebGPUDevice | null>;
9
10
  /** returns WebGL device promise, if available */
@@ -1 +1 @@
1
- {"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAgB,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAgB,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,qCAAkC;AA8BrD,0CAA0C;AAC1C,wBAAsB,cAAc,CAClC,KAAK,GAAE,CAAC,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,EAAwB,GACvE,OAAO,CAAC,MAAM,EAAE,CAAC,CAInB;AAED,kDAAkD;AAClD,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAElE;AAED,iDAAiD;AACjD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,WAAW,CAAC,CAE/D;AAED,gDAAgD;AAChD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE7D"}
1
+ {"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAgB,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAgB,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,qCAAkC;AAWrD,0CAA0C;AAC1C,wBAAsB,cAAc,CAClC,KAAK,GAAE,QAAQ,CAAC,CAAC,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAuB,GACjF,OAAO,CAAC,MAAM,EAAE,CAAC,CAInB;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAC5C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAED,kDAAkD;AAClD,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAElE;AAED,iDAAiD;AACjD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,WAAW,CAAC,CAE/D;AAED,gDAAgD;AAChD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE7D"}
@@ -5,21 +5,7 @@ import { luma, log } from '@luma.gl/core';
5
5
  import { webgl2Adapter } from '@luma.gl/webgl';
6
6
  import { webgpuAdapter } from '@luma.gl/webgpu';
7
7
  import { nullAdapter } from "./null-device/null-adapter.js";
8
- const DEFAULT_CANVAS_CONTEXT_PROPS = {
9
- width: 1,
10
- height: 1
11
- };
12
- // TODO - replace with Promise.withResolvers once we upgrade TS baseline
13
- const withResolvers = () => {
14
- let resolve;
15
- let reject;
16
- const promise = new Promise((_resolve, _reject) => {
17
- resolve = _resolve;
18
- reject = _reject;
19
- });
20
- // @ts-ignore Assigned in callback.
21
- return { promise, resolve, reject };
22
- };
8
+ const DEFAULT_CANVAS_CONTEXT_PROPS = { width: 1, height: 1 };
23
9
  /** A null device intended for testing - @note Only available after getTestDevices() has completed */
24
10
  let nullDevicePromise = makeNullTestDevice();
25
11
  /** This WebGL Device can be used directly but will not have WebGL debugging initialized */
@@ -28,7 +14,21 @@ const webglDevicePromise = makeWebGLTestDevice();
28
14
  const webgpuDevicePromise = makeWebGPUTestDevice();
29
15
  /** Includes WebGPU device if available */
30
16
  export async function getTestDevices(types = ['webgl', 'webgpu']) {
31
- return [await getNullTestDevice(), await getWebGLTestDevice(), await getWebGPUTestDevice()].filter(device => types.includes(device?.type));
17
+ const promises = types.map(type => getTestDevice(type));
18
+ const devices = await Promise.all(promises);
19
+ return devices.filter(device => device !== null);
20
+ }
21
+ export async function getTestDevice(type) {
22
+ switch (type) {
23
+ case 'webgl':
24
+ return webglDevicePromise;
25
+ case 'webgpu':
26
+ return webgpuDevicePromise;
27
+ case 'null':
28
+ return nullDevicePromise;
29
+ case 'unknown':
30
+ return null;
31
+ }
32
32
  }
33
33
  /** returns WebGPU device promise, if available */
34
34
  export function getWebGPUTestDevice() {
@@ -88,7 +88,7 @@ async function makeNullTestDevice() {
88
88
  try {
89
89
  const nullDevice = (await luma.createDevice({
90
90
  id: 'null-test-device',
91
- type: 'unknown',
91
+ type: 'null',
92
92
  adapters: [nullAdapter],
93
93
  createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS,
94
94
  debug: true,
@@ -103,4 +103,16 @@ async function makeNullTestDevice() {
103
103
  }
104
104
  return nullDeviceResolvers.promise;
105
105
  }
106
+ // HELPERS
107
+ // TODO - replace with Promise.withResolvers once we upgrade TS baseline
108
+ function withResolvers() {
109
+ let resolve;
110
+ let reject;
111
+ const promise = new Promise((_resolve, _reject) => {
112
+ resolve = _resolve;
113
+ reject = _reject;
114
+ });
115
+ // @ts-ignore Assigned in callback.
116
+ return { promise, resolve, reject };
117
+ }
106
118
  //# sourceMappingURL=create-test-device.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-test-device.js","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,IAAI,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAc,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAe,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAC,WAAW,EAAC,sCAAmC;AAGvD,MAAM,4BAA4B,GAAuB;IACvD,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,wEAAwE;AACxE,MAAM,aAAa,GAAG,GAIpB,EAAE;IACF,IAAI,OAAO,CAAC;IACZ,IAAI,MAAM,CAAC;IACX,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QACnD,OAAO,GAAG,QAAQ,CAAC;QACnB,MAAM,GAAG,OAAO,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,mCAAmC;IACnC,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AACpC,CAAC,CAAC;AAEF,qGAAqG;AACrG,IAAI,iBAAiB,GAAG,kBAAkB,EAAE,CAAC;AAC7C,2FAA2F;AAC3F,MAAM,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;AACjD,wGAAwG;AACxG,MAAM,mBAAmB,GAAG,oBAAoB,EAAE,CAAC;AAEnD,0CAA0C;AAC1C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAqD,CAAC,OAAO,EAAE,QAAQ,CAAC;IAExE,OACE,CAAC,MAAM,i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6 +30,7 @@ __export(dist_exports, {
30
30
  getLeakedResources: () => getLeakedResources,
31
31
  getNullTestDevice: () => getNullTestDevice,
32
32
  getResourceCounts: () => getResourceCounts,
33
+ getTestDevice: () => getTestDevice,
33
34
  getTestDevices: () => getTestDevices,
34
35
  getWebGLTestDevice: () => getWebGLTestDevice,
35
36
  getWebGPUTestDevice: () => getWebGPUTestDevice,
@@ -106,6 +107,7 @@ var import_core4 = require("@luma.gl/core");
106
107
  var import_core3 = require("@luma.gl/core");
107
108
  var NullFramebuffer = class extends import_core3.Framebuffer {
108
109
  device;
110
+ handle = null;
109
111
  colorAttachments = [];
110
112
  depthStencilAttachment = null;
111
113
  constructor(device, props) {
@@ -143,26 +145,60 @@ var NullCanvasContext = class extends import_core4.CanvasContext {
143
145
  var import_core5 = require("@luma.gl/core");
144
146
  var NullBuffer = class extends import_core5.Buffer {
145
147
  device;
148
+ handle = "null";
146
149
  byteLength;
150
+ _storage;
147
151
  constructor(device, props = {}) {
148
152
  super(device, props);
149
153
  this.device = device;
150
154
  const byteOffset = props.byteOffset || 0;
151
155
  const byteLength = props.byteLength ?? (props.data ? props.data.byteLength + byteOffset : 0);
152
156
  this.byteLength = byteLength;
157
+ this._storage = new ArrayBuffer(byteLength);
158
+ if (props.data) {
159
+ this.write(props.data, byteOffset);
160
+ }
153
161
  this.trackAllocatedMemory(byteLength);
154
162
  }
155
163
  destroy() {
156
164
  if (!this.destroyed) {
157
165
  super.destroy();
158
166
  this.trackDeallocatedMemory();
167
+ this.handle = null;
168
+ this._storage = new ArrayBuffer(0);
169
+ }
170
+ }
171
+ write(data, byteOffset = 0) {
172
+ const source = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
173
+ const target = new Uint8Array(this._storage, byteOffset, source.byteLength);
174
+ if (byteOffset + source.byteLength > this.byteLength) {
175
+ throw new RangeError(`NullBuffer.write(): write would overflow buffer`);
159
176
  }
177
+ target.set(source);
178
+ this._setDebugData(data, byteOffset, source.byteLength);
179
+ }
180
+ async mapAndWriteAsync(callback, byteOffset = 0, byteLength = this.byteLength - byteOffset) {
181
+ const view = new Uint8Array(this._storage, byteOffset, byteLength);
182
+ const tempBuffer = new Uint8Array(view.length);
183
+ callback(tempBuffer.buffer, "copied");
184
+ view.set(tempBuffer);
185
+ this._setDebugData(view, byteOffset, byteLength);
160
186
  }
161
187
  async readAsync(byteOffset = 0, byteLength) {
162
188
  byteLength = byteLength ?? this.byteLength - byteOffset;
163
- return new Uint8Array(byteLength);
189
+ if (byteOffset + byteLength > this.byteLength) {
190
+ throw new RangeError(`NullBuffer.readAsync(): read would overflow buffer`);
191
+ }
192
+ const view = new Uint8Array(this._storage, byteOffset, byteLength);
193
+ return new Uint8Array(view);
164
194
  }
165
- write(data, byteOffset = 0) {
195
+ async mapAndReadAsync(callback, byteOffset = 0, byteLength = this.byteLength - byteOffset) {
196
+ const view = new Uint8Array(this._storage, byteOffset, byteLength);
197
+ const copy = new Uint8Array(view);
198
+ return callback(copy.buffer, "copied");
199
+ }
200
+ readSyncWebGL() {
201
+ throw new Error("NullBuffer.readSyncWebGL() not implemented");
166
202
  }
167
203
  };
168
204
 
@@ -170,6 +206,7 @@ var NullBuffer = class extends import_core5.Buffer {
170
206
  var import_core6 = require("@luma.gl/core");
171
207
  var NullShader = class extends import_core6.Shader {
172
208
  device;
209
+ handle = null;
173
210
  constructor(device, props) {
174
211
  super(device, props);
175
212
  this.device = device;
@@ -216,6 +253,7 @@ var NullCommandBuffer = class extends import_core7.CommandBuffer {
216
253
  var import_core8 = require("@luma.gl/core");
217
254
  var NullRenderPass = class extends import_core8.RenderPass {
218
255
  device;
256
+ handle = null;
219
257
  constructor(device, props) {
220
258
  super(device, props);
221
259
  this.device = device;
@@ -275,6 +313,7 @@ var NullCommandEncoder = class extends import_core9.CommandEncoder {
275
313
  var import_core10 = require("@luma.gl/core");
276
314
  var NullSampler = class extends import_core10.Sampler {
277
315
  device;
316
+ handle = null;
278
317
  constructor(device, props) {
279
318
  super(device, props);
280
319
  this.device = device;
@@ -288,6 +327,7 @@ var import_core12 = require("@luma.gl/core");
288
327
  var import_core11 = require("@luma.gl/core");
289
328
  var NullTextureView = class extends import_core11.TextureView {
290
329
  device;
330
+ handle = null;
291
331
  texture;
292
332
  constructor(device, props) {
293
333
  super(device, { ...import_core11.Texture.defaultProps, ...props });
@@ -299,6 +339,7 @@ var NullTextureView = class extends import_core11.TextureView {
299
339
  // dist/null-device/resources/null-texture.js
300
340
  var NullTexture = class extends import_core12.Texture {
301
341
  device;
342
+ handle = null;
302
343
  sampler;
303
344
  view;
304
345
  constructor(device, props) {
@@ -336,6 +377,8 @@ var NullTexture = class extends import_core12.Texture {
336
377
  this.height = height;
337
378
  return { width, height };
338
379
  }
380
+ setSampler(sampler) {
381
+ }
339
382
  copyImageData(options) {
340
383
  throw new Error("copyImageData not implemented");
341
384
  }
@@ -347,6 +390,7 @@ var NullTexture = class extends import_core12.Texture {
347
390
  var import_core13 = require("@luma.gl/core");
348
391
  var NullRenderPipeline = class extends import_core13.RenderPipeline {
349
392
  device;
393
+ handle = null;
350
394
  vs;
351
395
  fs;
352
396
  uniforms = {};
@@ -377,6 +421,7 @@ var NullRenderPipeline = class extends import_core13.RenderPipeline {
377
421
  var import_core14 = require("@luma.gl/core");
378
422
  var NullVertexArray = class extends import_core14.VertexArray {
379
423
  device;
424
+ handle = null;
380
425
  // Create a VertexArray
381
426
  constructor(device, props) {
382
427
  super(device, props);
@@ -405,6 +450,7 @@ var NullVertexArray = class extends import_core14.VertexArray {
405
450
  var import_core15 = require("@luma.gl/core");
406
451
  var NullTransformFeedback = class extends import_core15.TransformFeedback {
407
452
  device;
453
+ handle = null;
408
454
  layout;
409
455
  buffers = {};
410
456
  constructor(device, props) {
@@ -438,6 +484,7 @@ var NullTransformFeedback = class extends import_core15.TransformFeedback {
438
484
  var import_core16 = require("@luma.gl/core");
439
485
  var NullQuerySet = class extends import_core16.QuerySet {
440
486
  device;
487
+ handle = null;
441
488
  constructor(device, props) {
442
489
  super(device, props);
443
490
  this.device = device;
@@ -461,7 +508,7 @@ var NullDevice = class extends import_core17.Device {
461
508
  lost;
462
509
  constructor(props) {
463
510
  super({ ...props, id: props.id || "null-device" });
464
- const canvasContextProps = props.createCanvasContext === true ? {} : props.createCanvasContext;
511
+ const canvasContextProps = import_core17.Device._getCanvasContextProps(props);
465
512
  this.canvasContext = new NullCanvasContext(this, canvasContextProps);
466
513
  this.lost = new Promise((resolve) => {
467
514
  });
@@ -477,6 +524,9 @@ var NullDevice = class extends import_core17.Device {
477
524
  return false;
478
525
  }
479
526
  // IMPLEMENTATION OF ABSTRACT DEVICE
527
+ getTextureByteAlignment() {
528
+ return 1;
529
+ }
480
530
  createCanvasContext(props) {
481
531
  return new NullCanvasContext(this, props);
482
532
  }
@@ -567,24 +617,26 @@ var NullAdapter = class extends import_core18.Adapter {
567
617
  var nullAdapter = new NullAdapter();
568
618
 
569
619
  // dist/create-test-device.js
570
- var DEFAULT_CANVAS_CONTEXT_PROPS = {
571
- width: 1,
572
- height: 1
573
- };
574
- var withResolvers = () => {
575
- let resolve;
576
- let reject;
577
- const promise = new Promise((_resolve, _reject) => {
578
- resolve = _resolve;
579
- reject = _reject;
580
- });
581
- return { promise, resolve, reject };
582
- };
620
+ var DEFAULT_CANVAS_CONTEXT_PROPS = { width: 1, height: 1 };
583
621
  var nullDevicePromise = makeNullTestDevice();
584
622
  var webglDevicePromise = makeWebGLTestDevice();
585
623
  var webgpuDevicePromise = makeWebGPUTestDevice();
586
624
  async function getTestDevices(types = ["webgl", "webgpu"]) {
587
- return [await getNullTestDevice(), await getWebGLTestDevice(), await getWebGPUTestDevice()].filter((device) => types.includes(device == null ? void 0 : device.type));
625
+ const promises = types.map((type) => getTestDevice(type));
626
+ const devices = await Promise.all(promises);
627
+ return devices.filter((device) => device !== null);
628
+ }
629
+ async function getTestDevice(type) {
630
+ switch (type) {
631
+ case "webgl":
632
+ return webglDevicePromise;
633
+ case "webgpu":
634
+ return webgpuDevicePromise;
635
+ case "null":
636
+ return nullDevicePromise;
637
+ case "unknown":
638
+ return null;
639
+ }
588
640
  }
589
641
  function getWebGPUTestDevice() {
590
642
  return webgpuDevicePromise;
@@ -635,7 +687,7 @@ async function makeNullTestDevice() {
635
687
  try {
636
688
  const nullDevice = await import_core19.luma.createDevice({
637
689
  id: "null-test-device",
638
- type: "unknown",
690
+ type: "null",
639
691
  adapters: [nullAdapter],
640
692
  createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS,
641
693
  debug: true,
@@ -648,6 +700,15 @@ async function makeNullTestDevice() {
648
700
  }
649
701
  return nullDeviceResolvers.promise;
650
702
  }
703
+ function withResolvers() {
704
+ let resolve;
705
+ let reject;
706
+ const promise = new Promise((_resolve, _reject) => {
707
+ resolve = _resolve;
708
+ reject = _reject;
709
+ });
710
+ return { promise, resolve, reject };
711
+ }
651
712
 
652
713
  // dist/deprecated/classic-animation-loop.js
653
714
  var import_core20 = require("@luma.gl/core");
@@ -1352,7 +1413,7 @@ var PerformanceTestRunner = class extends TestRunner {
1352
1413
  (_a = this._fps) == null ? void 0 : _a.timeEnd();
1353
1414
  (_b = this._fps) == null ? void 0 : _b.timeStart();
1354
1415
  if (this._fps.count > this.testOptions.maxFramesToRender) {
1355
- animationProps.done();
1416
+ animationProps["done"]();
1356
1417
  }
1357
1418
  return true;
1358
1419
  }