@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.
- package/dist/create-test-device.d.ts +5 -5
- package/dist/create-test-device.d.ts.map +1 -1
- package/dist/create-test-device.js +30 -23
- package/dist/engine/classic-animation-loop.d.ts.map +1 -1
- package/dist/engine/classic-animation-loop.js +5 -2
- package/dist/index.cjs +554 -20
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -9
- package/dist/null-device/null-canvas-context.d.ts +24 -0
- package/dist/null-device/null-canvas-context.d.ts.map +1 -0
- package/dist/null-device/null-canvas-context.js +47 -0
- package/dist/null-device/null-device-features.d.ts +30 -0
- package/dist/null-device/null-device-features.d.ts.map +1 -0
- package/dist/null-device/null-device-features.js +32 -0
- package/dist/null-device/null-device-info.d.ts +3 -0
- package/dist/null-device/null-device-info.d.ts.map +1 -0
- package/dist/null-device/null-device-info.js +14 -0
- package/dist/null-device/null-device.d.ts +62 -0
- package/dist/null-device/null-device.d.ts.map +1 -0
- package/dist/null-device/null-device.js +134 -0
- package/dist/null-device/resources/null-buffer.d.ts +12 -0
- package/dist/null-device/resources/null-buffer.d.ts.map +1 -0
- package/dist/null-device/resources/null-buffer.js +30 -0
- package/dist/null-device/resources/null-command-buffer.d.ts +17 -0
- package/dist/null-device/resources/null-command-buffer.d.ts.map +1 -0
- package/dist/null-device/resources/null-command-buffer.js +20 -0
- package/dist/null-device/resources/null-framebuffer.d.ts +8 -0
- package/dist/null-device/resources/null-framebuffer.d.ts.map +1 -0
- package/dist/null-device/resources/null-framebuffer.js +11 -0
- package/dist/null-device/resources/null-query-set.d.ts +7 -0
- package/dist/null-device/resources/null-query-set.d.ts.map +1 -0
- package/dist/null-device/resources/null-query-set.js +11 -0
- package/dist/null-device/resources/null-render-pass.d.ts +14 -0
- package/dist/null-device/resources/null-render-pass.d.ts.map +1 -0
- package/dist/null-device/resources/null-render-pass.js +18 -0
- package/dist/null-device/resources/null-render-pipeline.d.ts +23 -0
- package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -0
- package/dist/null-device/resources/null-render-pipeline.js +38 -0
- package/dist/null-device/resources/null-sampler.d.ts +7 -0
- package/dist/null-device/resources/null-sampler.d.ts.map +1 -0
- package/dist/null-device/resources/null-sampler.js +11 -0
- package/dist/null-device/resources/null-shader.d.ts +8 -0
- package/dist/null-device/resources/null-shader.d.ts.map +1 -0
- package/dist/null-device/resources/null-shader.js +14 -0
- package/dist/null-device/resources/null-texture-view.d.ts +12 -0
- package/dist/null-device/resources/null-texture-view.d.ts.map +1 -0
- package/dist/null-device/resources/null-texture-view.js +13 -0
- package/dist/null-device/resources/null-texture.d.ts +33 -0
- package/dist/null-device/resources/null-texture.d.ts.map +1 -0
- package/dist/null-device/resources/null-texture.js +91 -0
- package/dist/null-device/resources/null-transform-feedback.d.ts +15 -0
- package/dist/null-device/resources/null-transform-feedback.d.ts.map +1 -0
- package/dist/null-device/resources/null-transform-feedback.js +32 -0
- package/dist/null-device/resources/null-vertex-array.d.ts +14 -0
- package/dist/null-device/resources/null-vertex-array.d.ts.map +1 -0
- package/dist/null-device/resources/null-vertex-array.js +26 -0
- package/dist/performance-test-runner.d.ts +1 -1
- package/dist/performance-test-runner.d.ts.map +1 -1
- package/dist/performance-test-runner.js +3 -2
- package/dist/register-devices.js +2 -1
- package/dist/snapshot-test-runner.d.ts +1 -1
- package/dist/snapshot-test-runner.d.ts.map +1 -1
- package/dist/snapshot-test-runner.js +5 -2
- package/dist/test-runner.d.ts +3 -3
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +8 -7
- package/dist/utils/check-type.d.ts.map +1 -1
- package/dist/utils/deep-copy.js +1 -1
- package/dist/utils/get-bounding-box.d.ts.map +1 -1
- package/dist/utils/resource-tracker.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/create-test-device.ts +30 -24
- package/src/engine/classic-animation-loop.ts +15 -11
- package/src/index.ts +2 -1
- package/src/null-device/null-canvas-context.ts +58 -0
- package/src/null-device/null-device-features.ts +34 -0
- package/src/null-device/null-device-info.ts +17 -0
- package/src/null-device/null-device.ts +194 -0
- package/src/null-device/resources/null-buffer.ts +42 -0
- package/src/null-device/resources/null-command-buffer.ts +38 -0
- package/src/null-device/resources/null-framebuffer.ts +16 -0
- package/src/null-device/resources/null-query-set.ts +15 -0
- package/src/null-device/resources/null-render-pass.ts +26 -0
- package/src/null-device/resources/null-render-pipeline.ts +62 -0
- package/src/null-device/resources/null-sampler.ts +15 -0
- package/src/null-device/resources/null-shader.ts +19 -0
- package/src/null-device/resources/null-texture-view.ts +21 -0
- package/src/null-device/resources/null-texture.ts +121 -0
- package/src/null-device/resources/null-transform-feedback.ts +46 -0
- package/src/null-device/resources/null-vertex-array.ts +37 -0
- package/src/performance-test-runner.ts +2 -1
- package/src/register-devices.ts +2 -1
- package/src/snapshot-test-runner.ts +6 -2
- package/src/test-runner.ts +14 -8
- package/src/utils/check-type.ts +0 -1
- package/src/utils/deep-copy.ts +1 -1
- package/src/utils/get-bounding-box.ts +6 -1
- package/src/utils/resource-tracker.ts +4 -1
- package/dist/check-type.d.ts +0 -6
- package/dist/check-type.d.ts.map +0 -1
- package/dist/check-type.js +0 -5
- package/dist/utils.d.ts +0 -7
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -10
|
@@ -5,12 +5,12 @@ import { WebGPUDevice } from '@luma.gl/webgpu';
|
|
|
5
5
|
export declare function createTestContext(opts?: Record<string, any>): WebGL2RenderingContext | null;
|
|
6
6
|
/** Create a test WebGLDevice */
|
|
7
7
|
export declare function createTestDevice(props?: DeviceProps): WebGLDevice | null;
|
|
8
|
-
/**
|
|
8
|
+
/** This WebGL Device can be used directly but will not have WebGL debugging initialized */
|
|
9
9
|
export declare const webglDevice: WebGLDevice;
|
|
10
|
-
/** Only available after getTestDevices() has completed */
|
|
10
|
+
/** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
|
|
11
|
+
export declare let webglDeviceAsync: WebGLDevice;
|
|
12
|
+
/** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
|
|
11
13
|
export declare let webgpuDevice: WebGPUDevice;
|
|
12
|
-
/** Synchronously get test devices (only WebGLDevices) */
|
|
13
|
-
export declare function getWebGLTestDevices(): WebGLDevice[];
|
|
14
14
|
/** Includes WebGPU device if available */
|
|
15
|
-
export declare function getTestDevices(): Promise<Device[]>;
|
|
15
|
+
export declare function getTestDevices(type?: 'webgl' | 'webgpu'): Promise<Device[]>;
|
|
16
16
|
//# sourceMappingURL=create-test-device.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAQ7C,kCAAkC;AAClC,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,sBAAsB,GAAG,IAAI,CAG/F;AAED,gCAAgC;AAChC,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,WAAgB,GAAG,WAAW,GAAG,IAAI,CAU5E;AAED,2FAA2F;AAC3F,eAAO,MAAM,WAAW,aAAqB,CAAC;AAE9C,wGAAwG;AACxG,eAAO,IAAI,gBAAgB,EAAE,WAAW,CAAC;AAEzC,wGAAwG;AACxG,eAAO,IAAI,YAAY,EAAE,YAAY,CAAC;AAItC,0CAA0C;AAC1C,wBAAsB,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBjF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
|
-
import { luma } from '@luma.gl/core';
|
|
4
|
+
import { luma, log } from '@luma.gl/core';
|
|
4
5
|
import { WebGLDevice } from '@luma.gl/webgl';
|
|
5
6
|
const CONTEXT_DEFAULTS = {
|
|
6
7
|
width: 1,
|
|
@@ -25,31 +26,37 @@ export function createTestDevice(props = {}) {
|
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
/**
|
|
29
|
-
export const webglDevice = createTestDevice(
|
|
30
|
-
/** Only available after getTestDevices() has completed */
|
|
29
|
+
/** This WebGL Device can be used directly but will not have WebGL debugging initialized */
|
|
30
|
+
export const webglDevice = createTestDevice();
|
|
31
|
+
/** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
|
|
32
|
+
export let webglDeviceAsync;
|
|
33
|
+
/** A WebGL 2 Device intended for testing - @note Only available after getTestDevices() has completed */
|
|
31
34
|
export let webgpuDevice;
|
|
32
|
-
let
|
|
33
|
-
/** Synchronously get test devices (only WebGLDevices) */
|
|
34
|
-
export function getWebGLTestDevices() {
|
|
35
|
-
const devices = [];
|
|
36
|
-
devices.push(webglDevice);
|
|
37
|
-
return devices;
|
|
38
|
-
}
|
|
35
|
+
let devicesCreated = false;
|
|
39
36
|
/** Includes WebGPU device if available */
|
|
40
|
-
export async function getTestDevices() {
|
|
41
|
-
if (!
|
|
42
|
-
|
|
37
|
+
export async function getTestDevices(type) {
|
|
38
|
+
if (!devicesCreated) {
|
|
39
|
+
devicesCreated = true;
|
|
43
40
|
try {
|
|
44
|
-
webgpuDevice = await luma.createDevice({
|
|
41
|
+
webgpuDevice = (await luma.createDevice({
|
|
42
|
+
id: 'webgpu-test-device',
|
|
43
|
+
type: 'webgpu'
|
|
44
|
+
}));
|
|
45
45
|
}
|
|
46
|
-
catch {
|
|
47
|
-
|
|
46
|
+
catch (error) {
|
|
47
|
+
log.error(String(error))();
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
webglDeviceAsync = (await luma.createDevice({
|
|
51
|
+
id: 'webgl-test-device',
|
|
52
|
+
type: 'webgl'
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
log.error(String(error))();
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return devices;
|
|
59
|
+
return [webglDeviceAsync, webgpuDevice]
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.filter(device => !type || type === device.type);
|
|
55
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic-animation-loop.d.ts","sourceRoot":"","sources":["../../src/engine/classic-animation-loop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classic-animation-loop.d.ts","sourceRoot":"","sources":["../../src/engine/classic-animation-loop.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,MAAM,EACN,WAAW,EAIZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAO5C,KAAK,YAAY,GAAG,WAAW,CAAC;AAahC;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,aAAa,EAAE,oBAAoB,CAAC;IAEpC,8BAA8B;IAC9B,IAAI,EAAE,MAAM,oBAAoB,CAAC;IAEjC,8BAA8B;IAC9B,EAAE,EAAE,sBAAsB,CAAC;IAC3B,kCAAkC;IAClC,WAAW,EAAE,OAAO,CAAC;IAErB,gCAAgC;I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OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAAC,cAAc,EAAE,qBAAqB,GAAG,EAAE,GAAG,IAAI;IAK9D,QAAQ,CAAC,cAAc,EAAE,qBAAqB;IAK9C,UAAU,CAAC,cAAc,EAAE,qBAAqB;IAOhD,wCAAwC;IACxC,eAAe,CAAC,KAAK,EAAE,YAAY;IAKnC,kBAAkB;IAClB,mBAAmB,CAAC,EAAE,KAAA,EAAE,YAAY,SAAI;IAQxC,WAAW,CAAC,KAAK,EAAE,yBAAyB;IAe5C,mBAAmB;IAiBnB,WAAW,CAAC,OAAO,EAAE,GAAG;IAcxB,sBAAsB;IActB,qBAAqB;IAerB,eAAe;IAUf,YAAY,CAAC,KAAK,EAAE,qBAAqB;IAYzC,iBAAiB;IAIjB,WAAW;IASX,uBAAuB;IAwCvB,mBAAmB;IA+BnB,qBAAqB;IAMrB,uDAAuD;IACvD,gBAAgB,CAAC,UAAU,KAAA;IAM3B,yFAAyF;IACnF,aAAa,CAAC,KAAK,EAAE,WAAW;IAiBtC,cAAc;IAuBd,iBAAiB;;;;;IAkBjB,6BAA6B;IAC7B,eAAe;IAMf;;;OAGG;IACH,0BAA0B;IAM1B,YAAY;IAuBZ,UAAU;IAWV,mBAAmB;IAQnB,YAAY,CAAC,CAAC,KAAA;IAGd,aAAa,CAAC,CAAC,KAAA;IAMf,kBAAkB;IAClB,kBAAkB;IAOlB,kBAAkB;IAClB,kBAAkB;CAQnB"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// TODO - replace createGLContext, instrumentGLContext, resizeGLContext?
|
|
2
5
|
// TODO - remove dependency on framebuffer (bundle size impact)
|
|
3
6
|
import { luma, log, requestAnimationFrame, cancelAnimationFrame } from '@luma.gl/core';
|
|
@@ -17,7 +20,7 @@ const DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS = {
|
|
|
17
20
|
onInitialize: () => ({}),
|
|
18
21
|
onRender: () => { },
|
|
19
22
|
onFinalize: () => { },
|
|
20
|
-
onError:
|
|
23
|
+
onError: error => console.error(error), // eslint-disable-line no-console
|
|
21
24
|
device: null,
|
|
22
25
|
// debug: true,
|
|
23
26
|
// view parameters
|
|
@@ -200,7 +203,7 @@ export class ClassicAnimationLoop {
|
|
|
200
203
|
waitForRender() {
|
|
201
204
|
this.setNeedsRedraw('waitForRender');
|
|
202
205
|
if (!this._nextFramePromise) {
|
|
203
|
-
this._nextFramePromise = new Promise(
|
|
206
|
+
this._nextFramePromise = new Promise(resolve => {
|
|
204
207
|
this._resolveNextFrame = resolve;
|
|
205
208
|
});
|
|
206
209
|
}
|