@luma.gl/test-utils 9.3.0-alpha.4 → 9.3.0-alpha.8

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 (68) hide show
  1. package/dist/create-test-device.d.ts +19 -0
  2. package/dist/create-test-device.d.ts.map +1 -1
  3. package/dist/create-test-device.js +83 -14
  4. package/dist/create-test-device.js.map +1 -1
  5. package/dist/deprecated/classic-animation-loop.d.ts.map +1 -1
  6. package/dist/deprecated/classic-animation-loop.js +2 -10
  7. package/dist/deprecated/classic-animation-loop.js.map +1 -1
  8. package/dist/deprecated/sync-test-device.d.ts +0 -5
  9. package/dist/deprecated/sync-test-device.d.ts.map +1 -1
  10. package/dist/deprecated/sync-test-device.js +11 -1
  11. package/dist/deprecated/sync-test-device.js.map +1 -1
  12. package/dist/index.cjs +185 -74
  13. package/dist/index.cjs.map +4 -4
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/null-device/null-canvas-context.d.ts.map +1 -1
  19. package/dist/null-device/null-canvas-context.js +1 -0
  20. package/dist/null-device/null-canvas-context.js.map +1 -1
  21. package/dist/null-device/null-device.d.ts +5 -3
  22. package/dist/null-device/null-device.d.ts.map +1 -1
  23. package/dist/null-device/null-device.js +16 -4
  24. package/dist/null-device/null-device.js.map +1 -1
  25. package/dist/null-device/resources/null-command-buffer.d.ts +8 -8
  26. package/dist/null-device/resources/null-command-buffer.d.ts.map +1 -1
  27. package/dist/null-device/resources/null-command-buffer.js +16 -6
  28. package/dist/null-device/resources/null-command-buffer.js.map +1 -1
  29. package/dist/null-device/resources/null-command-encoder.d.ts +8 -7
  30. package/dist/null-device/resources/null-command-encoder.d.ts.map +1 -1
  31. package/dist/null-device/resources/null-command-encoder.js +24 -9
  32. package/dist/null-device/resources/null-command-encoder.js.map +1 -1
  33. package/dist/null-device/resources/null-query-set.d.ts +6 -0
  34. package/dist/null-device/resources/null-query-set.d.ts.map +1 -1
  35. package/dist/null-device/resources/null-query-set.js +11 -0
  36. package/dist/null-device/resources/null-query-set.js.map +1 -1
  37. package/dist/null-device/resources/null-render-pass.d.ts.map +1 -1
  38. package/dist/null-device/resources/null-render-pass.js +6 -1
  39. package/dist/null-device/resources/null-render-pass.js.map +1 -1
  40. package/dist/null-device/resources/null-render-pipeline.d.ts +3 -4
  41. package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -1
  42. package/dist/null-device/resources/null-render-pipeline.js +0 -5
  43. package/dist/null-device/resources/null-render-pipeline.js.map +1 -1
  44. package/dist/null-device/resources/null-texture.d.ts +3 -3
  45. package/dist/null-device/resources/null-texture.d.ts.map +1 -1
  46. package/dist/null-device/resources/null-texture.js +9 -13
  47. package/dist/null-device/resources/null-texture.js.map +1 -1
  48. package/dist/test-runner.d.ts +1 -1
  49. package/dist/test-runner.d.ts.map +1 -1
  50. package/dist/test-runner.js +2 -1
  51. package/dist/test-runner.js.map +1 -1
  52. package/dist/utils/resource-tracker.js +1 -1
  53. package/dist/utils/resource-tracker.js.map +1 -1
  54. package/package.json +7 -7
  55. package/src/create-test-device.ts +113 -14
  56. package/src/deprecated/classic-animation-loop.ts +2 -10
  57. package/src/deprecated/sync-test-device.ts +16 -1
  58. package/src/index.ts +1 -0
  59. package/src/null-device/null-canvas-context.ts +1 -0
  60. package/src/null-device/null-device.ts +21 -4
  61. package/src/null-device/resources/null-command-buffer.ts +18 -8
  62. package/src/null-device/resources/null-command-encoder.ts +25 -9
  63. package/src/null-device/resources/null-query-set.ts +14 -0
  64. package/src/null-device/resources/null-render-pass.ts +6 -1
  65. package/src/null-device/resources/null-render-pipeline.ts +3 -14
  66. package/src/null-device/resources/null-texture.ts +17 -17
  67. package/src/test-runner.ts +2 -1
  68. package/src/utils/resource-tracker.ts +1 -1
package/dist/index.cjs CHANGED
@@ -29,13 +29,14 @@ __export(dist_exports, {
29
29
  deepCopy: () => deepCopy,
30
30
  getLeakedResources: () => getLeakedResources,
31
31
  getNullTestDevice: () => getNullTestDevice,
32
+ getPresentationWebGLTestDevice: () => getPresentationWebGLTestDevice,
32
33
  getResourceCounts: () => getResourceCounts,
33
34
  getTestDevice: () => getTestDevice,
34
35
  getTestDevices: () => getTestDevices,
35
36
  getWebGLTestDevice: () => getWebGLTestDevice,
36
37
  getWebGPUTestDevice: () => getWebGPUTestDevice,
37
38
  nullAdapter: () => nullAdapter,
38
- webglDevice: () => webglDevice2
39
+ webglDevice: () => webglDevice
39
40
  });
40
41
  module.exports = __toCommonJS(dist_exports);
41
42
 
@@ -132,6 +133,7 @@ var NullCanvasContext = class extends import_core4.CanvasContext {
132
133
  this.device = device;
133
134
  this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
134
135
  this._configureDevice();
136
+ this._startObservers();
135
137
  }
136
138
  _getCurrentFramebuffer() {
137
139
  this._framebuffer = this._framebuffer || new NullFramebuffer(this.device, { handle: null });
@@ -231,21 +233,26 @@ var NullCommandBuffer = class extends import_core7.CommandBuffer {
231
233
  super(device, props);
232
234
  this.device = device;
233
235
  }
234
- copyBufferToBuffer(options) {
236
+ copyBufferToBuffer(_options) {
237
+ throw new Error("copyBufferToBuffer is not supported on NullDevice");
235
238
  }
236
- copyBufferToTexture(options) {
239
+ copyBufferToTexture(_options) {
240
+ throw new Error("copyBufferToTexture is not supported on NullDevice");
237
241
  }
238
- copyTextureToBuffer(options) {
242
+ copyTextureToBuffer(_options) {
243
+ throw new Error("copyTextureToBuffer is not supported on NullDevice");
239
244
  }
240
- copyTextureToTexture(options) {
245
+ copyTextureToTexture(_options) {
246
+ throw new Error("copyTextureToTexture is not supported on NullDevice");
241
247
  }
242
248
  pushDebugGroup(groupLabel) {
243
249
  }
244
250
  popDebugGroup() {
245
251
  }
246
- insertDebugMarker(markerLabel) {
252
+ insertDebugMarker(_markerLabel) {
247
253
  }
248
- resolveQuerySet(querySet) {
254
+ resolveQuerySet(_querySet) {
255
+ throw new Error("resolveQuerySet is not supported on NullDevice");
249
256
  }
250
257
  };
251
258
 
@@ -259,6 +266,10 @@ var NullRenderPass = class extends import_core8.RenderPass {
259
266
  this.device = device;
260
267
  }
261
268
  end() {
269
+ if (this.destroyed) {
270
+ return;
271
+ }
272
+ this.destroy();
262
273
  }
263
274
  pushDebugGroup(groupLabel) {
264
275
  }
@@ -282,24 +293,34 @@ var NullCommandEncoder = class extends import_core9.CommandEncoder {
282
293
  super(device, props);
283
294
  this.device = device;
284
295
  }
285
- finish(props) {
286
- return new NullCommandBuffer(this.device, props);
296
+ destroy() {
297
+ this.destroyResource();
298
+ }
299
+ finish(props = {}) {
300
+ const commandBuffer = new NullCommandBuffer(this.device, props);
301
+ this.destroy();
302
+ return commandBuffer;
287
303
  }
288
304
  beginRenderPass(props) {
289
305
  return new NullRenderPass(this.device, props);
290
306
  }
291
- beginComputePass(props) {
292
- throw new Error("ComputePass not supported in WebGL");
307
+ beginComputePass(_props) {
308
+ throw new Error("ComputePass is not supported on NullDevice");
293
309
  }
294
- copyBufferToBuffer(options) {
310
+ copyBufferToBuffer(_options) {
311
+ throw new Error("copyBufferToBuffer is not supported on NullDevice");
295
312
  }
296
- copyBufferToTexture(options) {
313
+ copyBufferToTexture(_options) {
314
+ throw new Error("copyBufferToTexture is not supported on NullDevice");
297
315
  }
298
- copyTextureToBuffer(options) {
316
+ copyTextureToBuffer(_options) {
317
+ throw new Error("copyTextureToBuffer is not supported on NullDevice");
299
318
  }
300
- copyTextureToTexture(options) {
319
+ copyTextureToTexture(_options) {
320
+ throw new Error("copyTextureToTexture is not supported on NullDevice");
301
321
  }
302
- resolveQuerySet(querySet) {
322
+ resolveQuerySet(_querySet) {
323
+ throw new Error("resolveQuerySet is not supported on NullDevice");
303
324
  }
304
325
  pushDebugGroup(groupLabel) {
305
326
  }
@@ -355,6 +376,7 @@ var NullTexture = class extends import_core12.Texture {
355
376
  mipLevelCount: 1,
356
377
  arrayLayerCount: 1
357
378
  });
379
+ this.trackAllocatedMemory(this.getAllocatedByteLength(), "Texture");
358
380
  Object.seal(this);
359
381
  }
360
382
  destroy() {
@@ -367,21 +389,21 @@ var NullTexture = class extends import_core12.Texture {
367
389
  return new NullTextureView(this.device, { ...props, texture: this });
368
390
  }
369
391
  copyExternalImage(options) {
370
- this.trackDeallocatedMemory("Texture");
371
- const bytesPerPixel = 4;
372
- this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, "Texture");
373
392
  return { width: this.width, height: this.height };
374
393
  }
375
394
  setSampler(sampler) {
376
395
  }
377
396
  copyImageData(options) {
378
- throw new Error("copyImageData not implemented");
397
+ super.copyImageData(options);
379
398
  }
380
- readBuffer(options = {}, buffer) {
381
- return this.device.createBuffer({});
399
+ readBuffer(_options = {}, buffer) {
400
+ if (!buffer) {
401
+ throw new Error("buffer required");
402
+ }
403
+ return buffer;
382
404
  }
383
- async readDataAsync(options = {}) {
384
- return new ArrayBuffer(0);
405
+ async readDataAsync(_options = {}) {
406
+ throw new Error(`${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`);
385
407
  }
386
408
  writeBuffer(buffer, options = {}) {
387
409
  }
@@ -396,8 +418,6 @@ var NullRenderPipeline = class extends import_core13.RenderPipeline {
396
418
  handle = null;
397
419
  vs;
398
420
  fs;
399
- uniforms = {};
400
- bindings = {};
401
421
  constructor(device, props) {
402
422
  super(device, props);
403
423
  this.device = device;
@@ -409,9 +429,6 @@ var NullRenderPipeline = class extends import_core13.RenderPipeline {
409
429
  uniforms: []
410
430
  };
411
431
  }
412
- setBindings(bindings) {
413
- Object.assign(this.bindings, bindings);
414
- }
415
432
  draw(options) {
416
433
  const { renderPass, vertexArray } = options;
417
434
  vertexArray.bindBeforeRender(renderPass);
@@ -492,6 +509,17 @@ var NullQuerySet = class extends import_core16.QuerySet {
492
509
  super(device, props);
493
510
  this.device = device;
494
511
  }
512
+ isResultAvailable(_queryIndex) {
513
+ return false;
514
+ }
515
+ async readResults(options) {
516
+ const firstQuery = (options == null ? void 0 : options.firstQuery) || 0;
517
+ const queryCount = (options == null ? void 0 : options.queryCount) || this.props.count - firstQuery;
518
+ return new Array(queryCount).fill(0n);
519
+ }
520
+ async readTimestampDuration(_beginIndex, _endIndex) {
521
+ return 0;
522
+ }
495
523
  };
496
524
 
497
525
  // dist/null-device/resources/null-fence.js
@@ -539,6 +567,8 @@ var NullDevice = class extends import_core18.Device {
539
567
  * @note Has no effect for null contexts
540
568
  */
541
569
  destroy() {
570
+ var _a;
571
+ (_a = this.commandEncoder) == null ? void 0 : _a.destroy();
542
572
  }
543
573
  get isLost() {
544
574
  return false;
@@ -547,6 +577,9 @@ var NullDevice = class extends import_core18.Device {
547
577
  createCanvasContext(props) {
548
578
  return new NullCanvasContext(this, props);
549
579
  }
580
+ createPresentationContext(_props) {
581
+ throw new Error("PresentationContext is not supported on NullDevice");
582
+ }
550
583
  createBuffer(props) {
551
584
  const newProps = this._normalizeBufferProps(props);
552
585
  return new NullBuffer(this, newProps);
@@ -584,13 +617,19 @@ var NullDevice = class extends import_core18.Device {
584
617
  createRenderPipeline(props) {
585
618
  return new NullRenderPipeline(this, props);
586
619
  }
587
- createComputePipeline(props) {
588
- throw new Error("ComputePipeline not supported in WebGL");
620
+ createComputePipeline(_props) {
621
+ throw new Error("ComputePipeline is not supported on NullDevice");
589
622
  }
590
623
  createCommandEncoder(props = {}) {
591
624
  return new NullCommandEncoder(this, props);
592
625
  }
593
- submit() {
626
+ submit(commandBuffer) {
627
+ if (!commandBuffer) {
628
+ commandBuffer = this.commandEncoder.finish({ id: `${this.id}-default-command-buffer` });
629
+ this.commandEncoder.destroy();
630
+ this.commandEncoder = this.createCommandEncoder({ id: `${this.id}-default-command-encoder` });
631
+ }
632
+ commandBuffer.destroy();
594
633
  }
595
634
  setParametersWebGL(parameters) {
596
635
  }
@@ -638,9 +677,8 @@ var nullAdapter = new NullAdapter();
638
677
 
639
678
  // dist/create-test-device.js
640
679
  var DEFAULT_CANVAS_CONTEXT_PROPS = { width: 1, height: 1 };
641
- var nullDevicePromise = makeNullTestDevice();
642
- var webglDevicePromise = makeWebGLTestDevice();
643
- var webgpuDevicePromise = makeWebGPUTestDevice();
680
+ var TEST_DEVICE_CACHE_KEY = "__lumaTestDeviceCache";
681
+ var testDeviceCache = getOrCreateTestDeviceCache();
644
682
  async function getTestDevices(types = ["webgl", "webgpu"]) {
645
683
  const promises = types.map((type) => getTestDevice(type));
646
684
  const devices = await Promise.all(promises);
@@ -649,23 +687,49 @@ async function getTestDevices(types = ["webgl", "webgpu"]) {
649
687
  async function getTestDevice(type) {
650
688
  switch (type) {
651
689
  case "webgl":
652
- return webglDevicePromise;
690
+ return getOrCreateWebGLTestDevicePromise();
653
691
  case "webgpu":
654
- return webgpuDevicePromise;
692
+ return getWebGPUTestDevice();
655
693
  case "null":
656
- return nullDevicePromise;
694
+ return getOrCreateNullTestDevicePromise();
657
695
  case "unknown":
658
696
  return null;
659
697
  }
660
698
  }
661
- function getWebGPUTestDevice() {
662
- return webgpuDevicePromise;
699
+ async function getWebGPUTestDevice() {
700
+ const webgpuDevice = await getOrCreateWebGPUTestDevicePromise();
701
+ if (webgpuDevice == null ? void 0 : webgpuDevice.isLost) {
702
+ if (testDeviceCache.webgpuDevicePromise) {
703
+ testDeviceCache.webgpuDevicePromise = null;
704
+ }
705
+ return getOrCreateWebGPUTestDevicePromise();
706
+ }
707
+ return webgpuDevice;
663
708
  }
664
709
  async function getWebGLTestDevice() {
665
- return webglDevicePromise;
710
+ return getOrCreateWebGLTestDevicePromise();
711
+ }
712
+ async function getPresentationWebGLTestDevice() {
713
+ return getOrCreatePresentationWebGLTestDevicePromise();
666
714
  }
667
715
  async function getNullTestDevice() {
668
- return nullDevicePromise;
716
+ return getOrCreateNullTestDevicePromise();
717
+ }
718
+ function getOrCreateWebGPUTestDevicePromise() {
719
+ testDeviceCache.webgpuDevicePromise ||= makeWebGPUTestDevice();
720
+ return testDeviceCache.webgpuDevicePromise;
721
+ }
722
+ function getOrCreateWebGLTestDevicePromise() {
723
+ testDeviceCache.webglDevicePromise ||= makeWebGLTestDevice();
724
+ return testDeviceCache.webglDevicePromise;
725
+ }
726
+ function getOrCreatePresentationWebGLTestDevicePromise() {
727
+ testDeviceCache.presentationWebglDevicePromise ||= makePresentationWebGLTestDevice();
728
+ return testDeviceCache.presentationWebglDevicePromise;
729
+ }
730
+ function getOrCreateNullTestDevicePromise() {
731
+ testDeviceCache.nullDevicePromise ||= makeNullTestDevice();
732
+ return testDeviceCache.nullDevicePromise;
669
733
  }
670
734
  async function makeWebGPUTestDevice() {
671
735
  const webgpuDeviceResolvers = withResolvers();
@@ -677,6 +741,11 @@ async function makeWebGPUTestDevice() {
677
741
  createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS,
678
742
  debug: true
679
743
  });
744
+ webgpuDevice.lost.finally(() => {
745
+ if (testDeviceCache.webgpuDevicePromise === webgpuDeviceResolvers.promise) {
746
+ testDeviceCache.webgpuDevicePromise = null;
747
+ }
748
+ });
680
749
  webgpuDeviceResolvers.resolve(webgpuDevice);
681
750
  } catch (error) {
682
751
  import_core20.log.error(String(error))();
@@ -687,20 +756,50 @@ async function makeWebGPUTestDevice() {
687
756
  async function makeWebGLTestDevice() {
688
757
  const webglDeviceResolvers = withResolvers();
689
758
  try {
690
- const webglDevice3 = await import_core20.luma.createDevice({
759
+ const webglDevice2 = await import_core20.luma.createDevice({
691
760
  id: "webgl-test-device",
692
761
  type: "webgl",
693
762
  adapters: [import_webgl2.webgl2Adapter],
694
763
  createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS,
695
764
  debug: true
696
765
  });
697
- webglDeviceResolvers.resolve(webglDevice3);
766
+ webglDevice2.lost.finally(() => {
767
+ if (testDeviceCache.webglDevicePromise === webglDeviceResolvers.promise) {
768
+ testDeviceCache.webglDevicePromise = null;
769
+ }
770
+ });
771
+ webglDeviceResolvers.resolve(webglDevice2);
698
772
  } catch (error) {
699
773
  import_core20.log.error(String(error))();
700
774
  webglDeviceResolvers.resolve(null);
701
775
  }
702
776
  return webglDeviceResolvers.promise;
703
777
  }
778
+ async function makePresentationWebGLTestDevice() {
779
+ if (typeof OffscreenCanvas === "undefined") {
780
+ return null;
781
+ }
782
+ const presentationWebGLDeviceResolvers = withResolvers();
783
+ try {
784
+ const webglDevice2 = await import_core20.luma.createDevice({
785
+ id: "webgl-presentation-context-test-device",
786
+ type: "webgl",
787
+ adapters: [import_webgl2.webgl2Adapter],
788
+ createCanvasContext: { canvas: new OffscreenCanvas(4, 4) },
789
+ debug: true
790
+ });
791
+ webglDevice2.lost.finally(() => {
792
+ if (testDeviceCache.presentationWebglDevicePromise === presentationWebGLDeviceResolvers.promise) {
793
+ testDeviceCache.presentationWebglDevicePromise = null;
794
+ }
795
+ });
796
+ presentationWebGLDeviceResolvers.resolve(webglDevice2);
797
+ } catch (error) {
798
+ import_core20.log.error(String(error))();
799
+ presentationWebGLDeviceResolvers.resolve(null);
800
+ }
801
+ return presentationWebGLDeviceResolvers.promise;
802
+ }
704
803
  async function makeNullTestDevice() {
705
804
  const nullDeviceResolvers = withResolvers();
706
805
  try {
@@ -714,10 +813,20 @@ async function makeNullTestDevice() {
714
813
  nullDeviceResolvers.resolve(nullDevice);
715
814
  } catch (error) {
716
815
  import_core20.log.error(String(error))();
717
- nullDevicePromise = Promise.resolve(null);
816
+ testDeviceCache.nullDevicePromise = Promise.resolve(null);
718
817
  }
719
818
  return nullDeviceResolvers.promise;
720
819
  }
820
+ function getOrCreateTestDeviceCache() {
821
+ const rootObject = globalThis;
822
+ rootObject[TEST_DEVICE_CACHE_KEY] ||= {
823
+ nullDevicePromise: null,
824
+ webglDevicePromise: null,
825
+ presentationWebglDevicePromise: null,
826
+ webgpuDevicePromise: null
827
+ };
828
+ return rootObject[TEST_DEVICE_CACHE_KEY];
829
+ }
721
830
  function withResolvers() {
722
831
  let resolve;
723
832
  let reject;
@@ -728,11 +837,36 @@ function withResolvers() {
728
837
  return { promise, resolve, reject };
729
838
  }
730
839
 
840
+ // dist/deprecated/sync-test-device.js
841
+ var import_webgl3 = require("@luma.gl/webgl");
842
+ var DEFAULT_CANVAS_CONTEXT_PROPS2 = {
843
+ width: 1,
844
+ height: 1
845
+ };
846
+ function createTestDevice() {
847
+ if (cachedWebglDevice) {
848
+ return cachedWebglDevice;
849
+ }
850
+ if (typeof navigator === "undefined" || typeof document === "undefined" || typeof HTMLCanvasElement === "undefined") {
851
+ return null;
852
+ }
853
+ try {
854
+ cachedWebglDevice = new import_webgl3.WebGLDevice({ createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS2 });
855
+ return cachedWebglDevice;
856
+ } catch (error) {
857
+ console.error(`Failed to created device: ${error.message}`);
858
+ debugger;
859
+ return null;
860
+ }
861
+ }
862
+ var cachedWebglDevice = null;
863
+ var webglDevice = createTestDevice();
864
+
731
865
  // dist/deprecated/classic-animation-loop.js
732
866
  var import_core21 = require("@luma.gl/core");
733
867
  var import_engine = require("@luma.gl/engine");
734
868
  var import_env = require("@probe.gl/env");
735
- var import_webgl3 = require("@luma.gl/webgl");
869
+ var import_webgl4 = require("@luma.gl/webgl");
736
870
  var isPage = (0, import_env.isBrowser)() && typeof document !== "undefined";
737
871
  function getHTMLCanvasElement(canvas) {
738
872
  return typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement ? canvas : null;
@@ -798,9 +932,9 @@ var ClassicAnimationLoop = class {
798
932
  this.device = props.device;
799
933
  this.gl = this.device && this.device.gl || props.gl;
800
934
  this.stats = props.stats;
935
+ this.frameRate = this.stats.get("Frame Rate");
801
936
  this.cpuTime = this.stats.get("CPU Time");
802
937
  this.gpuTime = this.stats.get("GPU Time");
803
- this.frameRate = this.stats.get("Frame Rate");
804
938
  this.setProps({
805
939
  autoResizeViewport: props.autoResizeViewport,
806
940
  autoResizeDrawingBuffer: props.autoResizeDrawingBuffer,
@@ -1091,7 +1225,7 @@ var ClassicAnimationLoop = class {
1091
1225
  const deviceProps = { ...this.props, ...props, ...this.props.glOptions };
1092
1226
  this.device = await this.onCreateDevice(deviceProps);
1093
1227
  this.gl = this.device.gl;
1094
- (0, import_webgl3.resetGLParameters)(this.gl);
1228
+ (0, import_webgl4.resetGLParameters)(this.gl);
1095
1229
  this._createInfoDiv();
1096
1230
  }
1097
1231
  _createInfoDiv() {
@@ -1119,13 +1253,7 @@ var ClassicAnimationLoop = class {
1119
1253
  _getSizeAndAspect() {
1120
1254
  const width = this.gl.drawingBufferWidth;
1121
1255
  const height = this.gl.drawingBufferHeight;
1122
- let aspect = 1;
1123
- const canvas = getHTMLCanvasElement(this.gl.canvas);
1124
- if (canvas && canvas.clientHeight) {
1125
- aspect = canvas.clientWidth / canvas.clientHeight;
1126
- } else if (width > 0 && height > 0) {
1127
- aspect = width / height;
1128
- }
1256
+ const aspect = width > 0 && height > 0 ? width / height : 1;
1129
1257
  return { width, height, aspect };
1130
1258
  }
1131
1259
  /** Default viewport setup */
@@ -1198,7 +1326,7 @@ var DEFAULT_TEST_PROPS = {
1198
1326
  imageDiffOptions: void 0
1199
1327
  };
1200
1328
  var TestRunner = class {
1201
- device = webglDevice;
1329
+ device = createTestDevice();
1202
1330
  props;
1203
1331
  isRunning = false;
1204
1332
  testOptions = { ...DEFAULT_TEST_PROPS };
@@ -1470,7 +1598,7 @@ function deepCopy(object) {
1470
1598
 
1471
1599
  // dist/utils/resource-tracker.js
1472
1600
  function getResourceCounts() {
1473
- const resourceStats = luma.stats.get("Resource Counts");
1601
+ const resourceStats = luma.stats.get("GPU Resource Counts");
1474
1602
  return {
1475
1603
  Texture2D: resourceStats.get("Texture2Ds Active").count,
1476
1604
  Buffer: resourceStats.get("Buffers Active").count
@@ -1490,21 +1618,4 @@ function getLeakedResources(startCounts, endCounts) {
1490
1618
  }
1491
1619
  return leakedResources;
1492
1620
  }
1493
-
1494
- // dist/deprecated/sync-test-device.js
1495
- var import_webgl4 = require("@luma.gl/webgl");
1496
- var DEFAULT_CANVAS_CONTEXT_PROPS2 = {
1497
- width: 1,
1498
- height: 1
1499
- };
1500
- function createTestDevice() {
1501
- try {
1502
- return new import_webgl4.WebGLDevice({ createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS2 });
1503
- } catch (error) {
1504
- console.error(`Failed to created device: ${error.message}`);
1505
- debugger;
1506
- return null;
1507
- }
1508
- }
1509
- var webglDevice2 = createTestDevice();
1510
1621
  //# sourceMappingURL=index.cjs.map