@luma.gl/core 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/adapter/adapter.d.ts +11 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.js +8 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +23 -11
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +22 -20
- package/dist/adapter/luma.d.ts +70 -0
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/adapter/luma.js +159 -0
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +144 -47
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +120 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +7 -17
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +4 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/parameters.js +1 -0
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +635 -821
- package/dist/dist.min.js +6 -6
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts +43 -0
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +67 -31
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +3 -5
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +396 -567
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -37
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +9 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/adapter.ts +16 -0
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +52 -36
- package/src/adapter/luma.ts +219 -0
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +285 -76
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +10 -18
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +14 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +99 -39
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +3 -14
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +67 -83
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +20 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts +0 -23
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/init.d.ts +0 -5
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -37
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts +0 -38
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/luma.js +0 -141
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/init.ts +0 -53
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/luma.ts +0 -190
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
|
@@ -8,6 +8,12 @@ import { Resource } from "./resource.js";
|
|
|
8
8
|
* https://gpuweb.github.io/gpuweb/#gputexture
|
|
9
9
|
*/
|
|
10
10
|
export class Texture extends Resource {
|
|
11
|
+
static COPY_SRC = 0x01;
|
|
12
|
+
static COPY_DST = 0x02;
|
|
13
|
+
static TEXTURE = 0x04;
|
|
14
|
+
static STORAGE = 0x08;
|
|
15
|
+
static RENDER_ATTACHMENT = 0x10;
|
|
16
|
+
static CubeFaces = ['+X', '-X', '+Y', '-Y', '+Z', '-Z'];
|
|
11
17
|
static defaultProps = {
|
|
12
18
|
...Resource.defaultProps,
|
|
13
19
|
data: null,
|
|
@@ -16,23 +22,14 @@ export class Texture extends Resource {
|
|
|
16
22
|
width: undefined,
|
|
17
23
|
height: undefined,
|
|
18
24
|
depth: 1,
|
|
19
|
-
mipmaps:
|
|
20
|
-
// type: undefined,
|
|
25
|
+
mipmaps: false,
|
|
21
26
|
compressed: false,
|
|
22
|
-
// mipLevels: 1,
|
|
23
27
|
usage: 0,
|
|
24
|
-
// usage: GPUTextureUsage.COPY_DST
|
|
25
28
|
mipLevels: undefined,
|
|
26
29
|
samples: undefined,
|
|
27
|
-
type: undefined,
|
|
28
30
|
sampler: {},
|
|
29
31
|
view: undefined
|
|
30
32
|
};
|
|
31
|
-
static COPY_SRC = 0x01;
|
|
32
|
-
static COPY_DST = 0x02;
|
|
33
|
-
static TEXTURE_BINDING = 0x04;
|
|
34
|
-
static STORAGE_BINDING = 0x08;
|
|
35
|
-
static RENDER_ATTACHMENT = 0x10;
|
|
36
33
|
get [Symbol.toStringTag]() {
|
|
37
34
|
return 'Texture';
|
|
38
35
|
}
|
|
@@ -46,17 +43,128 @@ export class Texture extends Resource {
|
|
|
46
43
|
height;
|
|
47
44
|
/** depth of this texture */
|
|
48
45
|
depth;
|
|
46
|
+
/** mip levels in this texture */
|
|
47
|
+
mipLevels;
|
|
49
48
|
/** "Time" of last update. Monotonically increasing timestamp */
|
|
50
49
|
updateTimestamp;
|
|
50
|
+
/** Check if data is an external image */
|
|
51
|
+
static isExternalImage(data) {
|
|
52
|
+
return ((typeof ImageData !== 'undefined' && data instanceof ImageData) ||
|
|
53
|
+
(typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap) ||
|
|
54
|
+
(typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) ||
|
|
55
|
+
(typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) ||
|
|
56
|
+
(typeof VideoFrame !== 'undefined' && data instanceof VideoFrame) ||
|
|
57
|
+
(typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) ||
|
|
58
|
+
(typeof OffscreenCanvas !== 'undefined' && data instanceof OffscreenCanvas));
|
|
59
|
+
}
|
|
60
|
+
/** Determine size (width and height) of provided image data */
|
|
61
|
+
static getExternalImageSize(data) {
|
|
62
|
+
if ((typeof ImageData !== 'undefined' && data instanceof ImageData) ||
|
|
63
|
+
(typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap) ||
|
|
64
|
+
(typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) ||
|
|
65
|
+
(typeof OffscreenCanvas !== 'undefined' && data instanceof OffscreenCanvas)) {
|
|
66
|
+
return { width: data.width, height: data.height };
|
|
67
|
+
}
|
|
68
|
+
if (typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) {
|
|
69
|
+
return { width: data.naturalWidth, height: data.naturalHeight };
|
|
70
|
+
}
|
|
71
|
+
if (typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) {
|
|
72
|
+
return { width: data.videoWidth, height: data.videoHeight };
|
|
73
|
+
}
|
|
74
|
+
if (typeof VideoFrame !== 'undefined' && data instanceof VideoFrame) {
|
|
75
|
+
// TODO: is this the right choice for width and height?
|
|
76
|
+
return { width: data.displayWidth, height: data.displayHeight };
|
|
77
|
+
}
|
|
78
|
+
throw new Error('Unknown image type');
|
|
79
|
+
}
|
|
80
|
+
/** Check if texture data is a typed array */
|
|
81
|
+
static isTextureLevelData(data) {
|
|
82
|
+
const typedArray = data?.data;
|
|
83
|
+
return ArrayBuffer.isView(typedArray);
|
|
84
|
+
}
|
|
85
|
+
/** Get the size of the texture described by the provided TextureData */
|
|
86
|
+
static getTextureDataSize(data) {
|
|
87
|
+
if (!data) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (ArrayBuffer.isView(data)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
// Recurse into arrays (array of miplevels)
|
|
94
|
+
if (Array.isArray(data)) {
|
|
95
|
+
return Texture.getTextureDataSize(data[0]);
|
|
96
|
+
}
|
|
97
|
+
if (Texture.isExternalImage(data)) {
|
|
98
|
+
return Texture.getExternalImageSize(data);
|
|
99
|
+
}
|
|
100
|
+
if (data && typeof data === 'object' && data.constructor === Object) {
|
|
101
|
+
const textureDataArray = Object.values(data);
|
|
102
|
+
const untypedData = textureDataArray[0];
|
|
103
|
+
return { width: untypedData.width, height: untypedData.height };
|
|
104
|
+
}
|
|
105
|
+
throw new Error('texture size deduction failed');
|
|
106
|
+
}
|
|
107
|
+
/** Calculate the number of mip levels for a texture of width and height */
|
|
108
|
+
static getMipLevelCount(width, height) {
|
|
109
|
+
return Math.floor(Math.log2(Math.max(width, height))) + 1;
|
|
110
|
+
}
|
|
111
|
+
/** Convert luma.gl cubemap face constants to depth index */
|
|
112
|
+
static getCubeFaceDepth(face) {
|
|
113
|
+
// prettier-ignore
|
|
114
|
+
switch (face) {
|
|
115
|
+
case '+X': return 0;
|
|
116
|
+
case '-X': return 1;
|
|
117
|
+
case '+Y': return 2;
|
|
118
|
+
case '-Y': return 3;
|
|
119
|
+
case '+Z': return 4;
|
|
120
|
+
case '-Z': return 5;
|
|
121
|
+
default: throw new Error(face);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
51
124
|
/** Do not use directly. Create with device.createTexture() */
|
|
52
|
-
constructor(device, props
|
|
53
|
-
super(device, props, defaultProps);
|
|
125
|
+
constructor(device, props) {
|
|
126
|
+
super(device, props, Texture.defaultProps);
|
|
54
127
|
this.dimension = this.props.dimension;
|
|
55
128
|
this.format = this.props.format;
|
|
129
|
+
// Size
|
|
56
130
|
this.width = this.props.width;
|
|
57
131
|
this.height = this.props.height;
|
|
58
132
|
this.depth = this.props.depth;
|
|
133
|
+
// Calculate size, if not provided
|
|
134
|
+
if (this.props.width === undefined || this.props.height === undefined) {
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
const size = Texture.getTextureDataSize(this.props.data);
|
|
137
|
+
this.width = size?.width || 1;
|
|
138
|
+
this.height = size?.height || 1;
|
|
139
|
+
}
|
|
140
|
+
// mipLevels
|
|
141
|
+
// If mipmap generation is requested and mipLevels is not provided, initialize a full pyramid
|
|
142
|
+
if (this.props.mipmaps && this.props.mipLevels === undefined) {
|
|
143
|
+
this.props.mipLevels = 'pyramid';
|
|
144
|
+
}
|
|
145
|
+
// Auto-calculate the number of mip levels as a convenience
|
|
146
|
+
// TODO - Should we clamp to 1-getMipLevelCount?
|
|
147
|
+
this.mipLevels =
|
|
148
|
+
this.props.mipLevels === 'pyramid'
|
|
149
|
+
? Texture.getMipLevelCount(this.width, this.height)
|
|
150
|
+
: this.props.mipLevels || 1;
|
|
59
151
|
// TODO - perhaps this should be set on async write completion?
|
|
60
152
|
this.updateTimestamp = device.incrementTimestamp();
|
|
61
153
|
}
|
|
154
|
+
/** Default options */
|
|
155
|
+
static defaultCopyExternalImageOptions = {
|
|
156
|
+
image: undefined,
|
|
157
|
+
sourceX: 0,
|
|
158
|
+
sourceY: 0,
|
|
159
|
+
width: undefined,
|
|
160
|
+
height: undefined,
|
|
161
|
+
depth: 1,
|
|
162
|
+
mipLevel: 0,
|
|
163
|
+
x: 0,
|
|
164
|
+
y: 0,
|
|
165
|
+
z: 0,
|
|
166
|
+
aspect: 'all',
|
|
167
|
+
colorSpace: 'srgb',
|
|
168
|
+
premultipliedAlpha: false
|
|
169
|
+
};
|
|
62
170
|
}
|
|
@@ -20,7 +20,7 @@ export type TransformFeedbackProps = ResourceProps & {
|
|
|
20
20
|
export declare abstract class TransformFeedback extends Resource<TransformFeedbackProps> {
|
|
21
21
|
static defaultProps: Required<TransformFeedbackProps>;
|
|
22
22
|
get [Symbol.toStringTag](): string;
|
|
23
|
-
constructor(device: Device, props
|
|
23
|
+
constructor(device: Device, props: TransformFeedbackProps);
|
|
24
24
|
abstract begin(topology?: PrimitiveTopology): void;
|
|
25
25
|
abstract end(): void;
|
|
26
26
|
abstract setBuffers(buffers: Record<string, Buffer | BufferRange>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/transform-feedback.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,iBAAiB,EAAC,+BAA4B;AACtD,OAAO,EAAC,YAAY,EAAC,kCAA+B;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,oBAAoB;AACpB,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF,8DAA8D;AAC9D,8BAAsB,iBAAkB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAC9E,OAA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AM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,IAAI;IACxE,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAC9F,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI;CACjF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TypedArray } from "../../types.js";
|
|
2
|
-
import { AttributeInfo } from "
|
|
2
|
+
import { AttributeInfo } from "../../adapter-utils/get-attribute-from-layouts.js";
|
|
3
3
|
import type { Device } from "../device.js";
|
|
4
4
|
import type { Buffer } from "./buffer.js";
|
|
5
5
|
import type { RenderPass } from "./render-pass.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAC5C,OAAO,EACL,aAAa,EAEd,
|
|
1
|
+
{"version":3,"file":"vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAC5C,OAAO,EACL,aAAa,EAEd,0DAAuD;AACxD,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,yBAAsB;AAC9C,OAAO,KAAK,EAAC,cAAc,EAAC,6BAA0B;AACtD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAGtD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,sCAAsC;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,8EAA8E;IAC9E,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;IAEnD,mBAAmB;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,wCAAwC;IACxC,UAAU,EAAE,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;gBAE/B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;IAenD,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IACrD,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAEnE,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IACvD,QAAQ,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIxD,uDAAuD;IACvD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;CAGnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { getAttributeInfosByLocation } from "
|
|
4
|
+
import { getAttributeInfosByLocation } from "../../adapter-utils/get-attribute-from-layouts.js";
|
|
5
5
|
import { Resource } from "./resource.js";
|
|
6
6
|
/**
|
|
7
7
|
* Stores attribute bindings.
|
|
@@ -30,7 +30,11 @@ export class VertexArray extends Resource {
|
|
|
30
30
|
super(device, props, VertexArray.defaultProps);
|
|
31
31
|
this.maxVertexAttributes = device.limits.maxVertexAttributes;
|
|
32
32
|
this.attributes = new Array(this.maxVertexAttributes).fill(null);
|
|
33
|
-
|
|
33
|
+
const { shaderLayout, bufferLayout } = props.renderPipeline || {};
|
|
34
|
+
if (!shaderLayout || !bufferLayout) {
|
|
35
|
+
throw new Error('VertexArray');
|
|
36
|
+
}
|
|
37
|
+
this.attributeInfos = getAttributeInfosByLocation(shaderLayout, bufferLayout, this.maxVertexAttributes);
|
|
34
38
|
}
|
|
35
39
|
// DEPRECATED METHODS
|
|
36
40
|
/** @deprecated Set constant attributes (WebGL only) */
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { NumberArray } from "../../types.js";
|
|
2
|
+
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
3
3
|
import type { Texture } from "../resources/texture.js";
|
|
4
|
+
import type { TextureView } from "../resources/texture-view.js";
|
|
4
5
|
/** Valid values for uniforms. @note boolean values get converted to 0 or 1 before setting */
|
|
5
|
-
export type UniformValue = number | boolean | Readonly<
|
|
6
|
-
/** Buffer bindings */
|
|
7
|
-
export type Binding = Texture | Buffer | {
|
|
8
|
-
buffer: Buffer;
|
|
9
|
-
offset?: number;
|
|
10
|
-
size?: number;
|
|
11
|
-
};
|
|
6
|
+
export type UniformValue = number | boolean | Readonly<NumberArray>;
|
|
12
7
|
/** Describes a buffer binding layout */
|
|
13
8
|
type BufferBindingLayout = {
|
|
14
9
|
/** The index of the binding point in the compiled and linked shader */
|
|
@@ -38,18 +33,13 @@ type StorageTextureBindingLayout = {
|
|
|
38
33
|
viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
39
34
|
};
|
|
40
35
|
export type BindingDeclaration = BufferBindingLayout | TextureBindingLayout | StorageTextureBindingLayout;
|
|
41
|
-
export type TextureView = {
|
|
42
|
-
texture: WebGLTexture;
|
|
43
|
-
layer?: number;
|
|
44
|
-
level?: number;
|
|
45
|
-
};
|
|
46
36
|
/**
|
|
47
37
|
* Framebuffer attachments lets the user specify the textures that will be used for a RenderPass,
|
|
48
38
|
* together with some additional options for how to clear.
|
|
49
39
|
*/
|
|
50
40
|
export type ColorAttachment = {
|
|
51
41
|
/** Describes the texture subresource that will be output to for this color attachment. */
|
|
52
|
-
texture?: Texture;
|
|
42
|
+
texture?: TextureView | Texture;
|
|
53
43
|
/** Format of the texture resource. Used to auto create texture if not supplied */
|
|
54
44
|
format?: ColorTextureFormat;
|
|
55
45
|
/** Value to clear to prior to executing the render pass. Default: [0, 0, 0, 0]. Ignored if loadOp is not "clear". */
|
|
@@ -65,7 +55,7 @@ export type ColorAttachment = {
|
|
|
65
55
|
*/
|
|
66
56
|
export type DepthStencilAttachment = {
|
|
67
57
|
/** Describes the texture subresource that will be output to and read from for this depth/stencil attachment. */
|
|
68
|
-
texture?: Texture;
|
|
58
|
+
texture?: TextureView | Texture;
|
|
69
59
|
/** Format of the texture resource. Used to auto create texture if not supplied */
|
|
70
60
|
format?: DepthStencilTextureFormat;
|
|
71
61
|
/** Value to clear depth component to prior to executing the render pass, if depthLoadOp is "clear". 0.0-1.0. */
|
|
@@ -86,4 +76,4 @@ export type DepthStencilAttachment = {
|
|
|
86
76
|
stencilReadOnly?: boolean;
|
|
87
77
|
};
|
|
88
78
|
export {};
|
|
89
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/attachments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAC,uBAAoB;AACxC,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,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H,MAAM,MAAM,eAAe,GAAG;IAC5B,0FAA0F;IAC1F,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IAChC,kFAAkF;IAClF,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAI5B,qHAAqH;IACrH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,gHAAgH;IAChH,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IAChC,kFAAkF;IAClF,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,gHAAgH;IAChH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kHAAkH;IAClH,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,uGAAuG;IACvG,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,qHAAqH;IACrH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qHAAqH;IACrH,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,uFAAuF;IACvF,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/buffer-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC
|
|
1
|
+
{"version":3,"file":"buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/buffer-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,+CAA4C;AAEtE;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;;;;;;;IAuBI;AACJ,MAAM,MAAM,YAAY,GAAG;IACzB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC,gGAAgG;IAChG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,MAAM,EAAE,YAAY,CAAC;IACrB,+FAA+F;IAC/F,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-message.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/compiler-message.ts"],"names":[],"mappings":"AAIA,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { DepthStencilTextureFormat } from "
|
|
1
|
+
import { DepthStencilTextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
2
2
|
export type CompareFunction = 'never' | 'less' | 'equal' | 'less-equal' | 'greater' | 'not-equal' | 'greater-equal' | 'always';
|
|
3
|
-
export type PrimitiveTopology = 'point-list' | 'line-list' | 'line-strip'
|
|
4
|
-
/** @deprecated */
|
|
5
|
-
| 'line-loop-webgl' | 'triangle-list' | 'triangle-strip'
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
| 'triangle-fan-webgl';
|
|
3
|
+
export type PrimitiveTopology = 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
|
|
8
4
|
export type IndexFormat = 'uint16' | 'uint32';
|
|
9
5
|
export type CullMode = 'none' | 'front' | 'back';
|
|
10
6
|
export type FrontFace = 'ccw' | 'cw';
|
|
@@ -79,6 +75,8 @@ export type BlendFactor = 'zero' | 'one' | 'src-color' | 'one-minus-src-color' |
|
|
|
79
75
|
/** BlendOperation defines the algorithm used to combine source and destination blend factors: */
|
|
80
76
|
export type BlendOperation = 'add' | 'subtract' | 'reverse-subtract' | 'min' | 'max';
|
|
81
77
|
export type ColorParameters = {
|
|
78
|
+
/** Enable blending */
|
|
79
|
+
blend?: boolean;
|
|
82
80
|
/** Defines the operation used to calculate the values written to the target attachment components. */
|
|
83
81
|
blendColorOperation?: BlendOperation;
|
|
84
82
|
/** Defines the operation to be performed on values from the fragment shader. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,yBAAyB,EAAC,
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,yBAAyB,EAAC,gDAA6C;AAE/E,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,MAAM,GACN,OAAO,GACP,YAAY,GACZ,SAAS,GACT,WAAW,GACX,eAAe,GACf,QAAQ,CAAC;AAIb,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,eAAe,GACf,gBAAgB,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,O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essorObject } from "../types/accessor.js";
|
|
1
|
+
import type { TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
2
|
+
import type { ShaderUniformType, ShaderAttributeType } from "../../gpu-type-utils/shader-types.js";
|
|
4
3
|
import type { Buffer } from "../resources/buffer.js";
|
|
5
4
|
import type { Sampler } from "../resources/sampler.js";
|
|
6
5
|
import type { Texture } from "../resources/texture.js";
|
|
@@ -146,5 +145,26 @@ export type AttributeBinding = {
|
|
|
146
145
|
location: number;
|
|
147
146
|
accessor: AccessorObject;
|
|
148
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Attribute descriptor object
|
|
150
|
+
* @deprecated Use ShaderLayout
|
|
151
|
+
*/
|
|
152
|
+
export interface AccessorObject {
|
|
153
|
+
buffer?: Buffer;
|
|
154
|
+
offset?: number;
|
|
155
|
+
stride?: number;
|
|
156
|
+
/** @deprecated - Use accessor.stepMode */
|
|
157
|
+
divisor?: number;
|
|
158
|
+
/** @deprecated - Infer from format */
|
|
159
|
+
type?: number;
|
|
160
|
+
/** @deprecated - Infer from format */
|
|
161
|
+
size?: number;
|
|
162
|
+
/** @deprecated - Infer from format */
|
|
163
|
+
normalized?: boolean;
|
|
164
|
+
/** @deprecated - Infer from format */
|
|
165
|
+
integer?: boolean;
|
|
166
|
+
/** @deprecated */
|
|
167
|
+
index?: number;
|
|
168
|
+
}
|
|
149
169
|
export {};
|
|
150
170
|
//# sourceMappingURL=shader-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/shader-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,
|
|
1
|
+
{"version":3,"file":"shader-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/shader-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,gDAA6C;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAE,mBAAm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AC;IACjB,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/uniforms.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAC,uBAAoB;AAIxC,6FAA6F;AAC7F,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompilerMessage } from "
|
|
1
|
+
import type { CompilerMessage } from "../adapter/types/compiler-message.js";
|
|
2
2
|
/** @returns annotated errors or warnings */
|
|
3
3
|
export declare function formatCompilerLog(shaderLog: readonly CompilerMessage[], source: string, options?: {
|
|
4
4
|
/** Include source code in the log. Either just the lines before issues or all source code */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-compiler-log.d.ts","sourceRoot":"","sources":["../../src/adapter-utils/format-compiler-log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,6CAA0C;AAEvE,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,6FAA6F;IAC7F,cAAc,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GACA,MAAM,CA+BR"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ShaderLayout } from "../types/shader-layout.js";
|
|
2
|
-
import type { BufferLayout } from "../types/buffer-layout.js";
|
|
3
|
-
import type { ShaderDataType, ShaderAttributeType } from "../
|
|
4
|
-
import type { VertexFormat, VertexType } from "../
|
|
1
|
+
import type { ShaderLayout } from "../adapter/types/shader-layout.js";
|
|
2
|
+
import type { BufferLayout } from "../adapter/types/buffer-layout.js";
|
|
3
|
+
import type { ShaderDataType, ShaderAttributeType } from "../gpu-type-utils/shader-types.js";
|
|
4
|
+
import type { VertexFormat, VertexType } from "../gpu-type-utils/vertex-formats.js";
|
|
5
5
|
/** Resolved info for a buffer / attribute combination to help backend configure it correctly */
|
|
6
6
|
export type AttributeInfo = {
|
|
7
7
|
/** Attribute name */
|
|
@@ -42,11 +42,4 @@ export declare function getAttributeInfosFromLayouts(shaderLayout: ShaderLayout,
|
|
|
42
42
|
* Array indexed by "location" holding "resolved attribute infos"
|
|
43
43
|
*/
|
|
44
44
|
export declare function getAttributeInfosByLocation(shaderLayout: ShaderLayout, bufferLayout: BufferLayout[], maxVertexAttributes?: number): AttributeInfo[];
|
|
45
|
-
/**
|
|
46
|
-
* Merges an provided shader layout into a base shader layout
|
|
47
|
-
* In WebGL, this allows the auto generated shader layout to be overridden by the application
|
|
48
|
-
* Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).
|
|
49
|
-
* @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?
|
|
50
|
-
*/
|
|
51
|
-
export declare function mergeShaderLayout(baseLayout: ShaderLayout, overrideLayout: ShaderLayout): ShaderLayout;
|
|
52
45
|
//# sourceMappingURL=get-attribute-from-layouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attribute-from-layouts.d.ts","sourceRoot":"","sources":["../../src/adapter-utils/get-attribute-from-layouts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAuB,0CAAuC;AACvF,OAAO,KAAK,EAAC,YAAY,EAAC,0CAAuC;AACjE,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,0CAAuC;AAExF,OAAO,KAAK,EAAC,YAAY,EAAE,UAAU,EAAC,4CAAyC;AAG/E,gGAAgG;AAChG,MAAM,MAAM,aAAa,GAAG;IAC1B,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,UAAU,EAAE,mBAAmB,CAAC;IAChC,+EAA+E;IAC/E,cAAc,EAAE,cAAc,CAAC;IAC/B,yFAAyF;IACzF,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,0GAA0G;IAC1G,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,6DAA6D;IAC7D,cAAc,EAAE,UAAU,CAAC;IAC3B,iFAAiF;IACjF,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAC;IAEpB,mHAAmH;IACnH,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;IAEhC,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAS/B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,EAC5B,mBAAmB,GAAE,MAAW,GAC/B,aAAa,EAAE,CAOjB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { log } from "
|
|
5
|
-
import { decodeShaderAttributeType } from "../type-utils/decode-attribute-type.js";
|
|
6
|
-
import { decodeVertexFormat } from "../type-utils/decode-vertex-format.js";
|
|
4
|
+
import { log } from "../utils/log.js";
|
|
5
|
+
import { decodeShaderAttributeType } from "../gpu-type-utils/decode-attribute-type.js";
|
|
6
|
+
import { decodeVertexFormat } from "../gpu-type-utils/decode-vertex-format.js";
|
|
7
7
|
/**
|
|
8
8
|
* Map from "attribute names" to "resolved attribute infos"
|
|
9
9
|
* containing information about both buffer layouts and shader attribute declarations
|
|
@@ -11,7 +11,10 @@ import { decodeVertexFormat } from "../type-utils/decode-vertex-format.js";
|
|
|
11
11
|
export function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {
|
|
12
12
|
const attributeInfos = {};
|
|
13
13
|
for (const attribute of shaderLayout.attributes) {
|
|
14
|
-
|
|
14
|
+
const attributeInfo = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);
|
|
15
|
+
if (attributeInfo) {
|
|
16
|
+
attributeInfos[attribute.name] = attributeInfo;
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
return attributeInfos;
|
|
17
20
|
}
|
|
@@ -54,7 +57,7 @@ function getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name) {
|
|
|
54
57
|
normalized: vertexFormatInfo.normalized,
|
|
55
58
|
// integer is a property of the shader declaration
|
|
56
59
|
integer: attributeTypeInfo.integer,
|
|
57
|
-
stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,
|
|
60
|
+
stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode || 'vertex',
|
|
58
61
|
byteOffset: bufferMapping?.byteOffset || 0,
|
|
59
62
|
byteStride: bufferMapping?.byteStride || 0
|
|
60
63
|
};
|
|
@@ -118,6 +121,7 @@ function getAttributeFromAttributesList(bufferLayouts, name) {
|
|
|
118
121
|
if (typeof bufferLayout.byteStride !== 'number') {
|
|
119
122
|
for (const attributeMapping of bufferLayout.attributes || []) {
|
|
120
123
|
const info = decodeVertexFormat(attributeMapping.format);
|
|
124
|
+
// @ts-ignore
|
|
121
125
|
byteStride += info.byteLength;
|
|
122
126
|
}
|
|
123
127
|
}
|
|
@@ -129,34 +133,10 @@ function getAttributeFromAttributesList(bufferLayouts, name) {
|
|
|
129
133
|
stepMode: bufferLayout.stepMode,
|
|
130
134
|
vertexFormat: attributeMapping.format,
|
|
131
135
|
byteOffset: attributeMapping.byteOffset,
|
|
136
|
+
// @ts-ignore
|
|
132
137
|
byteStride
|
|
133
138
|
};
|
|
134
139
|
}
|
|
135
140
|
}
|
|
136
141
|
return null;
|
|
137
142
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Merges an provided shader layout into a base shader layout
|
|
140
|
-
* In WebGL, this allows the auto generated shader layout to be overridden by the application
|
|
141
|
-
* Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).
|
|
142
|
-
* @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?
|
|
143
|
-
*/
|
|
144
|
-
export function mergeShaderLayout(baseLayout, overrideLayout) {
|
|
145
|
-
// Deep clone the base layout
|
|
146
|
-
const mergedLayout = {
|
|
147
|
-
...baseLayout,
|
|
148
|
-
attributes: baseLayout.attributes.map(attribute => ({ ...attribute }))
|
|
149
|
-
};
|
|
150
|
-
// Merge the attributes
|
|
151
|
-
for (const attribute of overrideLayout?.attributes || []) {
|
|
152
|
-
const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);
|
|
153
|
-
if (!baseAttribute) {
|
|
154
|
-
log.warn(`shader layout attribute ${attribute.name} not present in shader`);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
baseAttribute.type = attribute.type || baseAttribute.type;
|
|
158
|
-
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return mergedLayout;
|
|
162
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-uniform-value.d.ts","sourceRoot":"","sources":["../../src/adapter-utils/is-uniform-value.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,qCAAkC;AAEvD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { isNumberArray } from "../utils/is-array.js";
|
|
5
|
+
export function isUniformValue(value) {
|
|
6
|
+
return isNumberArray(value) || typeof value === 'number' || typeof value === 'boolean';
|
|
7
|
+
}
|