@luma.gl/test-utils 9.0.0-beta.6 → 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 +24 -21
- package/dist/index.cjs +548 -17
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- 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/package.json +6 -6
- package/src/create-test-device.ts +24 -22
- 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/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":"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,
|
|
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,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { luma } from '@luma.gl/core';
|
|
4
|
+
import { luma, log } from '@luma.gl/core';
|
|
5
5
|
import { WebGLDevice } from '@luma.gl/webgl';
|
|
6
6
|
const CONTEXT_DEFAULTS = {
|
|
7
7
|
width: 1,
|
|
@@ -26,34 +26,37 @@ export function createTestDevice(props = {}) {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
export const webglDevice = createTestDevice(
|
|
31
|
-
/** 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 */
|
|
32
34
|
export let webgpuDevice;
|
|
33
|
-
let
|
|
34
|
-
/** Synchronously get test devices (only WebGLDevices) */
|
|
35
|
-
export function getWebGLTestDevices() {
|
|
36
|
-
const devices = [];
|
|
37
|
-
devices.push(webglDevice);
|
|
38
|
-
return devices;
|
|
39
|
-
}
|
|
35
|
+
let devicesCreated = false;
|
|
40
36
|
/** Includes WebGPU device if available */
|
|
41
|
-
export async function getTestDevices() {
|
|
42
|
-
if (!
|
|
43
|
-
|
|
37
|
+
export async function getTestDevices(type) {
|
|
38
|
+
if (!devicesCreated) {
|
|
39
|
+
devicesCreated = true;
|
|
44
40
|
try {
|
|
45
41
|
webgpuDevice = (await luma.createDevice({
|
|
46
42
|
id: 'webgpu-test-device',
|
|
47
43
|
type: 'webgpu'
|
|
48
44
|
}));
|
|
49
45
|
}
|
|
50
|
-
catch {
|
|
51
|
-
|
|
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))();
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
return devices;
|
|
59
|
+
return [webglDeviceAsync, webgpuDevice]
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.filter(device => !type || type === device.type);
|
|
59
62
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ 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;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,10 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
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
|
+
};
|
|
18
23
|
|
|
19
24
|
// dist/index.js
|
|
20
25
|
var dist_exports = {};
|
|
21
26
|
__export(dist_exports, {
|
|
27
|
+
NullDevice: () => NullDevice,
|
|
22
28
|
PerformanceTestRunner: () => PerformanceTestRunner,
|
|
23
29
|
SnapshotTestRunner: () => SnapshotTestRunner,
|
|
24
30
|
checkType: () => checkType,
|
|
@@ -28,7 +34,6 @@ __export(dist_exports, {
|
|
|
28
34
|
getLeakedResources: () => getLeakedResources,
|
|
29
35
|
getResourceCounts: () => getResourceCounts,
|
|
30
36
|
getTestDevices: () => getTestDevices,
|
|
31
|
-
getWebGLTestDevices: () => getWebGLTestDevices,
|
|
32
37
|
webglDevice: () => webglDevice,
|
|
33
38
|
webgpuDevice: () => webgpuDevice
|
|
34
39
|
});
|
|
@@ -61,30 +66,31 @@ function createTestDevice(props = {}) {
|
|
|
61
66
|
return null;
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
|
-
var webglDevice = createTestDevice(
|
|
69
|
+
var webglDevice = createTestDevice();
|
|
70
|
+
var webglDeviceAsync;
|
|
65
71
|
var webgpuDevice;
|
|
66
|
-
var
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return devices;
|
|
71
|
-
}
|
|
72
|
-
async function getTestDevices() {
|
|
73
|
-
if (!webgpuCreated) {
|
|
74
|
-
webgpuCreated = true;
|
|
72
|
+
var devicesCreated = false;
|
|
73
|
+
async function getTestDevices(type) {
|
|
74
|
+
if (!devicesCreated) {
|
|
75
|
+
devicesCreated = true;
|
|
75
76
|
try {
|
|
76
77
|
webgpuDevice = await import_core2.luma.createDevice({
|
|
77
78
|
id: "webgpu-test-device",
|
|
78
79
|
type: "webgpu"
|
|
79
80
|
});
|
|
80
|
-
} catch {
|
|
81
|
+
} catch (error) {
|
|
82
|
+
import_core2.log.error(String(error))();
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
webglDeviceAsync = await import_core2.luma.createDevice({
|
|
86
|
+
id: "webgl-test-device",
|
|
87
|
+
type: "webgl"
|
|
88
|
+
});
|
|
89
|
+
} catch (error) {
|
|
90
|
+
import_core2.log.error(String(error))();
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
|
-
|
|
84
|
-
if (webgpuDevice) {
|
|
85
|
-
devices.unshift(webgpuDevice);
|
|
86
|
-
}
|
|
87
|
-
return devices;
|
|
93
|
+
return [webglDeviceAsync, webgpuDevice].filter(Boolean).filter((device) => !type || type === device.type);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
// dist/engine/classic-animation-loop.js
|
|
@@ -806,6 +812,531 @@ var PerformanceTestRunner = class extends TestRunner {
|
|
|
806
812
|
}
|
|
807
813
|
};
|
|
808
814
|
|
|
815
|
+
// dist/null-device/null-device.js
|
|
816
|
+
var import_core18 = require("@luma.gl/core");
|
|
817
|
+
|
|
818
|
+
// dist/null-device/null-device-info.js
|
|
819
|
+
var NullDeviceInfo = {
|
|
820
|
+
type: "webgl",
|
|
821
|
+
gpu: "software",
|
|
822
|
+
gpuType: "unknown",
|
|
823
|
+
gpuBackend: "unknown",
|
|
824
|
+
vendor: "",
|
|
825
|
+
renderer: "none",
|
|
826
|
+
version: "1.0",
|
|
827
|
+
shadingLanguage: "glsl",
|
|
828
|
+
shadingLanguageVersion: 300
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
// dist/null-device/null-device-features.js
|
|
832
|
+
var import_core4 = require("@luma.gl/core");
|
|
833
|
+
var NullDeviceLimits = class extends import_core4.DeviceLimits {
|
|
834
|
+
maxTextureDimension1D = 0;
|
|
835
|
+
maxTextureDimension2D = 2048;
|
|
836
|
+
maxTextureDimension3D = 256;
|
|
837
|
+
maxTextureArrayLayers = 256;
|
|
838
|
+
maxBindGroups = 0;
|
|
839
|
+
maxDynamicUniformBuffersPerPipelineLayout = 0;
|
|
840
|
+
maxDynamicStorageBuffersPerPipelineLayout = 0;
|
|
841
|
+
maxSampledTexturesPerShaderStage = 8;
|
|
842
|
+
maxSamplersPerShaderStage = 16;
|
|
843
|
+
maxStorageBuffersPerShaderStage = 0;
|
|
844
|
+
maxStorageTexturesPerShaderStage = 0;
|
|
845
|
+
maxUniformBuffersPerShaderStage = 20;
|
|
846
|
+
maxUniformBufferBindingSize = 16384;
|
|
847
|
+
maxStorageBufferBindingSize = 0;
|
|
848
|
+
minUniformBufferOffsetAlignment = 0;
|
|
849
|
+
minStorageBufferOffsetAlignment = 0;
|
|
850
|
+
maxVertexBuffers = 16;
|
|
851
|
+
maxVertexAttributes = 16;
|
|
852
|
+
maxVertexBufferArrayStride = 2048;
|
|
853
|
+
maxInterStageShaderComponents = 60;
|
|
854
|
+
maxComputeWorkgroupStorageSize = 0;
|
|
855
|
+
maxComputeInvocationsPerWorkgroup = 0;
|
|
856
|
+
maxComputeWorkgroupSizeX = 0;
|
|
857
|
+
maxComputeWorkgroupSizeY = 0;
|
|
858
|
+
maxComputeWorkgroupSizeZ = 0;
|
|
859
|
+
maxComputeWorkgroupsPerDimension = 0;
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
// dist/null-device/null-canvas-context.js
|
|
863
|
+
var import_core6 = require("@luma.gl/core");
|
|
864
|
+
|
|
865
|
+
// dist/null-device/resources/null-framebuffer.js
|
|
866
|
+
var import_core5 = require("@luma.gl/core");
|
|
867
|
+
var NullFramebuffer = class extends import_core5.Framebuffer {
|
|
868
|
+
device;
|
|
869
|
+
constructor(device, props) {
|
|
870
|
+
super(device, props);
|
|
871
|
+
this.device = device;
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// dist/null-device/null-canvas-context.js
|
|
876
|
+
var NullCanvasContext = class extends import_core6.CanvasContext {
|
|
877
|
+
device;
|
|
878
|
+
presentationSize;
|
|
879
|
+
_framebuffer = null;
|
|
880
|
+
constructor(device, props) {
|
|
881
|
+
super(props);
|
|
882
|
+
this.device = device;
|
|
883
|
+
this.presentationSize = [-1, -1];
|
|
884
|
+
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
|
|
885
|
+
this.update();
|
|
886
|
+
}
|
|
887
|
+
getCurrentFramebuffer() {
|
|
888
|
+
this.update();
|
|
889
|
+
this._framebuffer = this._framebuffer || new NullFramebuffer(this.device, { handle: null });
|
|
890
|
+
return this._framebuffer;
|
|
891
|
+
}
|
|
892
|
+
/** Resizes and updates render targets if necessary */
|
|
893
|
+
update() {
|
|
894
|
+
const size = this.getPixelSize();
|
|
895
|
+
const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
|
|
896
|
+
if (sizeChanged) {
|
|
897
|
+
this.presentationSize = size;
|
|
898
|
+
this.resize();
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
resize(options) {
|
|
902
|
+
if (this.canvas) {
|
|
903
|
+
const devicePixelRatio = this.getDevicePixelRatio(options == null ? void 0 : options.useDevicePixels);
|
|
904
|
+
this.setDevicePixelRatio(devicePixelRatio, options);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
getDrawingBufferSize() {
|
|
909
|
+
return [this.width, this.height];
|
|
910
|
+
}
|
|
911
|
+
commit() {
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
// dist/null-device/resources/null-buffer.js
|
|
916
|
+
var import_core7 = require("@luma.gl/core");
|
|
917
|
+
var NullBuffer = class extends import_core7.Buffer {
|
|
918
|
+
device;
|
|
919
|
+
byteLength;
|
|
920
|
+
constructor(device, props = {}) {
|
|
921
|
+
super(device, props);
|
|
922
|
+
this.device = device;
|
|
923
|
+
const byteOffset = props.byteOffset || 0;
|
|
924
|
+
const byteLength = props.byteLength ?? (props.data ? props.data.byteLength + byteOffset : 0);
|
|
925
|
+
(0, import_core7.assert)(byteLength >= 0);
|
|
926
|
+
this.byteLength = byteLength;
|
|
927
|
+
this.trackAllocatedMemory(byteLength);
|
|
928
|
+
}
|
|
929
|
+
destroy() {
|
|
930
|
+
if (!this.destroyed) {
|
|
931
|
+
super.destroy();
|
|
932
|
+
this.trackDeallocatedMemory();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
async readAsync(byteOffset = 0, byteLength) {
|
|
936
|
+
byteLength = byteLength ?? this.byteLength - byteOffset;
|
|
937
|
+
return new Uint8Array(byteLength);
|
|
938
|
+
}
|
|
939
|
+
write(data, byteOffset = 0) {
|
|
940
|
+
(0, import_core7.assert)(data.byteLength + byteOffset <= this.byteLength);
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// dist/null-device/resources/null-shader.js
|
|
945
|
+
var import_core8 = require("@luma.gl/core");
|
|
946
|
+
var NullShader = class extends import_core8.Shader {
|
|
947
|
+
device;
|
|
948
|
+
constructor(device, props) {
|
|
949
|
+
super(device, props);
|
|
950
|
+
this.device = device;
|
|
951
|
+
}
|
|
952
|
+
async getCompilationInfo() {
|
|
953
|
+
return [];
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
// dist/null-device/resources/null-command-buffer.js
|
|
958
|
+
var import_core9 = require("@luma.gl/core");
|
|
959
|
+
var NullCommandEncoder = class extends import_core9.CommandEncoder {
|
|
960
|
+
device;
|
|
961
|
+
constructor(device, props) {
|
|
962
|
+
super(device, props);
|
|
963
|
+
this.device = device;
|
|
964
|
+
}
|
|
965
|
+
finish() {
|
|
966
|
+
}
|
|
967
|
+
copyBufferToBuffer(options) {
|
|
968
|
+
}
|
|
969
|
+
copyBufferToTexture(options) {
|
|
970
|
+
}
|
|
971
|
+
copyTextureToBuffer(options) {
|
|
972
|
+
}
|
|
973
|
+
copyTextureToTexture(options) {
|
|
974
|
+
}
|
|
975
|
+
pushDebugGroup(groupLabel) {
|
|
976
|
+
}
|
|
977
|
+
popDebugGroup() {
|
|
978
|
+
}
|
|
979
|
+
insertDebugMarker(markerLabel) {
|
|
980
|
+
}
|
|
981
|
+
resolveQuerySet(querySet) {
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
// dist/null-device/resources/null-sampler.js
|
|
986
|
+
var import_core10 = require("@luma.gl/core");
|
|
987
|
+
var NullSampler = class extends import_core10.Sampler {
|
|
988
|
+
device;
|
|
989
|
+
constructor(device, props) {
|
|
990
|
+
super(device, props);
|
|
991
|
+
this.device = device;
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
// dist/null-device/resources/null-texture.js
|
|
996
|
+
var import_core12 = require("@luma.gl/core");
|
|
997
|
+
|
|
998
|
+
// dist/null-device/resources/null-texture-view.js
|
|
999
|
+
var import_core11 = require("@luma.gl/core");
|
|
1000
|
+
var NullTextureView = class extends import_core11.TextureView {
|
|
1001
|
+
device;
|
|
1002
|
+
texture;
|
|
1003
|
+
constructor(device, props) {
|
|
1004
|
+
super(device, { ...import_core11.Texture.defaultProps, ...props });
|
|
1005
|
+
this.device = device;
|
|
1006
|
+
this.texture = props.texture;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
// dist/null-device/resources/null-texture.js
|
|
1011
|
+
var NullTexture = class extends import_core12.Texture {
|
|
1012
|
+
device;
|
|
1013
|
+
sampler;
|
|
1014
|
+
view;
|
|
1015
|
+
constructor(device, props) {
|
|
1016
|
+
var _a;
|
|
1017
|
+
super(device, props);
|
|
1018
|
+
this.device = device;
|
|
1019
|
+
if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
|
|
1020
|
+
Object.assign(this.props, { data: (0, import_core12.loadImage)(this.props.data) });
|
|
1021
|
+
}
|
|
1022
|
+
this.initialize(this.props);
|
|
1023
|
+
Object.seal(this);
|
|
1024
|
+
}
|
|
1025
|
+
destroy() {
|
|
1026
|
+
if (!this.destroyed) {
|
|
1027
|
+
super.destroy();
|
|
1028
|
+
this.trackDeallocatedMemory("Texture");
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
createView(props) {
|
|
1032
|
+
return new NullTextureView(this.device, { ...props, texture: this });
|
|
1033
|
+
}
|
|
1034
|
+
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
|
+
this.setSampler(props.sampler);
|
|
1045
|
+
this.view = new NullTextureView(this.device, {
|
|
1046
|
+
...props,
|
|
1047
|
+
texture: this,
|
|
1048
|
+
mipLevelCount: 1,
|
|
1049
|
+
arrayLayerCount: 1
|
|
1050
|
+
});
|
|
1051
|
+
return this;
|
|
1052
|
+
}
|
|
1053
|
+
setSampler(sampler = {}) {
|
|
1054
|
+
if (sampler instanceof NullSampler) {
|
|
1055
|
+
this.sampler = sampler;
|
|
1056
|
+
} else {
|
|
1057
|
+
this.sampler = new NullSampler(this.device, sampler);
|
|
1058
|
+
}
|
|
1059
|
+
return this;
|
|
1060
|
+
}
|
|
1061
|
+
resize(options) {
|
|
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) {
|
|
1073
|
+
this.trackDeallocatedMemory("Texture");
|
|
1074
|
+
const { data } = options;
|
|
1075
|
+
if (data && data.byteLength) {
|
|
1076
|
+
this.trackAllocatedMemory(data.byteLength, "Texture");
|
|
1077
|
+
} else {
|
|
1078
|
+
const bytesPerPixel = 4;
|
|
1079
|
+
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, "Texture");
|
|
1080
|
+
}
|
|
1081
|
+
const width = options.width ?? data.width;
|
|
1082
|
+
const height = options.height ?? data.height;
|
|
1083
|
+
this.width = width;
|
|
1084
|
+
this.height = height;
|
|
1085
|
+
return this;
|
|
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);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
// dist/null-device/resources/null-render-pass.js
|
|
1096
|
+
var import_core13 = require("@luma.gl/core");
|
|
1097
|
+
var NullRenderPass = class extends import_core13.RenderPass {
|
|
1098
|
+
device;
|
|
1099
|
+
constructor(device, props) {
|
|
1100
|
+
super(device, props);
|
|
1101
|
+
this.device = device;
|
|
1102
|
+
}
|
|
1103
|
+
end() {
|
|
1104
|
+
}
|
|
1105
|
+
pushDebugGroup(groupLabel) {
|
|
1106
|
+
}
|
|
1107
|
+
popDebugGroup() {
|
|
1108
|
+
}
|
|
1109
|
+
insertDebugMarker(markerLabel) {
|
|
1110
|
+
}
|
|
1111
|
+
setParameters(parameters = {}) {
|
|
1112
|
+
}
|
|
1113
|
+
beginOcclusionQuery(queryIndex) {
|
|
1114
|
+
}
|
|
1115
|
+
endOcclusionQuery() {
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// dist/null-device/resources/null-render-pipeline.js
|
|
1120
|
+
var import_core14 = require("@luma.gl/core");
|
|
1121
|
+
var NullRenderPipeline = class extends import_core14.RenderPipeline {
|
|
1122
|
+
device;
|
|
1123
|
+
vs;
|
|
1124
|
+
fs;
|
|
1125
|
+
uniforms = {};
|
|
1126
|
+
bindings = {};
|
|
1127
|
+
constructor(device, props) {
|
|
1128
|
+
super(device, props);
|
|
1129
|
+
this.device = device;
|
|
1130
|
+
this.vs = (0, import_core14.cast)(props.vs);
|
|
1131
|
+
this.fs = (0, import_core14.cast)(props.fs);
|
|
1132
|
+
this.shaderLayout = props.shaderLayout || {
|
|
1133
|
+
attributes: [],
|
|
1134
|
+
bindings: [],
|
|
1135
|
+
uniforms: []
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
setBindings(bindings) {
|
|
1139
|
+
Object.assign(this.bindings, bindings);
|
|
1140
|
+
}
|
|
1141
|
+
setUniformsWebGL(uniforms) {
|
|
1142
|
+
Object.assign(this.uniforms, uniforms);
|
|
1143
|
+
}
|
|
1144
|
+
draw(options) {
|
|
1145
|
+
const { renderPass, vertexArray } = options;
|
|
1146
|
+
vertexArray.bindBeforeRender(renderPass);
|
|
1147
|
+
vertexArray.unbindAfterRender(renderPass);
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// dist/null-device/resources/null-vertex-array.js
|
|
1153
|
+
var import_core15 = require("@luma.gl/core");
|
|
1154
|
+
var NullVertexArray = class extends import_core15.VertexArray {
|
|
1155
|
+
device;
|
|
1156
|
+
// Create a VertexArray
|
|
1157
|
+
constructor(device, props) {
|
|
1158
|
+
super(device, props);
|
|
1159
|
+
this.device = device;
|
|
1160
|
+
}
|
|
1161
|
+
setIndexBuffer(indexBuffer) {
|
|
1162
|
+
this.indexBuffer = indexBuffer;
|
|
1163
|
+
}
|
|
1164
|
+
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
1165
|
+
setBuffer(location, attributeBuffer) {
|
|
1166
|
+
const attributeInfo = this.attributeInfos[location];
|
|
1167
|
+
if (!attributeInfo) {
|
|
1168
|
+
throw new Error(`Unknown attribute location ${location}`);
|
|
1169
|
+
}
|
|
1170
|
+
this.attributes[location] = attributeBuffer;
|
|
1171
|
+
}
|
|
1172
|
+
bindBeforeRender() {
|
|
1173
|
+
}
|
|
1174
|
+
unbindAfterRender() {
|
|
1175
|
+
}
|
|
1176
|
+
setConstantWebGL(location, value) {
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
// dist/null-device/resources/null-transform-feedback.js
|
|
1181
|
+
var import_core16 = require("@luma.gl/core");
|
|
1182
|
+
var NullTransformFeedback = class extends import_core16.TransformFeedback {
|
|
1183
|
+
device;
|
|
1184
|
+
layout;
|
|
1185
|
+
buffers = {};
|
|
1186
|
+
constructor(device, props) {
|
|
1187
|
+
super(device, props);
|
|
1188
|
+
this.device = device;
|
|
1189
|
+
this.layout = this.props.layout;
|
|
1190
|
+
if (props.buffers) {
|
|
1191
|
+
this.setBuffers(props.buffers);
|
|
1192
|
+
}
|
|
1193
|
+
Object.seal(this);
|
|
1194
|
+
}
|
|
1195
|
+
begin(topology = "point-list") {
|
|
1196
|
+
}
|
|
1197
|
+
end() {
|
|
1198
|
+
}
|
|
1199
|
+
setBuffers(buffers) {
|
|
1200
|
+
this.buffers = {};
|
|
1201
|
+
for (const bufferName in buffers) {
|
|
1202
|
+
this.setBuffer(bufferName, buffers[bufferName]);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
setBuffer(locationOrName, bufferOrRange) {
|
|
1206
|
+
this.buffers[locationOrName] = bufferOrRange;
|
|
1207
|
+
}
|
|
1208
|
+
getBuffer(locationOrName) {
|
|
1209
|
+
return this.buffers[locationOrName] || null;
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
// dist/null-device/resources/null-query-set.js
|
|
1214
|
+
var import_core17 = require("@luma.gl/core");
|
|
1215
|
+
var NullQuerySet = class extends import_core17.QuerySet {
|
|
1216
|
+
device;
|
|
1217
|
+
constructor(device, props) {
|
|
1218
|
+
super(device, props);
|
|
1219
|
+
this.device = device;
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
// dist/null-device/null-device.js
|
|
1224
|
+
var _NullDevice = class extends import_core18.Device {
|
|
1225
|
+
static isSupported() {
|
|
1226
|
+
return true;
|
|
1227
|
+
}
|
|
1228
|
+
type = "unknown";
|
|
1229
|
+
features = new import_core18.DeviceFeatures([], this.props.disabledFeatures);
|
|
1230
|
+
limits = new NullDeviceLimits();
|
|
1231
|
+
info = NullDeviceInfo;
|
|
1232
|
+
canvasContext;
|
|
1233
|
+
lost;
|
|
1234
|
+
static async create(props = {}) {
|
|
1235
|
+
if (typeof props.canvas === "string") {
|
|
1236
|
+
await import_core18.CanvasContext.pageLoaded;
|
|
1237
|
+
}
|
|
1238
|
+
return new _NullDevice(props);
|
|
1239
|
+
}
|
|
1240
|
+
constructor(props) {
|
|
1241
|
+
super({ ...props, id: props.id || (0, import_core18.uid)("dummy-device") });
|
|
1242
|
+
this.canvasContext = new NullCanvasContext(this, props);
|
|
1243
|
+
this.lost = new Promise((resolve) => {
|
|
1244
|
+
});
|
|
1245
|
+
this.canvasContext.resize();
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Destroys the context
|
|
1249
|
+
* @note Has no effect for WebGL browser contexts, there is no browser API for destroying contexts
|
|
1250
|
+
*/
|
|
1251
|
+
destroy() {
|
|
1252
|
+
}
|
|
1253
|
+
get isLost() {
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
getSize() {
|
|
1257
|
+
return [this.canvasContext.width, this.canvasContext.height];
|
|
1258
|
+
}
|
|
1259
|
+
isTextureFormatSupported(format) {
|
|
1260
|
+
return true;
|
|
1261
|
+
}
|
|
1262
|
+
isTextureFormatFilterable(format) {
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
isTextureFormatRenderable(format) {
|
|
1266
|
+
return true;
|
|
1267
|
+
}
|
|
1268
|
+
// IMPLEMENTATION OF ABSTRACT DEVICE
|
|
1269
|
+
createCanvasContext(props) {
|
|
1270
|
+
return new NullCanvasContext(this, props);
|
|
1271
|
+
}
|
|
1272
|
+
createBuffer(props) {
|
|
1273
|
+
const newProps = this._getBufferProps(props);
|
|
1274
|
+
return new NullBuffer(this, newProps);
|
|
1275
|
+
}
|
|
1276
|
+
getDefaultRenderPass() {
|
|
1277
|
+
return new NullRenderPass(this, {});
|
|
1278
|
+
}
|
|
1279
|
+
_createTexture(props) {
|
|
1280
|
+
return new NullTexture(this, props);
|
|
1281
|
+
}
|
|
1282
|
+
createExternalTexture(props) {
|
|
1283
|
+
throw new Error("createExternalTexture() not implemented");
|
|
1284
|
+
}
|
|
1285
|
+
createSampler(props) {
|
|
1286
|
+
return new NullSampler(this, props);
|
|
1287
|
+
}
|
|
1288
|
+
createShader(props) {
|
|
1289
|
+
return new NullShader(this, props);
|
|
1290
|
+
}
|
|
1291
|
+
createFramebuffer(props) {
|
|
1292
|
+
return new NullFramebuffer(this, props);
|
|
1293
|
+
}
|
|
1294
|
+
createVertexArray(props) {
|
|
1295
|
+
return new NullVertexArray(this, props);
|
|
1296
|
+
}
|
|
1297
|
+
createTransformFeedback(props) {
|
|
1298
|
+
return new NullTransformFeedback(this, props);
|
|
1299
|
+
}
|
|
1300
|
+
createQuerySet(props) {
|
|
1301
|
+
return new NullQuerySet(this, props);
|
|
1302
|
+
}
|
|
1303
|
+
createRenderPipeline(props) {
|
|
1304
|
+
return new NullRenderPipeline(this, props);
|
|
1305
|
+
}
|
|
1306
|
+
beginRenderPass(props) {
|
|
1307
|
+
return new NullRenderPass(this, props);
|
|
1308
|
+
}
|
|
1309
|
+
createComputePipeline(props) {
|
|
1310
|
+
throw new Error("ComputePipeline not supported in WebGL");
|
|
1311
|
+
}
|
|
1312
|
+
beginComputePass(props) {
|
|
1313
|
+
throw new Error("ComputePass not supported in WebGL");
|
|
1314
|
+
}
|
|
1315
|
+
createCommandEncoder(props = {}) {
|
|
1316
|
+
return new NullCommandEncoder(this, props);
|
|
1317
|
+
}
|
|
1318
|
+
submit() {
|
|
1319
|
+
}
|
|
1320
|
+
setParametersWebGL(parameters) {
|
|
1321
|
+
}
|
|
1322
|
+
getParametersWebGL(parameters) {
|
|
1323
|
+
}
|
|
1324
|
+
withParametersWebGL(parameters, func) {
|
|
1325
|
+
const { nocatch = true } = parameters;
|
|
1326
|
+
let value;
|
|
1327
|
+
if (nocatch) {
|
|
1328
|
+
return func();
|
|
1329
|
+
}
|
|
1330
|
+
try {
|
|
1331
|
+
value = func();
|
|
1332
|
+
} catch {
|
|
1333
|
+
}
|
|
1334
|
+
return value;
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
var NullDevice = _NullDevice;
|
|
1338
|
+
__publicField(NullDevice, "type", "unknown");
|
|
1339
|
+
|
|
809
1340
|
// dist/utils/check-type.js
|
|
810
1341
|
function checkType(value) {
|
|
811
1342
|
}
|