@luma.gl/test-utils 9.1.0-beta.9 → 9.2.0-alpha.1

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 (88) hide show
  1. package/dist/create-test-device.d.ts +8 -9
  2. package/dist/create-test-device.d.ts.map +1 -1
  3. package/dist/create-test-device.js +89 -46
  4. package/dist/create-test-device.js.map +1 -1
  5. package/dist/deprecated/classic-animation-loop.d.ts +2 -2
  6. package/dist/deprecated/classic-animation-loop.d.ts.map +1 -1
  7. package/dist/deprecated/classic-animation-loop.js +3 -2
  8. package/dist/deprecated/classic-animation-loop.js.map +1 -1
  9. package/dist/deprecated/sync-test-device.d.ts +14 -0
  10. package/dist/deprecated/sync-test-device.d.ts.map +1 -0
  11. package/dist/deprecated/sync-test-device.js +32 -0
  12. package/dist/deprecated/sync-test-device.js.map +1 -0
  13. package/dist/index.cjs +1168 -1114
  14. package/dist/index.cjs.map +4 -4
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +5 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/null-device/null-adapter.d.ts +2 -2
  20. package/dist/null-device/null-adapter.d.ts.map +1 -1
  21. package/dist/null-device/null-adapter.js +4 -2
  22. package/dist/null-device/null-adapter.js.map +1 -1
  23. package/dist/null-device/null-canvas-context.d.ts +4 -13
  24. package/dist/null-device/null-canvas-context.d.ts.map +1 -1
  25. package/dist/null-device/null-canvas-context.js +5 -26
  26. package/dist/null-device/null-canvas-context.js.map +1 -1
  27. package/dist/null-device/null-device-features.d.ts +1 -1
  28. package/dist/null-device/null-device-features.d.ts.map +1 -1
  29. package/dist/null-device/null-device-features.js +1 -1
  30. package/dist/null-device/null-device-features.js.map +1 -1
  31. package/dist/null-device/null-device.d.ts +7 -5
  32. package/dist/null-device/null-device.d.ts.map +1 -1
  33. package/dist/null-device/null-device.js +7 -9
  34. package/dist/null-device/null-device.js.map +1 -1
  35. package/dist/null-device/resources/null-command-buffer.d.ts +5 -5
  36. package/dist/null-device/resources/null-command-buffer.d.ts.map +1 -1
  37. package/dist/null-device/resources/null-command-buffer.js +3 -3
  38. package/dist/null-device/resources/null-command-buffer.js.map +1 -1
  39. package/dist/null-device/resources/null-command-encoder.d.ts +22 -0
  40. package/dist/null-device/resources/null-command-encoder.d.ts.map +1 -0
  41. package/dist/null-device/resources/null-command-encoder.js +32 -0
  42. package/dist/null-device/resources/null-command-encoder.js.map +1 -0
  43. package/dist/null-device/resources/null-render-pass.d.ts.map +1 -1
  44. package/dist/null-device/resources/null-render-pass.js.map +1 -1
  45. package/dist/null-device/resources/null-render-pipeline.d.ts +0 -1
  46. package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -1
  47. package/dist/null-device/resources/null-render-pipeline.js +0 -3
  48. package/dist/null-device/resources/null-render-pipeline.js.map +1 -1
  49. package/dist/null-device/resources/null-texture.d.ts +3 -9
  50. package/dist/null-device/resources/null-texture.d.ts.map +1 -1
  51. package/dist/null-device/resources/null-texture.js +18 -43
  52. package/dist/null-device/resources/null-texture.js.map +1 -1
  53. package/dist/performance-test-runner.d.ts.map +1 -1
  54. package/dist/performance-test-runner.js +1 -0
  55. package/dist/performance-test-runner.js.map +1 -1
  56. package/dist/register-devices.d.ts +2 -0
  57. package/dist/register-devices.d.ts.map +1 -0
  58. package/dist/register-devices.js +8 -0
  59. package/dist/register-devices.js.map +1 -0
  60. package/dist/snapshot-test-runner.d.ts.map +1 -1
  61. package/dist/snapshot-test-runner.js +1 -0
  62. package/dist/snapshot-test-runner.js.map +1 -1
  63. package/dist/test-runner.d.ts +1 -1
  64. package/dist/test-runner.d.ts.map +1 -1
  65. package/dist/test-runner.js +3 -2
  66. package/dist/test-runner.js.map +1 -1
  67. package/dist/utils/deep-copy.d.ts +1 -1
  68. package/dist/utils/deep-copy.d.ts.map +1 -1
  69. package/dist/utils/deep-copy.js.map +1 -1
  70. package/package.json +7 -7
  71. package/src/create-test-device.ts +100 -46
  72. package/src/deprecated/classic-animation-loop.ts +4 -2
  73. package/src/deprecated/sync-test-device.ts +35 -0
  74. package/src/index.ts +12 -4
  75. package/src/null-device/null-adapter.ts +5 -2
  76. package/src/null-device/null-canvas-context.ts +8 -32
  77. package/src/null-device/null-device-features.ts +1 -1
  78. package/src/null-device/null-device.ts +10 -14
  79. package/src/null-device/resources/null-command-buffer.ts +5 -5
  80. package/src/null-device/resources/null-command-encoder.ts +55 -0
  81. package/src/null-device/resources/null-render-pass.ts +3 -3
  82. package/src/null-device/resources/null-render-pipeline.ts +0 -4
  83. package/src/null-device/resources/null-texture.ts +22 -61
  84. package/src/performance-test-runner.ts +1 -0
  85. package/src/register-devices.ts +9 -0
  86. package/src/snapshot-test-runner.ts +1 -0
  87. package/src/test-runner.ts +4 -2
  88. package/src/utils/deep-copy.ts +2 -2
@@ -41,10 +41,6 @@ export class NullRenderPipeline extends RenderPipeline {
41
41
  Object.assign(this.bindings, bindings);
42
42
  }
43
43
 
44
- override setUniformsWebGL(uniforms: Record<string, UniformValue>): void {
45
- Object.assign(this.uniforms, uniforms);
46
- }
47
-
48
44
  draw(options: {
49
45
  renderPass: RenderPass;
50
46
  vertexArray: VertexArray;
@@ -4,16 +4,9 @@
4
4
 
5
5
  import type {
6
6
  TextureProps,
7
- Sampler,
8
- SamplerProps,
9
7
  TextureViewProps,
10
8
  CopyExternalImageOptions,
11
- Texture1DData,
12
- Texture2DData,
13
- Texture3DData,
14
- TextureCubeData,
15
- TextureArrayData,
16
- TextureCubeArrayData
9
+ CopyImageDataOptions
17
10
  } from '@luma.gl/core';
18
11
 
19
12
  import {Texture} from '@luma.gl/core';
@@ -30,57 +23,16 @@ export class NullTexture extends Texture {
30
23
  constructor(device: NullDevice, props: TextureProps) {
31
24
  super(device, props);
32
25
 
33
- // Texture base class strips out the data prop, so we need to add it back in
34
- const propsWithData = {...this.props};
35
- propsWithData.data = props.data;
36
-
37
26
  this.device = device;
38
27
 
39
- this.initialize(propsWithData);
40
-
41
- Object.seal(this);
42
- }
43
-
44
- override destroy(): void {
45
- if (!this.destroyed) {
46
- super.destroy();
47
- this.trackDeallocatedMemory('Texture');
48
- }
49
- }
50
-
51
- createView(props: TextureViewProps): NullTextureView {
52
- return new NullTextureView(this.device, {...props, texture: this});
53
- }
54
-
55
- setTexture1DData(data: Texture1DData): void {
56
- throw new Error('not implemented');
57
- }
58
-
59
- setTexture2DData(lodData: Texture2DData, depth?: number, target?: number): void {
60
- throw new Error('not implemented');
61
- }
62
-
63
- setTexture3DData(lodData: Texture3DData, depth?: number, target?: number): void {
64
- throw new Error('not implemented');
65
- }
66
-
67
- setTextureCubeData(data: TextureCubeData, depth?: number): void {
68
- throw new Error('not implemented');
69
- }
70
-
71
- setTextureArrayData(data: TextureArrayData): void {
72
- throw new Error('not implemented');
73
- }
74
-
75
- setTextureCubeArrayData(data: TextureCubeArrayData): void {
76
- throw new Error('not implemented');
77
- }
78
-
79
- initialize(props: TextureProps = {}): this {
80
28
  // const data = props.data;
81
29
  // this.setImageData(props);
82
30
 
83
- this.setSampler(props.sampler);
31
+ if (props.sampler) {
32
+ this.setSampler(props.sampler);
33
+ }
34
+
35
+ this.sampler = new NullSampler(this.device, this.props.sampler);
84
36
 
85
37
  this.view = new NullTextureView(this.device, {
86
38
  ...props,
@@ -89,17 +41,18 @@ export class NullTexture extends Texture {
89
41
  arrayLayerCount: 1
90
42
  });
91
43
 
92
- return this;
44
+ Object.seal(this);
93
45
  }
94
46
 
95
- setSampler(sampler: Sampler | SamplerProps = {}): this {
96
- if (sampler instanceof NullSampler) {
97
- this.sampler = sampler;
98
- } else {
99
- this.sampler = new NullSampler(this.device, sampler);
47
+ override destroy(): void {
48
+ if (!this.destroyed) {
49
+ super.destroy();
50
+ this.trackDeallocatedMemory('Texture');
100
51
  }
52
+ }
101
53
 
102
- return this;
54
+ createView(props: TextureViewProps): NullTextureView {
55
+ return new NullTextureView(this.device, {...props, texture: this});
103
56
  }
104
57
 
105
58
  copyExternalImage(options: CopyExternalImageOptions): {width: number; height: number} {
@@ -122,4 +75,12 @@ export class NullTexture extends Texture {
122
75
 
123
76
  return {width, height};
124
77
  }
78
+
79
+ override copyImageData(options: CopyImageDataOptions): void {
80
+ throw new Error('copyImageData not implemented');
81
+ }
82
+
83
+ override generateMipmapsWebGL(): void {
84
+ // ignore
85
+ }
125
86
  }
@@ -30,6 +30,7 @@ export class PerformanceTestRunner extends TestRunner {
30
30
  this._fps?.timeEnd();
31
31
  this._fps?.timeStart();
32
32
 
33
+ // @ts-ignore TODO
33
34
  if (this._fps.count > this.testOptions.maxFramesToRender) {
34
35
  animationProps.done();
35
36
  }
@@ -0,0 +1,9 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {luma} from '@luma.gl/core';
6
+ import {webgl2Adapter} from '@luma.gl/webgl';
7
+ import {webgpuAdapter} from '@luma.gl/webgpu';
8
+
9
+ luma.registerAdapters([webgl2Adapter, webgpuAdapter]);
@@ -56,6 +56,7 @@ export class SnapshotTestRunner extends TestRunner {
56
56
  };
57
57
 
58
58
  // Take screenshot and compare
59
+ // @ts-ignore implicit any
59
60
  const result = await globalThis.browserTestDriver_captureAndDiffScreen(diffOptions);
60
61
 
61
62
  // invoke user callback
@@ -6,7 +6,7 @@
6
6
  /* eslint-disable */
7
7
 
8
8
  import {AnimationProps} from '@luma.gl/engine';
9
- import {webglDevice} from './create-test-device';
9
+ import {getWebGLTestDevice} from './create-test-device';
10
10
 
11
11
  // TODO - Replace with new AnimationLoop from `@luma.gl/engine`
12
12
  import {ClassicAnimationLoop as AnimationLoop} from './deprecated/classic-animation-loop';
@@ -107,9 +107,11 @@ export class TestRunner {
107
107
  /**
108
108
  * Returns a promise that resolves when all the test cases are done
109
109
  */
110
- run(options: object = {}): Promise<void> {
110
+ async run(options: object = {}): Promise<void> {
111
111
  this.testOptions = {...this.testOptions, ...options};
112
112
 
113
+ const device = await getWebGLTestDevice();
114
+
113
115
  return new Promise<void>((resolve, reject) => {
114
116
  this._animationLoop = new AnimationLoop({
115
117
  ...this.props,
@@ -1,11 +1,11 @@
1
1
  /** Recursively copies objects */
2
- export function deepCopy(object: Record<string, any>) {
2
+ export function deepCopy(object: any): any {
3
3
  if (Array.isArray(object)) {
4
4
  return object.map(element => deepCopy(element));
5
5
  }
6
6
 
7
7
  if (object !== null && typeof object === 'object') {
8
- const newObject = {};
8
+ const newObject: Record<string, any> = {};
9
9
  for (const key in object) {
10
10
  newObject[key] = deepCopy(object[key]);
11
11
  }