@luma.gl/test-utils 9.0.17 → 9.1.0-alpha.10
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.map +1 -1
- package/dist/create-test-device.js +7 -4
- package/dist/engine/classic-animation-loop.d.ts.map +1 -1
- package/dist/engine/classic-animation-loop.js +2 -1
- package/dist/index.cjs +70 -66
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/null-device/null-adapter.d.ts +13 -0
- package/dist/null-device/null-adapter.d.ts.map +1 -0
- package/dist/null-device/null-adapter.js +30 -0
- package/dist/null-device/null-canvas-context.d.ts +3 -1
- package/dist/null-device/null-canvas-context.d.ts.map +1 -1
- package/dist/null-device/null-canvas-context.js +2 -0
- package/dist/null-device/null-device.d.ts +0 -4
- package/dist/null-device/null-device.d.ts.map +1 -1
- package/dist/null-device/null-device.js +2 -17
- package/dist/null-device/resources/null-buffer.d.ts.map +1 -1
- package/dist/null-device/resources/null-buffer.js +3 -3
- package/dist/null-device/resources/null-framebuffer.d.ts +3 -0
- package/dist/null-device/resources/null-framebuffer.d.ts.map +1 -1
- package/dist/null-device/resources/null-framebuffer.js +2 -0
- package/dist/null-device/resources/null-render-pipeline.d.ts.map +1 -1
- package/dist/null-device/resources/null-render-pipeline.js +3 -3
- package/dist/null-device/resources/null-texture.d.ts +12 -18
- package/dist/null-device/resources/null-texture.d.ts.map +1 -1
- package/dist/null-device/resources/null-texture.js +31 -38
- package/dist/null-device/resources/null-vertex-array.d.ts +2 -1
- package/dist/null-device/resources/null-vertex-array.d.ts.map +1 -1
- package/dist/register-devices.js +3 -3
- package/dist/test-runner.d.ts +1 -1
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/utils/resource-tracker.d.ts +2 -2
- package/package.json +9 -9
- package/src/create-test-device.ts +7 -5
- package/src/engine/classic-animation-loop.ts +2 -8
- package/src/index.ts +3 -0
- package/src/null-device/null-adapter.ts +38 -0
- package/src/null-device/null-canvas-context.ts +4 -1
- package/src/null-device/null-device.ts +2 -21
- package/src/null-device/resources/null-buffer.ts +3 -3
- package/src/null-device/resources/null-framebuffer.ts +4 -0
- package/src/null-device/resources/null-render-pipeline.ts +3 -3
- package/src/null-device/resources/null-texture.ts +56 -49
- package/src/null-device/resources/null-vertex-array.ts +2 -1
- package/src/register-devices.ts +3 -3
|
@@ -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,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAEvD,OAAO,
|
|
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,EAAgB,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAgB,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAQ5D,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,CA0BjF"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { luma, log } from '@luma.gl/core';
|
|
5
|
-
import { WebGLDevice } from '@luma.gl/webgl';
|
|
5
|
+
import { webgl2Adapter, WebGLDevice } from '@luma.gl/webgl';
|
|
6
|
+
import { webgpuAdapter } from '@luma.gl/webgpu';
|
|
6
7
|
const CONTEXT_DEFAULTS = {
|
|
7
8
|
width: 1,
|
|
8
9
|
height: 1,
|
|
@@ -17,7 +18,7 @@ export function createTestContext(opts = {}) {
|
|
|
17
18
|
export function createTestDevice(props = {}) {
|
|
18
19
|
try {
|
|
19
20
|
props = { ...CONTEXT_DEFAULTS, ...props, debug: true };
|
|
20
|
-
// We dont use luma.createDevice since
|
|
21
|
+
// TODO - We dont use luma.createDevice since createTestDevice currently expect WebGL context to be created synchronously
|
|
21
22
|
return new WebGLDevice(props);
|
|
22
23
|
}
|
|
23
24
|
catch (error) {
|
|
@@ -40,7 +41,8 @@ export async function getTestDevices(type) {
|
|
|
40
41
|
try {
|
|
41
42
|
webgpuDevice = (await luma.createDevice({
|
|
42
43
|
id: 'webgpu-test-device',
|
|
43
|
-
type: 'webgpu'
|
|
44
|
+
type: 'webgpu',
|
|
45
|
+
adapters: [webgpuAdapter]
|
|
44
46
|
}));
|
|
45
47
|
}
|
|
46
48
|
catch (error) {
|
|
@@ -49,7 +51,8 @@ export async function getTestDevices(type) {
|
|
|
49
51
|
try {
|
|
50
52
|
webglDeviceAsync = (await luma.createDevice({
|
|
51
53
|
id: 'webgl-test-device',
|
|
52
|
-
type: 'webgl'
|
|
54
|
+
type: 'webgl',
|
|
55
|
+
adapters: [webgl2Adapter]
|
|
53
56
|
}));
|
|
54
57
|
}
|
|
55
58
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic-animation-loop.d.ts","sourceRoot":"","sources":["../../src/engine/classic-animation-loop.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"classic-animation-loop.d.ts","sourceRoot":"","sources":["../../src/engine/classic-animation-loop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAO,MAAM,EAAE,WAAW,EAAM,MAAM,eAAe,CAAC;AAE7D,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;IAChC,SAAS,EAAE,QAAQ,CAAC;IACpB,qCAAqC;IACrC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,qCAAqC;IACrC,cAAc,EAAE,oBAAoB,CAAC;CACtC,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,yBAAyB,GAAG;IACtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,sBAAsB,CAAC;IAClE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,KAAK,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACzF,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC3D,UAAU,CAAC,EAAE,CAAC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E,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"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// TODO - replace createGLContext, instrumentGLContext, resizeGLContext?
|
|
5
5
|
// TODO - remove dependency on framebuffer (bundle size impact)
|
|
6
|
-
import { luma, log
|
|
6
|
+
import { luma, log } from '@luma.gl/core';
|
|
7
|
+
import { requestAnimationFrame, cancelAnimationFrame } from '@luma.gl/engine';
|
|
7
8
|
import { isBrowser } from '@probe.gl/env';
|
|
8
9
|
import { resetGLParameters } from '@luma.gl/webgl';
|
|
9
10
|
const isPage = isBrowser() && typeof document !== 'undefined';
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,14 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __publicField = (obj, key, value) => {
|
|
20
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
18
|
|
|
24
19
|
// dist/index.js
|
|
25
20
|
var dist_exports = {};
|
|
26
21
|
__export(dist_exports, {
|
|
22
|
+
NullAdapter: () => NullAdapter,
|
|
27
23
|
NullDevice: () => NullDevice,
|
|
28
24
|
PerformanceTestRunner: () => PerformanceTestRunner,
|
|
29
25
|
SnapshotTestRunner: () => SnapshotTestRunner,
|
|
@@ -34,6 +30,7 @@ __export(dist_exports, {
|
|
|
34
30
|
getLeakedResources: () => getLeakedResources,
|
|
35
31
|
getResourceCounts: () => getResourceCounts,
|
|
36
32
|
getTestDevices: () => getTestDevices,
|
|
33
|
+
nullAdapter: () => nullAdapter,
|
|
37
34
|
webglDevice: () => webglDevice,
|
|
38
35
|
webgpuDevice: () => webgpuDevice
|
|
39
36
|
});
|
|
@@ -43,11 +40,12 @@ module.exports = __toCommonJS(dist_exports);
|
|
|
43
40
|
var import_core = require("@luma.gl/core");
|
|
44
41
|
var import_webgl = require("@luma.gl/webgl");
|
|
45
42
|
var import_webgpu = require("@luma.gl/webgpu");
|
|
46
|
-
import_core.luma.
|
|
43
|
+
import_core.luma.registerAdapters([import_webgl.webgl2Adapter, import_webgpu.webgpuAdapter]);
|
|
47
44
|
|
|
48
45
|
// dist/create-test-device.js
|
|
49
46
|
var import_core2 = require("@luma.gl/core");
|
|
50
47
|
var import_webgl2 = require("@luma.gl/webgl");
|
|
48
|
+
var import_webgpu2 = require("@luma.gl/webgpu");
|
|
51
49
|
var CONTEXT_DEFAULTS = {
|
|
52
50
|
width: 1,
|
|
53
51
|
height: 1,
|
|
@@ -76,7 +74,8 @@ async function getTestDevices(type) {
|
|
|
76
74
|
try {
|
|
77
75
|
webgpuDevice = await import_core2.luma.createDevice({
|
|
78
76
|
id: "webgpu-test-device",
|
|
79
|
-
type: "webgpu"
|
|
77
|
+
type: "webgpu",
|
|
78
|
+
adapters: [import_webgpu2.webgpuAdapter]
|
|
80
79
|
});
|
|
81
80
|
} catch (error) {
|
|
82
81
|
import_core2.log.error(String(error))();
|
|
@@ -84,7 +83,8 @@ async function getTestDevices(type) {
|
|
|
84
83
|
try {
|
|
85
84
|
webglDeviceAsync = await import_core2.luma.createDevice({
|
|
86
85
|
id: "webgl-test-device",
|
|
87
|
-
type: "webgl"
|
|
86
|
+
type: "webgl",
|
|
87
|
+
adapters: [import_webgl2.webgl2Adapter]
|
|
88
88
|
});
|
|
89
89
|
} catch (error) {
|
|
90
90
|
import_core2.log.error(String(error))();
|
|
@@ -95,6 +95,7 @@ async function getTestDevices(type) {
|
|
|
95
95
|
|
|
96
96
|
// dist/engine/classic-animation-loop.js
|
|
97
97
|
var import_core3 = require("@luma.gl/core");
|
|
98
|
+
var import_engine = require("@luma.gl/engine");
|
|
98
99
|
var import_env = require("@probe.gl/env");
|
|
99
100
|
var import_webgl3 = require("@luma.gl/webgl");
|
|
100
101
|
var isPage = (0, import_env.isBrowser)() && typeof document !== "undefined";
|
|
@@ -353,13 +354,13 @@ var ClassicAnimationLoop = class {
|
|
|
353
354
|
if (!this._running) {
|
|
354
355
|
return;
|
|
355
356
|
}
|
|
356
|
-
this._animationFrameId = (0,
|
|
357
|
+
this._animationFrameId = (0, import_engine.requestAnimationFrame)(this._animationFrame.bind(this));
|
|
357
358
|
}
|
|
358
359
|
_cancelAnimationFrame() {
|
|
359
360
|
if (this._animationFrameId !== null) {
|
|
360
361
|
return;
|
|
361
362
|
}
|
|
362
|
-
(0,
|
|
363
|
+
(0, import_engine.cancelAnimationFrame)(this._animationFrameId);
|
|
363
364
|
this._animationFrameId = null;
|
|
364
365
|
}
|
|
365
366
|
_animationFrame() {
|
|
@@ -812,6 +813,9 @@ var PerformanceTestRunner = class extends TestRunner {
|
|
|
812
813
|
}
|
|
813
814
|
};
|
|
814
815
|
|
|
816
|
+
// dist/null-device/null-adapter.js
|
|
817
|
+
var import_core19 = require("@luma.gl/core");
|
|
818
|
+
|
|
815
819
|
// dist/null-device/null-device.js
|
|
816
820
|
var import_core18 = require("@luma.gl/core");
|
|
817
821
|
|
|
@@ -866,6 +870,8 @@ var import_core6 = require("@luma.gl/core");
|
|
|
866
870
|
var import_core5 = require("@luma.gl/core");
|
|
867
871
|
var NullFramebuffer = class extends import_core5.Framebuffer {
|
|
868
872
|
device;
|
|
873
|
+
colorAttachments = [];
|
|
874
|
+
depthStencilAttachment = null;
|
|
869
875
|
constructor(device, props) {
|
|
870
876
|
super(device, props);
|
|
871
877
|
this.device = device;
|
|
@@ -875,6 +881,8 @@ var NullFramebuffer = class extends import_core5.Framebuffer {
|
|
|
875
881
|
// dist/null-device/null-canvas-context.js
|
|
876
882
|
var NullCanvasContext = class extends import_core6.CanvasContext {
|
|
877
883
|
device;
|
|
884
|
+
format = "rgba8unorm";
|
|
885
|
+
depthStencilFormat = "depth24plus";
|
|
878
886
|
presentationSize;
|
|
879
887
|
_framebuffer = null;
|
|
880
888
|
constructor(device, props) {
|
|
@@ -922,7 +930,6 @@ var NullBuffer = class extends import_core7.Buffer {
|
|
|
922
930
|
this.device = device;
|
|
923
931
|
const byteOffset = props.byteOffset || 0;
|
|
924
932
|
const byteLength = props.byteLength ?? (props.data ? props.data.byteLength + byteOffset : 0);
|
|
925
|
-
(0, import_core7.assert)(byteLength >= 0);
|
|
926
933
|
this.byteLength = byteLength;
|
|
927
934
|
this.trackAllocatedMemory(byteLength);
|
|
928
935
|
}
|
|
@@ -937,7 +944,6 @@ var NullBuffer = class extends import_core7.Buffer {
|
|
|
937
944
|
return new Uint8Array(byteLength);
|
|
938
945
|
}
|
|
939
946
|
write(data, byteOffset = 0) {
|
|
940
|
-
(0, import_core7.assert)(data.byteLength + byteOffset <= this.byteLength);
|
|
941
947
|
}
|
|
942
948
|
};
|
|
943
949
|
|
|
@@ -1017,7 +1023,7 @@ var NullTexture = class extends import_core12.Texture {
|
|
|
1017
1023
|
super(device, props);
|
|
1018
1024
|
this.device = device;
|
|
1019
1025
|
if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
|
|
1020
|
-
|
|
1026
|
+
throw new Error("Texture2D: Loading textures from URLs is not supported");
|
|
1021
1027
|
}
|
|
1022
1028
|
this.initialize(this.props);
|
|
1023
1029
|
Object.seal(this);
|
|
@@ -1031,16 +1037,25 @@ var NullTexture = class extends import_core12.Texture {
|
|
|
1031
1037
|
createView(props) {
|
|
1032
1038
|
return new NullTextureView(this.device, { ...props, texture: this });
|
|
1033
1039
|
}
|
|
1040
|
+
setTexture1DData(data) {
|
|
1041
|
+
throw new Error("not implemented");
|
|
1042
|
+
}
|
|
1043
|
+
setTexture2DData(lodData, depth, target) {
|
|
1044
|
+
throw new Error("not implemented");
|
|
1045
|
+
}
|
|
1046
|
+
setTexture3DData(lodData, depth, target) {
|
|
1047
|
+
throw new Error("not implemented");
|
|
1048
|
+
}
|
|
1049
|
+
setTextureCubeData(data, depth) {
|
|
1050
|
+
throw new Error("not implemented");
|
|
1051
|
+
}
|
|
1052
|
+
setTextureArrayData(data) {
|
|
1053
|
+
throw new Error("not implemented");
|
|
1054
|
+
}
|
|
1055
|
+
setTextureCubeArrayData(data) {
|
|
1056
|
+
throw new Error("not implemented");
|
|
1057
|
+
}
|
|
1034
1058
|
initialize(props = {}) {
|
|
1035
|
-
const data = props.data;
|
|
1036
|
-
if (data instanceof Promise) {
|
|
1037
|
-
data.then((resolvedImageData) => this.initialize(Object.assign({}, props, {
|
|
1038
|
-
pixels: resolvedImageData,
|
|
1039
|
-
data: resolvedImageData
|
|
1040
|
-
})));
|
|
1041
|
-
return this;
|
|
1042
|
-
}
|
|
1043
|
-
this.setImageData(props);
|
|
1044
1059
|
this.setSampler(props.sampler);
|
|
1045
1060
|
this.view = new NullTextureView(this.device, {
|
|
1046
1061
|
...props,
|
|
@@ -1058,37 +1073,16 @@ var NullTexture = class extends import_core12.Texture {
|
|
|
1058
1073
|
}
|
|
1059
1074
|
return this;
|
|
1060
1075
|
}
|
|
1061
|
-
|
|
1062
|
-
const { height, width, mipmaps = false } = options;
|
|
1063
|
-
if (width !== this.width || height !== this.height) {
|
|
1064
|
-
return this.initialize({
|
|
1065
|
-
width,
|
|
1066
|
-
height,
|
|
1067
|
-
mipmaps
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
return this;
|
|
1071
|
-
}
|
|
1072
|
-
setImageData(options) {
|
|
1076
|
+
copyExternalImage(options) {
|
|
1073
1077
|
this.trackDeallocatedMemory("Texture");
|
|
1074
|
-
const { data } = options;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
} else {
|
|
1078
|
-
const bytesPerPixel = 4;
|
|
1079
|
-
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, "Texture");
|
|
1080
|
-
}
|
|
1078
|
+
const { image: data } = options;
|
|
1079
|
+
const bytesPerPixel = 4;
|
|
1080
|
+
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, "Texture");
|
|
1081
1081
|
const width = options.width ?? data.width;
|
|
1082
1082
|
const height = options.height ?? data.height;
|
|
1083
1083
|
this.width = width;
|
|
1084
1084
|
this.height = height;
|
|
1085
|
-
return
|
|
1086
|
-
}
|
|
1087
|
-
setSubImageData(options) {
|
|
1088
|
-
const { data, x = 0, y = 0 } = options;
|
|
1089
|
-
const width = options.width ?? data.width;
|
|
1090
|
-
const height = options.height ?? data.height;
|
|
1091
|
-
(0, import_core12.assert)(width + x <= this.width && height + y <= this.height);
|
|
1085
|
+
return { width, height };
|
|
1092
1086
|
}
|
|
1093
1087
|
};
|
|
1094
1088
|
|
|
@@ -1127,8 +1121,8 @@ var NullRenderPipeline = class extends import_core14.RenderPipeline {
|
|
|
1127
1121
|
constructor(device, props) {
|
|
1128
1122
|
super(device, props);
|
|
1129
1123
|
this.device = device;
|
|
1130
|
-
this.vs =
|
|
1131
|
-
this.fs =
|
|
1124
|
+
this.vs = props.vs;
|
|
1125
|
+
this.fs = props.fs;
|
|
1132
1126
|
this.shaderLayout = props.shaderLayout || {
|
|
1133
1127
|
attributes: [],
|
|
1134
1128
|
bindings: [],
|
|
@@ -1221,7 +1215,7 @@ var NullQuerySet = class extends import_core17.QuerySet {
|
|
|
1221
1215
|
};
|
|
1222
1216
|
|
|
1223
1217
|
// dist/null-device/null-device.js
|
|
1224
|
-
var
|
|
1218
|
+
var NullDevice = class extends import_core18.Device {
|
|
1225
1219
|
static isSupported() {
|
|
1226
1220
|
return true;
|
|
1227
1221
|
}
|
|
@@ -1231,17 +1225,8 @@ var _NullDevice = class extends import_core18.Device {
|
|
|
1231
1225
|
info = NullDeviceInfo;
|
|
1232
1226
|
canvasContext;
|
|
1233
1227
|
lost;
|
|
1234
|
-
static attach(handle) {
|
|
1235
|
-
return new _NullDevice({});
|
|
1236
|
-
}
|
|
1237
|
-
static async create(props = {}) {
|
|
1238
|
-
if (typeof props.canvas === "string") {
|
|
1239
|
-
await import_core18.CanvasContext.pageLoaded;
|
|
1240
|
-
}
|
|
1241
|
-
return new _NullDevice(props);
|
|
1242
|
-
}
|
|
1243
1228
|
constructor(props) {
|
|
1244
|
-
super({ ...props, id: props.id ||
|
|
1229
|
+
super({ ...props, id: props.id || "null-device" });
|
|
1245
1230
|
this.canvasContext = new NullCanvasContext(this, props);
|
|
1246
1231
|
this.lost = new Promise((resolve) => {
|
|
1247
1232
|
});
|
|
@@ -1256,9 +1241,6 @@ var _NullDevice = class extends import_core18.Device {
|
|
|
1256
1241
|
get isLost() {
|
|
1257
1242
|
return false;
|
|
1258
1243
|
}
|
|
1259
|
-
getSize() {
|
|
1260
|
-
return [this.canvasContext.width, this.canvasContext.height];
|
|
1261
|
-
}
|
|
1262
1244
|
isTextureFormatSupported(format) {
|
|
1263
1245
|
return true;
|
|
1264
1246
|
}
|
|
@@ -1337,8 +1319,30 @@ var _NullDevice = class extends import_core18.Device {
|
|
|
1337
1319
|
return value;
|
|
1338
1320
|
}
|
|
1339
1321
|
};
|
|
1340
|
-
|
|
1341
|
-
|
|
1322
|
+
|
|
1323
|
+
// dist/null-device/null-adapter.js
|
|
1324
|
+
var NullAdapter = class extends import_core19.Adapter {
|
|
1325
|
+
/** type of device's created by this adapter */
|
|
1326
|
+
type = "unknown";
|
|
1327
|
+
constructor() {
|
|
1328
|
+
super();
|
|
1329
|
+
NullDevice.adapter = this;
|
|
1330
|
+
}
|
|
1331
|
+
/** Check if WebGPU is available */
|
|
1332
|
+
isSupported() {
|
|
1333
|
+
return true;
|
|
1334
|
+
}
|
|
1335
|
+
async attach(handle) {
|
|
1336
|
+
return new NullDevice({});
|
|
1337
|
+
}
|
|
1338
|
+
async create(props = {}) {
|
|
1339
|
+
if (typeof props.canvas === "string") {
|
|
1340
|
+
await import_core19.CanvasContext.pageLoaded;
|
|
1341
|
+
}
|
|
1342
|
+
return new NullDevice(props);
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
var nullAdapter = new NullAdapter();
|
|
1342
1346
|
|
|
1343
1347
|
// dist/utils/check-type.js
|
|
1344
1348
|
function checkType(value) {
|