@luma.gl/test-utils 9.0.0-beta.5 → 9.0.0-beta.7

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 (106) hide show
  1. package/dist/create-test-device.d.ts +5 -5
  2. package/dist/create-test-device.d.ts.map +1 -1
  3. package/dist/create-test-device.js +30 -23
  4. package/dist/engine/classic-animation-loop.d.ts.map +1 -1
  5. package/dist/engine/classic-animation-loop.js +5 -2
  6. package/dist/index.cjs +554 -20
  7. package/dist/index.cjs.map +4 -4
  8. package/dist/index.d.ts +12 -11
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +10 -9
  11. package/dist/null-device/null-canvas-context.d.ts +24 -0
  12. package/dist/null-device/null-canvas-context.d.ts.map +1 -0
  13. package/dist/null-device/null-canvas-context.js +47 -0
  14. package/dist/null-device/null-device-features.d.ts +30 -0
  15. package/dist/null-device/null-device-features.d.ts.map +1 -0
  16. package/dist/null-device/null-device-features.js +32 -0
  17. package/dist/null-device/null-device-info.d.ts +3 -0
  18. package/dist/null-device/null-device-info.d.ts.map +1 -0
  19. package/dist/null-device/null-device-info.js +14 -0
  20. package/dist/null-device/null-device.d.ts +62 -0
  21. package/dist/null-device/null-device.d.ts.map +1 -0
  22. package/dist/null-device/null-device.js +134 -0
  23. package/dist/null-device/resources/null-buffer.d.ts +12 -0
  24. package/dist/null-device/resources/null-buffer.d.ts.map +1 -0
  25. package/dist/null-device/resources/null-buffer.js +30 -0
  26. package/dist/null-device/resources/null-command-buffer.d.ts +17 -0
  27. package/dist/null-device/resources/null-command-buffer.d.ts.map +1 -0
  28. package/dist/null-device/resources/null-command-buffer.js +20 -0
  29. package/dist/null-device/resources/null-framebuffer.d.ts +8 -0
  30. package/dist/null-device/resources/null-framebuffer.d.ts.map +1 -0
  31. package/dist/null-device/resources/null-framebuffer.js +11 -0
  32. package/dist/null-device/resources/null-query-set.d.ts +7 -0
  33. package/dist/null-device/resources/null-query-set.d.ts.map +1 -0
  34. package/dist/null-device/resources/null-query-set.js +11 -0
  35. package/dist/null-device/resources/null-render-pass.d.ts +14 -0
  36. package/dist/null-device/resources/null-render-pass.d.ts.map +1 -0
  37. package/dist/null-device/resources/null-render-pass.js +18 -0
  38. package/dist/null-device/resources/null-render-pipeline.d.ts +23 -0
  39. package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -0
  40. package/dist/null-device/resources/null-render-pipeline.js +38 -0
  41. package/dist/null-device/resources/null-sampler.d.ts +7 -0
  42. package/dist/null-device/resources/null-sampler.d.ts.map +1 -0
  43. package/dist/null-device/resources/null-sampler.js +11 -0
  44. package/dist/null-device/resources/null-shader.d.ts +8 -0
  45. package/dist/null-device/resources/null-shader.d.ts.map +1 -0
  46. package/dist/null-device/resources/null-shader.js +14 -0
  47. package/dist/null-device/resources/null-texture-view.d.ts +12 -0
  48. package/dist/null-device/resources/null-texture-view.d.ts.map +1 -0
  49. package/dist/null-device/resources/null-texture-view.js +13 -0
  50. package/dist/null-device/resources/null-texture.d.ts +33 -0
  51. package/dist/null-device/resources/null-texture.d.ts.map +1 -0
  52. package/dist/null-device/resources/null-texture.js +91 -0
  53. package/dist/null-device/resources/null-transform-feedback.d.ts +15 -0
  54. package/dist/null-device/resources/null-transform-feedback.d.ts.map +1 -0
  55. package/dist/null-device/resources/null-transform-feedback.js +32 -0
  56. package/dist/null-device/resources/null-vertex-array.d.ts +14 -0
  57. package/dist/null-device/resources/null-vertex-array.d.ts.map +1 -0
  58. package/dist/null-device/resources/null-vertex-array.js +26 -0
  59. package/dist/performance-test-runner.d.ts +1 -1
  60. package/dist/performance-test-runner.d.ts.map +1 -1
  61. package/dist/performance-test-runner.js +3 -2
  62. package/dist/register-devices.js +2 -1
  63. package/dist/snapshot-test-runner.d.ts +1 -1
  64. package/dist/snapshot-test-runner.d.ts.map +1 -1
  65. package/dist/snapshot-test-runner.js +5 -2
  66. package/dist/test-runner.d.ts +3 -3
  67. package/dist/test-runner.d.ts.map +1 -1
  68. package/dist/test-runner.js +8 -7
  69. package/dist/utils/check-type.d.ts.map +1 -1
  70. package/dist/utils/deep-copy.js +1 -1
  71. package/dist/utils/get-bounding-box.d.ts.map +1 -1
  72. package/dist/utils/resource-tracker.d.ts.map +1 -1
  73. package/package.json +6 -6
  74. package/src/create-test-device.ts +30 -24
  75. package/src/engine/classic-animation-loop.ts +15 -11
  76. package/src/index.ts +2 -1
  77. package/src/null-device/null-canvas-context.ts +58 -0
  78. package/src/null-device/null-device-features.ts +34 -0
  79. package/src/null-device/null-device-info.ts +17 -0
  80. package/src/null-device/null-device.ts +194 -0
  81. package/src/null-device/resources/null-buffer.ts +42 -0
  82. package/src/null-device/resources/null-command-buffer.ts +38 -0
  83. package/src/null-device/resources/null-framebuffer.ts +16 -0
  84. package/src/null-device/resources/null-query-set.ts +15 -0
  85. package/src/null-device/resources/null-render-pass.ts +26 -0
  86. package/src/null-device/resources/null-render-pipeline.ts +62 -0
  87. package/src/null-device/resources/null-sampler.ts +15 -0
  88. package/src/null-device/resources/null-shader.ts +19 -0
  89. package/src/null-device/resources/null-texture-view.ts +21 -0
  90. package/src/null-device/resources/null-texture.ts +121 -0
  91. package/src/null-device/resources/null-transform-feedback.ts +46 -0
  92. package/src/null-device/resources/null-vertex-array.ts +37 -0
  93. package/src/performance-test-runner.ts +2 -1
  94. package/src/register-devices.ts +2 -1
  95. package/src/snapshot-test-runner.ts +6 -2
  96. package/src/test-runner.ts +14 -8
  97. package/src/utils/check-type.ts +0 -1
  98. package/src/utils/deep-copy.ts +1 -1
  99. package/src/utils/get-bounding-box.ts +6 -1
  100. package/src/utils/resource-tracker.ts +4 -1
  101. package/dist/check-type.d.ts +0 -6
  102. package/dist/check-type.d.ts.map +0 -1
  103. package/dist/check-type.js +0 -5
  104. package/dist/utils.d.ts +0 -7
  105. package/dist/utils.d.ts.map +0 -1
  106. package/dist/utils.js +0 -10
@@ -0,0 +1,32 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { TransformFeedback } from '@luma.gl/core';
5
+ export class NullTransformFeedback extends TransformFeedback {
6
+ device;
7
+ layout;
8
+ buffers = {};
9
+ constructor(device, props) {
10
+ super(device, props);
11
+ this.device = device;
12
+ this.layout = this.props.layout;
13
+ if (props.buffers) {
14
+ this.setBuffers(props.buffers);
15
+ }
16
+ Object.seal(this);
17
+ }
18
+ begin(topology = 'point-list') { }
19
+ end() { }
20
+ setBuffers(buffers) {
21
+ this.buffers = {};
22
+ for (const bufferName in buffers) {
23
+ this.setBuffer(bufferName, buffers[bufferName]);
24
+ }
25
+ }
26
+ setBuffer(locationOrName, bufferOrRange) {
27
+ this.buffers[locationOrName] = bufferOrRange;
28
+ }
29
+ getBuffer(locationOrName) {
30
+ return this.buffers[locationOrName] || null;
31
+ }
32
+ }
@@ -0,0 +1,14 @@
1
+ import type { Buffer, VertexArrayProps, TypedArray } from '@luma.gl/core';
2
+ import { VertexArray } from '@luma.gl/core';
3
+ import type { NullDevice } from "../null-device.js";
4
+ export declare class NullVertexArray extends VertexArray {
5
+ device: NullDevice;
6
+ constructor(device: NullDevice, props: VertexArrayProps);
7
+ setIndexBuffer(indexBuffer: Buffer | null): void;
8
+ /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
9
+ setBuffer(location: number, attributeBuffer: Buffer): void;
10
+ bindBeforeRender(): void;
11
+ unbindAfterRender(): void;
12
+ setConstantWebGL(location: number, value: TypedArray | null): void;
13
+ }
14
+ //# sourceMappingURL=null-vertex-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"null-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/null-device/resources/null-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAC,UAAU,EAAC,0BAAuB;AAE/C,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,MAAM,EAAE,UAAU,CAAC;gBAGP,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB;IAKvD,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIhD,gGAAgG;IAChG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IAQ1D,gBAAgB,IAAI,IAAI;IAExB,iBAAiB,IAAI,IAAI;IAEhB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;CAC5E"}
@@ -0,0 +1,26 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { VertexArray } from '@luma.gl/core';
5
+ export class NullVertexArray extends VertexArray {
6
+ device;
7
+ // Create a VertexArray
8
+ constructor(device, props) {
9
+ super(device, props);
10
+ this.device = device;
11
+ }
12
+ setIndexBuffer(indexBuffer) {
13
+ this.indexBuffer = indexBuffer;
14
+ }
15
+ /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
16
+ setBuffer(location, attributeBuffer) {
17
+ const attributeInfo = this.attributeInfos[location];
18
+ if (!attributeInfo) {
19
+ throw new Error(`Unknown attribute location ${location}`);
20
+ }
21
+ this.attributes[location] = attributeBuffer;
22
+ }
23
+ bindBeforeRender() { }
24
+ unbindAfterRender() { }
25
+ setConstantWebGL(location, value) { }
26
+ }
@@ -1,4 +1,4 @@
1
- import { TestRunner, TestRunnerProps, TestRunnerTestCase } from './test-runner';
1
+ import { TestRunner, TestRunnerProps, TestRunnerTestCase } from "./test-runner.js";
2
2
  export type PerformanceTestRunnerProps = TestRunnerProps;
3
3
  export declare class PerformanceTestRunner extends TestRunner {
4
4
  private _stats;
@@ -1 +1 @@
1
- {"version":3,"file":"performance-test-runner.d.ts","sourceRoot":"","sources":["../src/performance-test-runner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAE9E,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,IAAI,CAAqB;gBAErB,KAAK,EAAE,0BAA0B;IASpC,YAAY,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAMhD,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO;IAW1D,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CAapD"}
1
+ {"version":3,"file":"performance-test-runner.d.ts","sourceRoot":"","sources":["../src/performance-test-runner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAC,yBAAsB;AAE9E,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,IAAI,CAAqB;gBAErB,KAAK,EAAE,0BAA0B;IASpC,YAAY,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAMhD,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO;IAW1D,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CAapD"}
@@ -1,7 +1,8 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
  import { Stats } from '@probe.gl/stats';
4
- import { TestRunner } from './test-runner';
5
+ import { TestRunner } from "./test-runner.js";
5
6
  export class PerformanceTestRunner extends TestRunner {
6
7
  _stats = null;
7
8
  _fps = null;
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
  import { luma } from '@luma.gl/core';
4
5
  import { WebGLDevice } from '@luma.gl/webgl';
@@ -1,4 +1,4 @@
1
- import { TestRunner, TestRunnerProps, TestRunnerTestCase } from './test-runner';
1
+ import { TestRunner, TestRunnerProps, TestRunnerTestCase } from "./test-runner.js";
2
2
  /** A snapshot test case */
3
3
  export type SnapshotTestRunnerTestCase = TestRunnerTestCase & {
4
4
  /** URL to golden image */
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot-test-runner.d.ts","sourceRoot":"","sources":["../src/snapshot-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAG9E,2BAA2B;AAC3B,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,GAAG;IAC5D,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,gBAAgB,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;CACzC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,qBAAa,kBAAmB,SAAQ,UAAU;gBAIpC,KAAK,EAAE,uBAAuB;IAKjC,YAAY,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI;IAOxD,YAAY,IAAI,OAAO;IAKjB,MAAM,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;CAgC3E"}
1
+ {"version":3,"file":"snapshot-test-runner.d.ts","sourceRoot":"","sources":["../src/snapshot-test-runner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAC,yBAAsB;AAG9E,2BAA2B;AAC3B,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,GAAG;IAC5D,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,gBAAgB,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,qBAAa,kBAAmB,SAAQ,UAAU;gBAIpC,KAAK,EAAE,uBAAuB;IAKjC,YAAY,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI;IAOxD,YAAY,IAAI,OAAO;IAKjB,MAAM,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;CAgC3E"}
@@ -1,5 +1,8 @@
1
- import { TestRunner } from './test-runner';
2
- import { getBoundingBoxInPage } from './utils/get-bounding-box';
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { TestRunner } from "./test-runner.js";
5
+ import { getBoundingBoxInPage } from "./utils/get-bounding-box.js";
3
6
  export class SnapshotTestRunner extends TestRunner {
4
7
  // should be defined here but hack access in TestRunner
5
8
  // private isDiffing: boolean = false;
@@ -1,5 +1,5 @@
1
1
  import { AnimationProps } from '@luma.gl/engine';
2
- import { ClassicAnimationLoop as AnimationLoop } from './engine/classic-animation-loop';
2
+ import { ClassicAnimationLoop as AnimationLoop } from "./engine/classic-animation-loop.js";
3
3
  /** Describes a test case */
4
4
  export type TestRunnerTestCase = {
5
5
  /** Name of the test case (for logging) */
@@ -51,8 +51,8 @@ export declare class TestRunner {
51
51
  */
52
52
  add(testCases: TestRunnerTestCase[]): this;
53
53
  /**
54
- * Returns a promise that resolves when all the test cases are done
55
- */
54
+ * Returns a promise that resolves when all the test cases are done
55
+ */
56
56
  run(options?: object): Promise<void>;
57
57
  initTestCase(testCase: TestRunnerTestCase): void;
58
58
  shouldRender(animationProps: any): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../src/test-runner.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4B;IACpD,OAAO,CAAC,yBAAyB,CAAS;IAC1C,OAAO,CAAC,yBAAyB,CAAS;IAG1C,SAAS,EAAE,OAAO,CAAS;IAG3B,UAAU,EAAE,OAAO,CAAgD;IAEnE;;;OAGG;gBACS,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAI3C;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,IAAI;IAU1C;;OAEG;IACH,GAAG,CAAC,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxC,YAAY,CAAC,QAAQ,EAAE,kBAAkB;IAYzC,YAAY,CAAC,cAAc,KAAA,GAAG,OAAO;IAIrC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAO1C,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAK5B,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAK5B,KAAK,IAAI,IAAI;IAMb,SAAS,CAAC,cAAc,KAAA,GAAG,IAAI;IA2C/B,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAuD7C"}
@@ -1,8 +1,9 @@
1
- // @ts-nocheck
2
- /* eslint-disable */
3
- import { webglDevice } from './create-test-device';
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { webglDevice } from "./create-test-device.js";
4
5
  // TODO - Replace with new AnimationLoop from `@luma.gl/engine`
5
- import { ClassicAnimationLoop as AnimationLoop } from './engine/classic-animation-loop';
6
+ import { ClassicAnimationLoop as AnimationLoop } from "./engine/classic-animation-loop.js";
6
7
  const DEFAULT_TEST_CASE = {
7
8
  name: 'Unnamed test',
8
9
  onInitialize: async () => { },
@@ -58,8 +59,8 @@ export class TestRunner {
58
59
  return this;
59
60
  }
60
61
  /**
61
- * Returns a promise that resolves when all the test cases are done
62
- */
62
+ * Returns a promise that resolves when all the test cases are done
63
+ */
63
64
  run(options = {}) {
64
65
  this.testOptions = { ...this.testOptions, ...options };
65
66
  return new Promise((resolve, reject) => {
@@ -188,7 +189,7 @@ export class TestRunner {
188
189
  };
189
190
  // aligned with the behavior of AnimationLoop.onInitialized
190
191
  // onInitialized could return a plain object or a promise
191
- Promise.resolve(testCase.onInitialize(initProps)).then((userData) => {
192
+ Promise.resolve(testCase.onInitialize(initProps)).then(userData => {
192
193
  this._testCaseData = userData || {};
193
194
  });
194
195
  // invoke user callback
@@ -1 +1 @@
1
- {"version":3,"file":"check-type.d.ts","sourceRoot":"","sources":["../../src/utils/check-type.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAG"}
1
+ {"version":3,"file":"check-type.d.ts","sourceRoot":"","sources":["../../src/utils/check-type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAG"}
@@ -1,7 +1,7 @@
1
1
  /** Recursively copies objects */
2
2
  export function deepCopy(object) {
3
3
  if (Array.isArray(object)) {
4
- return object.map((element) => deepCopy(element));
4
+ return object.map(element => deepCopy(element));
5
5
  }
6
6
  if (object !== null && typeof object === 'object') {
7
7
  const newObject = {};
@@ -1 +1 @@
1
- {"version":3,"file":"get-bounding-box.d.ts","sourceRoot":"","sources":["../../src/utils/get-bounding-box.ts"],"names":[],"mappings":"AACA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,WAAW,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAC,CAQpH"}
1
+ {"version":3,"file":"get-bounding-box.d.ts","sourceRoot":"","sources":["../../src/utils/get-bounding-box.ts"],"names":[],"mappings":"AACA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,WAAW,GAAG;IAC7D,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAQA"}
@@ -1 +1 @@
1
- {"version":3,"file":"resource-tracker.d.ts","sourceRoot":"","sources":["../../src/utils/resource-tracker.ts"],"names":[],"mappings":"AACA,wBAAgB,iBAAiB;;;EAOhC;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAaxH"}
1
+ {"version":3,"file":"resource-tracker.d.ts","sourceRoot":"","sources":["../../src/utils/resource-tracker.ts"],"names":[],"mappings":"AACA,wBAAgB,iBAAiB;;;EAOhC;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,GAAG,IAAI,CAaf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/test-utils",
3
- "version": "9.0.0-beta.5",
3
+ "version": "9.0.0-beta.7",
4
4
  "description": "Automated WebGL testing utilities with Puppeteer and image diffing",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,13 +43,13 @@
43
43
  "@luma.gl/webgpu": "^9.0.0-beta.4"
44
44
  },
45
45
  "devDependencies": {
46
- "@luma.gl/core": "9.0.0-beta.5",
47
- "@luma.gl/engine": "9.0.0-beta.5",
48
- "@luma.gl/webgl": "9.0.0-beta.5",
49
- "@luma.gl/webgpu": "9.0.0-beta.5"
46
+ "@luma.gl/core": "9.0.0-beta.7",
47
+ "@luma.gl/engine": "9.0.0-beta.7",
48
+ "@luma.gl/webgl": "9.0.0-beta.7",
49
+ "@luma.gl/webgpu": "9.0.0-beta.7"
50
50
  },
51
51
  "dependencies": {
52
52
  "@probe.gl/env": "^4.0.2"
53
53
  },
54
- "gitHead": "793d3ab42f5a572b6cb603ea78aabaa73a873301"
54
+ "gitHead": "e9606a88e0aab3dc27c87020cac89040ea1a8a02"
55
55
  }
@@ -1,8 +1,9 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import type {Device, DeviceProps} from '@luma.gl/core';
5
- import {luma} from '@luma.gl/core';
6
+ import {luma, log} from '@luma.gl/core';
6
7
  import {WebGLDevice} from '@luma.gl/webgl';
7
8
  import {WebGPUDevice} from '@luma.gl/webgpu';
8
9
 
@@ -31,35 +32,40 @@ export function createTestDevice(props: DeviceProps = {}): WebGLDevice | null {
31
32
  }
32
33
  }
33
34
 
34
- /** A WebGL 2 Device intended for testing */
35
- export const webglDevice: WebGLDevice = createTestDevice({id: 'webgl2-test-device'}) ;
35
+ /** This WebGL Device can be used directly but will not have WebGL debugging initialized */
36
+ export const webglDevice = createTestDevice();
36
37
 
37
- /** Only available after getTestDevices() has completed */
38
- export let webgpuDevice: WebGPUDevice;
38
+ /** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
39
+ export let webglDeviceAsync: WebGLDevice;
39
40
 
40
- let webgpuCreated = false;
41
+ /** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
42
+ export let webgpuDevice: WebGPUDevice;
41
43
 
42
- /** Synchronously get test devices (only WebGLDevices) */
43
- export function getWebGLTestDevices(): WebGLDevice[] {
44
- const devices: WebGLDevice[] = [];
45
- devices.push(webglDevice);
46
- return devices;
47
- }
44
+ let devicesCreated = false;
48
45
 
49
46
  /** Includes WebGPU device if available */
50
- export async function getTestDevices() : Promise<Device[]> {
51
- if (!webgpuCreated) {
52
- webgpuCreated = true;
47
+ export async function getTestDevices(type?: 'webgl' | 'webgpu'): Promise<Device[]> {
48
+ if (!devicesCreated) {
49
+ devicesCreated = true;
53
50
  try {
54
- webgpuDevice = await luma.createDevice({id: 'webgpu-test-device', type: 'webgpu'}) as WebGPUDevice;
55
- } catch {
56
- // ignore (assume WebGPU was not available)
51
+ webgpuDevice = (await luma.createDevice({
52
+ id: 'webgpu-test-device',
53
+ type: 'webgpu'
54
+ })) as WebGPUDevice;
55
+ } catch (error) {
56
+ log.error(String(error))();
57
+ }
58
+ try {
59
+ webglDeviceAsync = (await luma.createDevice({
60
+ id: 'webgl-test-device',
61
+ type: 'webgl'
62
+ })) as WebGLDevice;
63
+ } catch (error) {
64
+ log.error(String(error))();
57
65
  }
58
66
  }
59
67
 
60
- const devices: Device[] = getWebGLTestDevices();
61
- if (webgpuDevice) {
62
- devices.unshift(webgpuDevice);
63
- }
64
- return devices;
68
+ return [webglDeviceAsync, webgpuDevice]
69
+ .filter(Boolean)
70
+ .filter(device => !type || type === device.type);
65
71
  }
@@ -1,3 +1,7 @@
1
+ // luma.gl
2
+ // SPDX-License
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // TODO - replace createGLContext, instrumentGLContext, resizeGLContext?
2
6
  // TODO - remove dependency on framebuffer (bundle size impact)
3
7
  import {
@@ -87,7 +91,7 @@ const DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS: Required<ClassicAnimationLoopProps>
87
91
  onInitialize: () => ({}),
88
92
  onRender: () => {},
89
93
  onFinalize: () => {},
90
- onError: (error) => console.error(error), // eslint-disable-line no-console
94
+ onError: error => console.error(error), // eslint-disable-line no-console
91
95
 
92
96
  device: null,
93
97
  // debug: true,
@@ -313,7 +317,7 @@ export class ClassicAnimationLoop {
313
317
  this.setNeedsRedraw('waitForRender');
314
318
 
315
319
  if (!this._nextFramePromise) {
316
- this._nextFramePromise = new Promise((resolve) => {
320
+ this._nextFramePromise = new Promise(resolve => {
317
321
  this._resolveNextFrame = resolve;
318
322
  });
319
323
  }
@@ -388,14 +392,14 @@ export class ClassicAnimationLoop {
388
392
  if (!this._pageLoadPromise) {
389
393
  this._pageLoadPromise = isPage
390
394
  ? new Promise((resolve, reject) => {
391
- if (isPage && document.readyState === 'complete') {
392
- resolve(document);
393
- return;
394
- }
395
- window.addEventListener('load', () => {
396
- resolve(document);
397
- });
398
- })
395
+ if (isPage && document.readyState === 'complete') {
396
+ resolve(document);
397
+ return;
398
+ }
399
+ window.addEventListener('load', () => {
400
+ resolve(document);
401
+ });
402
+ })
399
403
  : Promise.resolve({});
400
404
  }
401
405
  return this._pageLoadPromise;
@@ -582,7 +586,7 @@ export class ClassicAnimationLoop {
582
586
  }
583
587
 
584
588
  _createInfoDiv() {
585
- const canvas = getHTMLCanvasElement(this.gl.canvas)
589
+ const canvas = getHTMLCanvasElement(this.gl.canvas);
586
590
  if (canvas && this.props.onAddHTML) {
587
591
  const wrapperDiv = document.createElement('div');
588
592
  document.body.appendChild(wrapperDiv);
package/src/index.ts CHANGED
@@ -9,8 +9,9 @@ export {PerformanceTestRunner} from './performance-test-runner';
9
9
 
10
10
  // TEST DEVICES
11
11
  export {webglDevice, webgpuDevice} from './create-test-device';
12
- export {getTestDevices, getWebGLTestDevices} from './create-test-device';
12
+ export {getTestDevices} from './create-test-device';
13
13
  export {createTestDevice, createTestContext} from './create-test-device';
14
+ export {NullDevice} from './null-device/null-device';
14
15
 
15
16
  // UTILS
16
17
  export {checkType} from './utils/check-type';
@@ -0,0 +1,58 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {CanvasContextProps} from '@luma.gl/core';
6
+ import {CanvasContext} from '@luma.gl/core';
7
+ import type {NullDevice} from './null-device';
8
+ import {NullFramebuffer} from './resources/null-framebuffer';
9
+
10
+ /**
11
+ * A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc
12
+ */
13
+ export class NullCanvasContext extends CanvasContext {
14
+ readonly device: NullDevice;
15
+ presentationSize: [number, number];
16
+ private _framebuffer: NullFramebuffer | null = null;
17
+
18
+ constructor(device: NullDevice, props: CanvasContextProps) {
19
+ // Note: Base class creates / looks up the canvas (unless under Node.js)
20
+ super(props);
21
+ this.device = device;
22
+ this.presentationSize = [-1, -1];
23
+ this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
24
+ this.update();
25
+ }
26
+
27
+ getCurrentFramebuffer(): NullFramebuffer {
28
+ this.update();
29
+ // Setting handle to null returns a reference to the default framebuffer
30
+ this._framebuffer = this._framebuffer || new NullFramebuffer(this.device, {handle: null});
31
+ return this._framebuffer;
32
+ }
33
+
34
+ /** Resizes and updates render targets if necessary */
35
+ update() {
36
+ const size = this.getPixelSize();
37
+ const sizeChanged =
38
+ size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
39
+ if (sizeChanged) {
40
+ this.presentationSize = size;
41
+ this.resize();
42
+ }
43
+ }
44
+
45
+ resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {
46
+ if (this.canvas) {
47
+ const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);
48
+ this.setDevicePixelRatio(devicePixelRatio, options);
49
+ return;
50
+ }
51
+ }
52
+
53
+ override getDrawingBufferSize(): [number, number] {
54
+ return [this.width, this.height];
55
+ }
56
+
57
+ commit() {}
58
+ }
@@ -0,0 +1,34 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {DeviceLimits} from '@luma.gl/core';
6
+
7
+ export class NullDeviceLimits extends DeviceLimits {
8
+ maxTextureDimension1D = 0;
9
+ maxTextureDimension2D = 2048;
10
+ maxTextureDimension3D = 256;
11
+ maxTextureArrayLayers = 256;
12
+ maxBindGroups = 0;
13
+ maxDynamicUniformBuffersPerPipelineLayout = 0;
14
+ maxDynamicStorageBuffersPerPipelineLayout = 0;
15
+ maxSampledTexturesPerShaderStage = 8;
16
+ maxSamplersPerShaderStage = 16;
17
+ maxStorageBuffersPerShaderStage = 0;
18
+ maxStorageTexturesPerShaderStage = 0;
19
+ maxUniformBuffersPerShaderStage = 20;
20
+ maxUniformBufferBindingSize = 16384;
21
+ maxStorageBufferBindingSize = 0;
22
+ minUniformBufferOffsetAlignment = 0;
23
+ minStorageBufferOffsetAlignment = 0;
24
+ maxVertexBuffers = 16;
25
+ maxVertexAttributes = 16;
26
+ maxVertexBufferArrayStride = 2048;
27
+ maxInterStageShaderComponents = 60;
28
+ maxComputeWorkgroupStorageSize = 0;
29
+ maxComputeInvocationsPerWorkgroup = 0;
30
+ maxComputeWorkgroupSizeX = 0;
31
+ maxComputeWorkgroupSizeY = 0;
32
+ maxComputeWorkgroupSizeZ = 0;
33
+ maxComputeWorkgroupsPerDimension = 0;
34
+ }
@@ -0,0 +1,17 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {DeviceInfo} from '@luma.gl/core';
6
+
7
+ export const NullDeviceInfo: DeviceInfo = {
8
+ type: 'webgl',
9
+ gpu: 'software',
10
+ gpuType: 'unknown',
11
+ gpuBackend: 'unknown',
12
+ vendor: '',
13
+ renderer: 'none',
14
+ version: '1.0',
15
+ shadingLanguage: 'glsl' as const,
16
+ shadingLanguageVersion: 300
17
+ } as const;