@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
|
@@ -2,17 +2,32 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
|
|
5
|
+
import type {
|
|
6
|
+
TextureProps,
|
|
7
|
+
Sampler,
|
|
8
|
+
SamplerProps,
|
|
9
|
+
TextureViewProps,
|
|
10
|
+
CopyExternalImageOptions
|
|
11
|
+
} from '@luma.gl/core';
|
|
12
|
+
import type {
|
|
13
|
+
Texture1DData,
|
|
14
|
+
Texture2DData,
|
|
15
|
+
Texture3DData,
|
|
16
|
+
TextureCubeData,
|
|
17
|
+
TextureArrayData,
|
|
18
|
+
TextureCubeArrayData
|
|
19
|
+
} from '@luma.gl/core';
|
|
20
|
+
|
|
21
|
+
import {Texture} from '@luma.gl/core';
|
|
7
22
|
import {NullDevice} from '../null-device';
|
|
8
23
|
import {NullSampler} from './null-sampler';
|
|
9
24
|
import {NullTextureView} from './null-texture-view';
|
|
10
25
|
|
|
11
|
-
export class NullTexture extends Texture
|
|
26
|
+
export class NullTexture extends Texture {
|
|
12
27
|
readonly device: NullDevice;
|
|
13
28
|
|
|
14
|
-
sampler
|
|
15
|
-
view
|
|
29
|
+
sampler: NullSampler;
|
|
30
|
+
view: NullTextureView;
|
|
16
31
|
|
|
17
32
|
constructor(device: NullDevice, props: TextureProps) {
|
|
18
33
|
super(device, props);
|
|
@@ -21,7 +36,7 @@ export class NullTexture extends Texture<TextureProps> {
|
|
|
21
36
|
|
|
22
37
|
// Signature: new Texture2D(gl, {data: url})
|
|
23
38
|
if (typeof this.props?.data === 'string') {
|
|
24
|
-
|
|
39
|
+
throw new Error('Texture2D: Loading textures from URLs is not supported');
|
|
25
40
|
}
|
|
26
41
|
|
|
27
42
|
this.initialize(this.props);
|
|
@@ -40,22 +55,33 @@ export class NullTexture extends Texture<TextureProps> {
|
|
|
40
55
|
return new NullTextureView(this.device, {...props, texture: this});
|
|
41
56
|
}
|
|
42
57
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (data instanceof Promise) {
|
|
47
|
-
data.then(resolvedImageData =>
|
|
48
|
-
this.initialize(
|
|
49
|
-
Object.assign({}, props, {
|
|
50
|
-
pixels: resolvedImageData,
|
|
51
|
-
data: resolvedImageData
|
|
52
|
-
})
|
|
53
|
-
)
|
|
54
|
-
);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
58
|
+
setTexture1DData(data: Texture1DData): void {
|
|
59
|
+
throw new Error('not implemented');
|
|
60
|
+
}
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
setTexture2DData(lodData: Texture2DData, depth?: number, target?: number): void {
|
|
63
|
+
throw new Error('not implemented');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setTexture3DData(lodData: Texture3DData, depth?: number, target?: number): void {
|
|
67
|
+
throw new Error('not implemented');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setTextureCubeData(data: TextureCubeData, depth?: number): void {
|
|
71
|
+
throw new Error('not implemented');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setTextureArrayData(data: TextureArrayData): void {
|
|
75
|
+
throw new Error('not implemented');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
setTextureCubeArrayData(data: TextureCubeArrayData): void {
|
|
79
|
+
throw new Error('not implemented');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
initialize(props: TextureProps = {}): this {
|
|
83
|
+
// const data = props.data;
|
|
84
|
+
// this.setImageData(props);
|
|
59
85
|
|
|
60
86
|
this.setSampler(props.sampler);
|
|
61
87
|
|
|
@@ -79,29 +105,17 @@ export class NullTexture extends Texture<TextureProps> {
|
|
|
79
105
|
return this;
|
|
80
106
|
}
|
|
81
107
|
|
|
82
|
-
|
|
83
|
-
const {height, width, mipmaps = false} = options;
|
|
84
|
-
if (width !== this.width || height !== this.height) {
|
|
85
|
-
return this.initialize({
|
|
86
|
-
width,
|
|
87
|
-
height,
|
|
88
|
-
mipmaps
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setImageData(options: {data?: any; width?: number; height?: number}) {
|
|
108
|
+
copyExternalImage(options: CopyExternalImageOptions): {width: number; height: number} {
|
|
95
109
|
this.trackDeallocatedMemory('Texture');
|
|
96
110
|
|
|
97
|
-
const {data} = options;
|
|
111
|
+
const {image: data} = options;
|
|
98
112
|
|
|
99
|
-
if (data && data.byteLength) {
|
|
100
|
-
|
|
101
|
-
} else {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
113
|
+
// if (data && data.byteLength) {
|
|
114
|
+
// this.trackAllocatedMemory(data.byteLength, 'Texture');
|
|
115
|
+
// } else {
|
|
116
|
+
const bytesPerPixel = 4;
|
|
117
|
+
this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, 'Texture');
|
|
118
|
+
// }
|
|
105
119
|
|
|
106
120
|
const width = options.width ?? (data as ImageBitmap).width;
|
|
107
121
|
const height = options.height ?? (data as ImageBitmap).height;
|
|
@@ -109,13 +123,6 @@ export class NullTexture extends Texture<TextureProps> {
|
|
|
109
123
|
this.width = width;
|
|
110
124
|
this.height = height;
|
|
111
125
|
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
setSubImageData(options: {data: any; width?: number; height?: number; x?: number; y?: number}) {
|
|
116
|
-
const {data, x = 0, y = 0} = options;
|
|
117
|
-
const width = options.width ?? (data as ImageBitmap).width;
|
|
118
|
-
const height = options.height ?? (data as ImageBitmap).height;
|
|
119
|
-
assert(width + x <= this.width && height + y <= this.height);
|
|
126
|
+
return {width, height};
|
|
120
127
|
}
|
|
121
128
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {TypedArray} from '@math.gl/types';
|
|
6
|
+
import type {Buffer, VertexArrayProps} from '@luma.gl/core';
|
|
6
7
|
import {VertexArray} from '@luma.gl/core';
|
|
7
8
|
|
|
8
9
|
import type {NullDevice} from '../null-device';
|
package/src/register-devices.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {luma} from '@luma.gl/core';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import {webgl2Adapter} from '@luma.gl/webgl';
|
|
7
|
+
import {webgpuAdapter} from '@luma.gl/webgpu';
|
|
8
8
|
|
|
9
|
-
luma.
|
|
9
|
+
luma.registerAdapters([webgl2Adapter, webgpuAdapter]);
|