@luma.gl/core 9.3.0-alpha.4 → 9.3.0-alpha.6
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/canvas-context.d.ts +6 -182
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/canvas-context.js +5 -481
- package/dist/adapter/canvas-context.js.map +1 -1
- package/dist/adapter/canvas-observer.d.ts +32 -0
- package/dist/adapter/canvas-observer.d.ts.map +1 -0
- package/dist/adapter/canvas-observer.js +90 -0
- package/dist/adapter/canvas-observer.js.map +1 -0
- package/dist/adapter/canvas-surface.d.ts +150 -0
- package/dist/adapter/canvas-surface.d.ts.map +1 -0
- package/dist/adapter/canvas-surface.js +392 -0
- package/dist/adapter/canvas-surface.js.map +1 -0
- package/dist/adapter/device.d.ts +64 -9
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +108 -4
- package/dist/adapter/device.js.map +1 -1
- package/dist/adapter/luma.js +1 -1
- package/dist/adapter/presentation-context.d.ts +11 -0
- package/dist/adapter/presentation-context.d.ts.map +1 -0
- package/dist/adapter/presentation-context.js +12 -0
- package/dist/adapter/presentation-context.js.map +1 -0
- package/dist/adapter/resources/buffer.d.ts +1 -1
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js +14 -6
- package/dist/adapter/resources/buffer.js.map +1 -1
- package/dist/adapter/resources/command-encoder.d.ts +22 -1
- package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/command-encoder.js +65 -1
- package/dist/adapter/resources/command-encoder.js.map +1 -1
- package/dist/adapter/resources/fence.d.ts +1 -1
- package/dist/adapter/resources/fence.d.ts.map +1 -1
- package/dist/adapter/resources/fence.js +3 -1
- package/dist/adapter/resources/fence.js.map +1 -1
- package/dist/adapter/resources/query-set.d.ts +17 -1
- package/dist/adapter/resources/query-set.d.ts.map +1 -1
- package/dist/adapter/resources/query-set.js.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +19 -7
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +20 -2
- package/dist/adapter/resources/render-pipeline.js.map +1 -1
- package/dist/adapter/resources/resource.d.ts +8 -0
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +240 -14
- package/dist/adapter/resources/resource.js.map +1 -1
- package/dist/adapter/resources/shared-render-pipeline.d.ts +22 -0
- package/dist/adapter/resources/shared-render-pipeline.d.ts.map +1 -0
- package/dist/adapter/resources/shared-render-pipeline.js +25 -0
- package/dist/adapter/resources/shared-render-pipeline.js.map +1 -0
- package/dist/adapter/resources/texture.d.ts +78 -12
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +182 -30
- package/dist/adapter/resources/texture.js.map +1 -1
- package/dist/dist.dev.js +952 -193
- package/dist/dist.min.js +6 -6
- package/dist/index.cjs +918 -190
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/shadertypes/data-types/decode-shader-types.d.ts +2 -2
- package/dist/shadertypes/data-types/decode-shader-types.d.ts.map +1 -1
- package/dist/shadertypes/data-types/decode-shader-types.js +11 -2
- package/dist/shadertypes/data-types/decode-shader-types.js.map +1 -1
- package/dist/shadertypes/textures/texture-format-decoder.d.ts.map +1 -1
- package/dist/shadertypes/textures/texture-format-decoder.js +51 -6
- package/dist/shadertypes/textures/texture-format-decoder.js.map +1 -1
- package/dist/shadertypes/textures/texture-format-table.d.ts.map +1 -1
- package/dist/shadertypes/textures/texture-format-table.js +10 -9
- package/dist/shadertypes/textures/texture-format-table.js.map +1 -1
- package/dist/shadertypes/textures/texture-formats.d.ts +5 -2
- package/dist/shadertypes/textures/texture-formats.d.ts.map +1 -1
- package/dist/shadertypes/textures/texture-formats.js.map +1 -1
- package/dist/shadertypes/textures/texture-layout.d.ts +1 -1
- package/dist/utils/array-equal.d.ts +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +15 -9
- package/dist/utils/array-equal.js.map +1 -1
- package/dist/utils/stats-manager.d.ts.map +1 -1
- package/dist/utils/stats-manager.js +61 -1
- package/dist/utils/stats-manager.js.map +1 -1
- package/package.json +3 -3
- package/src/adapter/canvas-context.ts +7 -623
- package/src/adapter/canvas-observer.ts +130 -0
- package/src/adapter/canvas-surface.ts +521 -0
- package/src/adapter/device.ts +174 -13
- package/src/adapter/presentation-context.ts +16 -0
- package/src/adapter/resources/buffer.ts +13 -5
- package/src/adapter/resources/command-encoder.ts +91 -2
- package/src/adapter/resources/fence.ts +3 -1
- package/src/adapter/resources/query-set.ts +17 -1
- package/src/adapter/resources/render-pipeline.ts +42 -13
- package/src/adapter/resources/resource.ts +284 -14
- package/src/adapter/resources/shared-render-pipeline.ts +40 -0
- package/src/adapter/resources/texture.ts +267 -38
- package/src/index.ts +7 -0
- package/src/shadertypes/data-types/decode-shader-types.ts +13 -4
- package/src/shadertypes/textures/texture-format-decoder.ts +71 -6
- package/src/shadertypes/textures/texture-format-table.ts +10 -9
- package/src/shadertypes/textures/texture-formats.ts +6 -1
- package/src/utils/array-equal.ts +21 -9
- package/src/utils/stats-manager.ts +76 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/adapter/resources/resource.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,GAAG,EAAC,2BAAwB;AAWpC;;GAEG;AACH,MAAM,OAAgB,QAAQ;IAC5B,sCAAsC;IACtC,MAAM,CAAC,YAAY,GAA4B;QAC7C,EAAE,EAAE,WAAW;QACf,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAU;KACrB,CAAC;IAIF,QAAQ;QACN,OAAO,GAAG,IAAI,C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CAAC,cAAc,EAAE,CAAC;IAChD,CAAC;;AAGH;;;;;GAKG;AACH,SAAS,gBAAgB,CAAQ,KAAY,EAAE,YAA6B;IAC1E,MAAM,WAAW,GAAG,EAAC,GAAG,YAAY,EAAC,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC7B,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/adapter/resources/resource.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,GAAG,EAAC,2BAAwB;AAEpC,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAC3D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AACpD,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AACvD,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AACxD,MAAM,yBAAyB,GAAG;IAChC,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,cAAc;IACd,cAAc;IACd,WAAW;IACX,SAAS;IACT,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,gBAAgB;CACR,CAAC;AACX,MAAM,0BAA0B,GAAG;IACjC,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,cAAc;IACd,cAAc;IACd,WAAW;IACX,SAAS;IACT,iBAAiB;IACjB,uBAAuB;IACvB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,gBAAgB;CACR,CAAC;AACX,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,OA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
+
import { Resource, type ResourceProps } from "./resource.js";
|
|
4
|
+
export type SharedRenderPipelineProps = ResourceProps & {
|
|
5
|
+
handle?: unknown;
|
|
6
|
+
vs: Shader;
|
|
7
|
+
fs: Shader;
|
|
8
|
+
varyings?: string[];
|
|
9
|
+
bufferMode?: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Internal base class for backend-specific shared render-pipeline implementations.
|
|
13
|
+
* Backends may use this to share expensive linked/program state across multiple
|
|
14
|
+
* `RenderPipeline` wrappers.
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class SharedRenderPipeline extends Resource<SharedRenderPipelineProps> {
|
|
17
|
+
get [Symbol.toStringTag](): string;
|
|
18
|
+
abstract readonly device: Device;
|
|
19
|
+
abstract readonly handle: unknown;
|
|
20
|
+
constructor(device: Device, props: SharedRenderPipelineProps);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=shared-render-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/shared-render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,EAAC,QAAQ,EAAE,KAAK,aAAa,EAAC,sBAAmB;AAExD,MAAM,MAAM,yBAAyB,GAAG,aAAa,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,8BAAsB,oBAAqB,SAAQ,QAAQ,CAAC,yBAAyB,CAAC;IACpF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,kBAA2B,MAAM,EAAE,MAAM,CAAC;IAC1C,kBAA2B,MAAM,EAAE,OAAO,CAAC;gBAE/B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAU7D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { Resource } from "./resource.js";
|
|
5
|
+
/**
|
|
6
|
+
* Internal base class for backend-specific shared render-pipeline implementations.
|
|
7
|
+
* Backends may use this to share expensive linked/program state across multiple
|
|
8
|
+
* `RenderPipeline` wrappers.
|
|
9
|
+
*/
|
|
10
|
+
export class SharedRenderPipeline extends Resource {
|
|
11
|
+
get [Symbol.toStringTag]() {
|
|
12
|
+
return 'SharedRenderPipeline';
|
|
13
|
+
}
|
|
14
|
+
constructor(device, props) {
|
|
15
|
+
super(device, props, {
|
|
16
|
+
...Resource.defaultProps,
|
|
17
|
+
handle: undefined,
|
|
18
|
+
vs: undefined,
|
|
19
|
+
fs: undefined,
|
|
20
|
+
varyings: undefined,
|
|
21
|
+
bufferMode: undefined
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=shared-render-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-render-pipeline.js","sourceRoot":"","sources":["../../../src/adapter/resources/shared-render-pipeline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,QAAQ,EAAqB,sBAAmB;AAUxD;;;;GAIG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,QAAmC;IACpF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC/B,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAKD,YAAY,MAAc,EAAE,KAAgC;QAC1D,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE;YACnB,GAAG,QAAQ,CAAC,YAAY;YACxB,MAAM,EAAE,SAAU;YAClB,EAAE,EAAE,SAAU;YACd,EAAE,EAAE,SAAU;YACd,QAAQ,EAAE,SAAU;YACpB,UAAU,EAAE,SAAU;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TypedArray } from '@math.gl/types';
|
|
2
2
|
import { type Device } from "../device.js";
|
|
3
|
-
import { type TextureFormat, type TextureMemoryLayout } from "../../shadertypes/textures/texture-formats.js";
|
|
3
|
+
import { type TextureFormat, type TextureMemoryLayout, type TextureFormatInfo } from "../../shadertypes/textures/texture-formats.js";
|
|
4
4
|
import { type ExternalImage } from "../../image-utils/image-types.js";
|
|
5
5
|
import { type TextureView, type TextureViewProps } from "./texture-view.js";
|
|
6
6
|
import { Resource, type ResourceProps } from "./resource.js";
|
|
@@ -43,10 +43,18 @@ export type CopyImageDataOptions = {
|
|
|
43
43
|
data: ArrayBuffer | SharedArrayBuffer | ArrayBufferView;
|
|
44
44
|
/** Offset into the data (in addition to any offset built-in to the ArrayBufferView) */
|
|
45
45
|
byteOffset?: number;
|
|
46
|
-
/** The stride, in bytes, between
|
|
46
|
+
/** The stride, in bytes, between successive texel rows in the CPU source data. Tightly packed uploads can omit this. */
|
|
47
47
|
bytesPerRow?: number;
|
|
48
|
-
/** Number
|
|
48
|
+
/** Number of rows that make up one image when uploading multiple layers or depth slices from CPU memory. */
|
|
49
49
|
rowsPerImage?: number;
|
|
50
|
+
/** Width to copy */
|
|
51
|
+
width?: number;
|
|
52
|
+
/** Height to copy */
|
|
53
|
+
height?: number;
|
|
54
|
+
/** Copy depth or number of layers */
|
|
55
|
+
depthOrArrayLayers?: number;
|
|
56
|
+
/** @deprecated Use `depthOrArrayLayers` */
|
|
57
|
+
depth?: number;
|
|
50
58
|
/** Start copying into offset x (default 0) */
|
|
51
59
|
x?: number;
|
|
52
60
|
/** Start copying into offset y (default 0) */
|
|
@@ -59,23 +67,45 @@ export type CopyImageDataOptions = {
|
|
|
59
67
|
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
60
68
|
};
|
|
61
69
|
export type TextureReadOptions = {
|
|
70
|
+
/** Start reading from offset x (default 0) */
|
|
62
71
|
x?: number;
|
|
72
|
+
/** Start reading from offset y (default 0) */
|
|
63
73
|
y?: number;
|
|
74
|
+
/** Start reading from layer / depth slice z (default 0) */
|
|
64
75
|
z?: number;
|
|
76
|
+
/** Width of the region to read. Defaults to the mip width. */
|
|
65
77
|
width?: number;
|
|
78
|
+
/** Height of the region to read. Defaults to the mip height. */
|
|
66
79
|
height?: number;
|
|
80
|
+
/** Number of array layers or depth slices to read. Defaults to 1. */
|
|
67
81
|
depthOrArrayLayers?: number;
|
|
82
|
+
/** Which mip-level to read from (default 0) */
|
|
68
83
|
mipLevel?: number;
|
|
84
|
+
/** When reading from depth stencil textures (default 'all') */
|
|
69
85
|
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
70
86
|
};
|
|
71
87
|
export type TextureWriteOptions = {
|
|
88
|
+
/** Offset into the source data or buffer, in bytes. */
|
|
89
|
+
byteOffset?: number;
|
|
90
|
+
/** The stride, in bytes, between successive texel rows in the source data or buffer. */
|
|
91
|
+
bytesPerRow?: number;
|
|
92
|
+
/** The number of rows that make up one image when writing multiple layers or slices. */
|
|
93
|
+
rowsPerImage?: number;
|
|
94
|
+
/** Start writing into offset x (default 0) */
|
|
72
95
|
x?: number;
|
|
96
|
+
/** Start writing into offset y (default 0) */
|
|
73
97
|
y?: number;
|
|
98
|
+
/** Start writing into layer / depth slice z (default 0) */
|
|
74
99
|
z?: number;
|
|
100
|
+
/** Width of the region to write. Defaults to the mip width. */
|
|
75
101
|
width?: number;
|
|
102
|
+
/** Height of the region to write. Defaults to the mip height. */
|
|
76
103
|
height?: number;
|
|
104
|
+
/** Number of array layers or depth slices to write. Defaults to 1, or the full mip depth for 3D textures. */
|
|
77
105
|
depthOrArrayLayers?: number;
|
|
106
|
+
/** Which mip-level to write into (default 0) */
|
|
78
107
|
mipLevel?: number;
|
|
108
|
+
/** When writing into depth stencil textures (default 'all') */
|
|
79
109
|
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
80
110
|
};
|
|
81
111
|
/** Texture properties */
|
|
@@ -137,6 +167,8 @@ export declare abstract class Texture extends Resource<TextureProps> {
|
|
|
137
167
|
readonly depth: number;
|
|
138
168
|
/** mip levels in this texture */
|
|
139
169
|
readonly mipLevels: number;
|
|
170
|
+
/** sample count */
|
|
171
|
+
readonly samples: number;
|
|
140
172
|
/** Rows are multiples of this length, padded with extra bytes if needed */
|
|
141
173
|
readonly byteAlignment: number;
|
|
142
174
|
/** Default sampler for this texture */
|
|
@@ -173,11 +205,19 @@ export declare abstract class Texture extends Resource<TextureProps> {
|
|
|
173
205
|
width: number;
|
|
174
206
|
height: number;
|
|
175
207
|
};
|
|
176
|
-
/**
|
|
177
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Copy raw image data (bytes) into the texture.
|
|
210
|
+
*
|
|
211
|
+
* @note Deprecated compatibility wrapper over {@link writeData}.
|
|
212
|
+
* @note Uses the same layout defaults and alignment rules as {@link writeData}.
|
|
213
|
+
* @note Tightly packed CPU uploads can omit `bytesPerRow` and `rowsPerImage`.
|
|
214
|
+
* @note If the CPU source rows are padded, pass explicit `bytesPerRow` and `rowsPerImage`.
|
|
215
|
+
* @deprecated Use writeData()
|
|
216
|
+
*/
|
|
217
|
+
copyImageData(options: CopyImageDataOptions): void;
|
|
178
218
|
/**
|
|
179
219
|
* Calculates the memory layout of the texture, required when reading and writing data.
|
|
180
|
-
* @return the
|
|
220
|
+
* @return the backend-aligned linear layout, in particular bytesPerRow which includes any required padding for buffer copy/read paths
|
|
181
221
|
*/
|
|
182
222
|
computeMemoryLayout(options_?: TextureReadOptions): TextureMemoryLayout;
|
|
183
223
|
/**
|
|
@@ -185,9 +225,11 @@ export declare abstract class Texture extends Resource<TextureProps> {
|
|
|
185
225
|
* @returns A Buffer containing the texture data.
|
|
186
226
|
*
|
|
187
227
|
* @note The memory layout of the texture data is determined by the texture format and dimensions.
|
|
188
|
-
* @note The application can call Texture.computeMemoryLayout() to compute the layout.
|
|
228
|
+
* @note The application can call Texture.computeMemoryLayout() to compute the backend-aligned layout.
|
|
189
229
|
* @note The application can call Buffer.readAsync()
|
|
190
230
|
* @note If not supplied a buffer will be created and the application needs to call Buffer.destroy
|
|
231
|
+
* @note On WebGPU this corresponds to a texture-to-buffer copy and uses buffer-copy alignment rules.
|
|
232
|
+
* @note On WebGL, luma.gl emulates the same logical readback behavior.
|
|
191
233
|
*/
|
|
192
234
|
readBuffer(options?: TextureReadOptions, buffer?: Buffer): Buffer;
|
|
193
235
|
/**
|
|
@@ -199,19 +241,26 @@ export declare abstract class Texture extends Resource<TextureProps> {
|
|
|
199
241
|
*/
|
|
200
242
|
readDataAsync(options?: TextureReadOptions): Promise<ArrayBuffer>;
|
|
201
243
|
/**
|
|
202
|
-
* Writes
|
|
244
|
+
* Writes a GPU Buffer into a texture.
|
|
203
245
|
*
|
|
246
|
+
* @param buffer - Source GPU buffer.
|
|
247
|
+
* @param options - Destination subresource, extent, and source layout options.
|
|
204
248
|
* @note The memory layout of the texture data is determined by the texture format and dimensions.
|
|
205
|
-
* @note The application can call Texture.computeMemoryLayout() to compute the layout.
|
|
249
|
+
* @note The application can call Texture.computeMemoryLayout() to compute the backend-aligned layout.
|
|
250
|
+
* @note On WebGPU this corresponds to a buffer-to-texture copy and uses buffer-copy alignment rules.
|
|
251
|
+
* @note On WebGL, luma.gl emulates the same destination and layout semantics.
|
|
206
252
|
*/
|
|
207
253
|
writeBuffer(buffer: Buffer, options?: TextureWriteOptions): void;
|
|
208
254
|
/**
|
|
209
255
|
* Writes an array buffer into a texture.
|
|
210
256
|
*
|
|
211
|
-
* @
|
|
212
|
-
* @
|
|
257
|
+
* @param data - Source texel data.
|
|
258
|
+
* @param options - Destination subresource, extent, and source layout options.
|
|
259
|
+
* @note If `bytesPerRow` and `rowsPerImage` are omitted, luma.gl computes a tightly packed CPU-memory layout for the requested region.
|
|
260
|
+
* @note On WebGPU this corresponds to `GPUQueue.writeTexture()` and does not implicitly pad rows to 256 bytes.
|
|
261
|
+
* @note On WebGL, padded CPU data is supported via the same `bytesPerRow` and `rowsPerImage` options.
|
|
213
262
|
*/
|
|
214
|
-
writeData(data: ArrayBuffer | ArrayBufferView, options?: TextureWriteOptions): void;
|
|
263
|
+
writeData(data: ArrayBuffer | SharedArrayBuffer | ArrayBufferView, options?: TextureWriteOptions): void;
|
|
215
264
|
/**
|
|
216
265
|
* WebGL can read data synchronously.
|
|
217
266
|
* @note While it is convenient, the performance penalty is very significant
|
|
@@ -226,11 +275,28 @@ export declare abstract class Texture extends Resource<TextureProps> {
|
|
|
226
275
|
_normalizeCopyImageDataOptions(options_: CopyImageDataOptions): Required<CopyImageDataOptions>;
|
|
227
276
|
_normalizeCopyExternalImageOptions(options_: CopyExternalImageOptions): Required<CopyExternalImageOptions>;
|
|
228
277
|
_normalizeTextureReadOptions(options_: TextureReadOptions): Required<TextureReadOptions>;
|
|
278
|
+
/**
|
|
279
|
+
* Normalizes a texture read request and validates the color-only readback contract used by the
|
|
280
|
+
* current texture read APIs. Supported dimensions are `2d`, `cube`, `cube-array`,
|
|
281
|
+
* `2d-array`, and `3d`.
|
|
282
|
+
*
|
|
283
|
+
* @throws if the texture format, aspect, or dimension is not supported by the first-pass
|
|
284
|
+
* color-read implementation.
|
|
285
|
+
*/
|
|
286
|
+
protected _getSupportedColorReadOptions(options_: TextureReadOptions): Required<TextureReadOptions>;
|
|
287
|
+
/** Validates that a read request targets the full color aspect of the texture. */
|
|
288
|
+
protected _validateColorReadAspect(options: Required<TextureReadOptions>): void;
|
|
289
|
+
/** Validates that a read request targets an uncompressed color-renderable texture format. */
|
|
290
|
+
protected _validateColorReadFormat(formatInfo: TextureFormatInfo): void;
|
|
229
291
|
_normalizeTextureWriteOptions(options_: TextureWriteOptions): Required<TextureWriteOptions>;
|
|
292
|
+
protected _getMipLevelSize(mipLevel: number): Required<Pick<TextureReadOptions, 'width' | 'height' | 'depthOrArrayLayers'>>;
|
|
293
|
+
protected getAllocatedByteLength(): number;
|
|
294
|
+
protected static _omitUndefined<T extends object>(options: T): Partial<T>;
|
|
230
295
|
static defaultProps: Required<TextureProps>;
|
|
231
296
|
protected static defaultCopyDataOptions: Required<CopyImageDataOptions>;
|
|
232
297
|
/** Default options */
|
|
233
298
|
protected static defaultCopyExternalImageOptions: Required<CopyExternalImageOptions>;
|
|
234
299
|
protected static defaultTextureReadOptions: Required<TextureReadOptions>;
|
|
300
|
+
protected static defaultTextureWriteOptions: Required<TextureWriteOptions>;
|
|
235
301
|
}
|
|
236
302
|
//# sourceMappingURL=texture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAC,KAAK,MAAM,EAAC,qBAAkB;AACtC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAC,KAAK,MAAM,EAAC,qBAAkB;AACtC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,sDAAmD;AACpD,OAAO,EAAC,KAAK,aAAa,EAAC,yCAAsC;AACjE,OAAO,EAAC,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAC,0BAAuB;AACvE,OAAO,EAAC,QAAQ,EAAE,KAAK,aAAa,EAAC,sBAAmB;AACxD,OAAO,EAAC,OAAO,EAAE,KAAK,YAAY,EAAC,qBAAkB;AACrD,OAAO,EAA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,CAelF;IAEF,SAAS,CAAC,MAAM,CAAC,yBAAyB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAStE;IAEF,SAAS,CAAC,MAAM,CAAC,0BAA0B,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAYxE;CACH"}
|
|
@@ -47,6 +47,8 @@ export class Texture extends Resource {
|
|
|
47
47
|
depth;
|
|
48
48
|
/** mip levels in this texture */
|
|
49
49
|
mipLevels;
|
|
50
|
+
/** sample count */
|
|
51
|
+
samples;
|
|
50
52
|
/** Rows are multiples of this length, padded with extra bytes if needed */
|
|
51
53
|
byteAlignment;
|
|
52
54
|
/** The ready promise is always resolved. It is provided for type compatibility with DynamicTexture. */
|
|
@@ -73,6 +75,7 @@ export class Texture extends Resource {
|
|
|
73
75
|
this.height = this.props.height;
|
|
74
76
|
this.depth = this.props.depth;
|
|
75
77
|
this.mipLevels = this.props.mipLevels;
|
|
78
|
+
this.samples = this.props.samples || 1;
|
|
76
79
|
if (this.dimension === 'cube') {
|
|
77
80
|
this.depth = 6;
|
|
78
81
|
}
|
|
@@ -107,9 +110,25 @@ export class Texture extends Resource {
|
|
|
107
110
|
setSampler(sampler) {
|
|
108
111
|
this.sampler = sampler instanceof Sampler ? sampler : this.device.createSampler(sampler);
|
|
109
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Copy raw image data (bytes) into the texture.
|
|
115
|
+
*
|
|
116
|
+
* @note Deprecated compatibility wrapper over {@link writeData}.
|
|
117
|
+
* @note Uses the same layout defaults and alignment rules as {@link writeData}.
|
|
118
|
+
* @note Tightly packed CPU uploads can omit `bytesPerRow` and `rowsPerImage`.
|
|
119
|
+
* @note If the CPU source rows are padded, pass explicit `bytesPerRow` and `rowsPerImage`.
|
|
120
|
+
* @deprecated Use writeData()
|
|
121
|
+
*/
|
|
122
|
+
copyImageData(options) {
|
|
123
|
+
const { data, depth, ...writeOptions } = options;
|
|
124
|
+
this.writeData(data, {
|
|
125
|
+
...writeOptions,
|
|
126
|
+
depthOrArrayLayers: writeOptions.depthOrArrayLayers ?? depth
|
|
127
|
+
});
|
|
128
|
+
}
|
|
110
129
|
/**
|
|
111
130
|
* Calculates the memory layout of the texture, required when reading and writing data.
|
|
112
|
-
* @return the
|
|
131
|
+
* @return the backend-aligned linear layout, in particular bytesPerRow which includes any required padding for buffer copy/read paths
|
|
113
132
|
*/
|
|
114
133
|
computeMemoryLayout(options_ = {}) {
|
|
115
134
|
const options = this._normalizeTextureReadOptions(options_);
|
|
@@ -130,9 +149,11 @@ export class Texture extends Resource {
|
|
|
130
149
|
* @returns A Buffer containing the texture data.
|
|
131
150
|
*
|
|
132
151
|
* @note The memory layout of the texture data is determined by the texture format and dimensions.
|
|
133
|
-
* @note The application can call Texture.computeMemoryLayout() to compute the layout.
|
|
152
|
+
* @note The application can call Texture.computeMemoryLayout() to compute the backend-aligned layout.
|
|
134
153
|
* @note The application can call Buffer.readAsync()
|
|
135
154
|
* @note If not supplied a buffer will be created and the application needs to call Buffer.destroy
|
|
155
|
+
* @note On WebGPU this corresponds to a texture-to-buffer copy and uses buffer-copy alignment rules.
|
|
156
|
+
* @note On WebGL, luma.gl emulates the same logical readback behavior.
|
|
136
157
|
*/
|
|
137
158
|
readBuffer(options, buffer) {
|
|
138
159
|
throw new Error('readBuffer not implemented');
|
|
@@ -148,10 +169,14 @@ export class Texture extends Resource {
|
|
|
148
169
|
throw new Error('readBuffer not implemented');
|
|
149
170
|
}
|
|
150
171
|
/**
|
|
151
|
-
* Writes
|
|
172
|
+
* Writes a GPU Buffer into a texture.
|
|
152
173
|
*
|
|
174
|
+
* @param buffer - Source GPU buffer.
|
|
175
|
+
* @param options - Destination subresource, extent, and source layout options.
|
|
153
176
|
* @note The memory layout of the texture data is determined by the texture format and dimensions.
|
|
154
|
-
* @note The application can call Texture.computeMemoryLayout() to compute the layout.
|
|
177
|
+
* @note The application can call Texture.computeMemoryLayout() to compute the backend-aligned layout.
|
|
178
|
+
* @note On WebGPU this corresponds to a buffer-to-texture copy and uses buffer-copy alignment rules.
|
|
179
|
+
* @note On WebGL, luma.gl emulates the same destination and layout semantics.
|
|
155
180
|
*/
|
|
156
181
|
writeBuffer(buffer, options) {
|
|
157
182
|
throw new Error('readBuffer not implemented');
|
|
@@ -159,8 +184,11 @@ export class Texture extends Resource {
|
|
|
159
184
|
/**
|
|
160
185
|
* Writes an array buffer into a texture.
|
|
161
186
|
*
|
|
162
|
-
* @
|
|
163
|
-
* @
|
|
187
|
+
* @param data - Source texel data.
|
|
188
|
+
* @param options - Destination subresource, extent, and source layout options.
|
|
189
|
+
* @note If `bytesPerRow` and `rowsPerImage` are omitted, luma.gl computes a tightly packed CPU-memory layout for the requested region.
|
|
190
|
+
* @note On WebGPU this corresponds to `GPUQueue.writeTexture()` and does not implicitly pad rows to 256 bytes.
|
|
191
|
+
* @note On WebGL, padded CPU data is supported via the same `bytesPerRow` and `rowsPerImage` options.
|
|
164
192
|
*/
|
|
165
193
|
writeData(data, options) {
|
|
166
194
|
throw new Error('readBuffer not implemented');
|
|
@@ -226,43 +254,150 @@ export class Texture extends Resource {
|
|
|
226
254
|
}
|
|
227
255
|
}
|
|
228
256
|
_normalizeCopyImageDataOptions(options_) {
|
|
229
|
-
const {
|
|
230
|
-
const options = {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
options.bytesPerRow = options_.bytesPerRow || width * (info.bytesPerPixel || 4);
|
|
236
|
-
options.rowsPerImage = options_.rowsPerImage || height;
|
|
237
|
-
// WebGL will error if we try to copy outside the bounds of the texture
|
|
238
|
-
// options.width = Math.min(options.width, this.width - options.x);
|
|
239
|
-
// options.height = Math.min(options.height, this.height - options.y);
|
|
240
|
-
return options;
|
|
257
|
+
const { data, depth, ...writeOptions } = options_;
|
|
258
|
+
const options = this._normalizeTextureWriteOptions({
|
|
259
|
+
...writeOptions,
|
|
260
|
+
depthOrArrayLayers: writeOptions.depthOrArrayLayers ?? depth
|
|
261
|
+
});
|
|
262
|
+
return { data, depth: options.depthOrArrayLayers, ...options };
|
|
241
263
|
}
|
|
242
264
|
_normalizeCopyExternalImageOptions(options_) {
|
|
265
|
+
const optionsWithoutUndefined = Texture._omitUndefined(options_);
|
|
266
|
+
const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
|
|
267
|
+
const mipLevelSize = this._getMipLevelSize(mipLevel);
|
|
243
268
|
const size = this.device.getExternalImageSize(options_.image);
|
|
244
|
-
const options = {
|
|
269
|
+
const options = {
|
|
270
|
+
...Texture.defaultCopyExternalImageOptions,
|
|
271
|
+
...mipLevelSize,
|
|
272
|
+
...size,
|
|
273
|
+
...optionsWithoutUndefined
|
|
274
|
+
};
|
|
245
275
|
// WebGL will error if we try to copy outside the bounds of the texture
|
|
246
|
-
options.width = Math.min(options.width,
|
|
247
|
-
options.height = Math.min(options.height,
|
|
276
|
+
options.width = Math.min(options.width, mipLevelSize.width - options.x);
|
|
277
|
+
options.height = Math.min(options.height, mipLevelSize.height - options.y);
|
|
278
|
+
options.depth = Math.min(options.depth, mipLevelSize.depthOrArrayLayers - options.z);
|
|
248
279
|
return options;
|
|
249
280
|
}
|
|
250
281
|
_normalizeTextureReadOptions(options_) {
|
|
251
|
-
const
|
|
252
|
-
const
|
|
282
|
+
const optionsWithoutUndefined = Texture._omitUndefined(options_);
|
|
283
|
+
const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
|
|
284
|
+
const mipLevelSize = this._getMipLevelSize(mipLevel);
|
|
285
|
+
const options = {
|
|
286
|
+
...Texture.defaultTextureReadOptions,
|
|
287
|
+
...mipLevelSize,
|
|
288
|
+
...optionsWithoutUndefined
|
|
289
|
+
};
|
|
253
290
|
// WebGL will error if we try to copy outside the bounds of the texture
|
|
254
|
-
options.width = Math.min(options.width,
|
|
255
|
-
options.height = Math.min(options.height,
|
|
291
|
+
options.width = Math.min(options.width, mipLevelSize.width - options.x);
|
|
292
|
+
options.height = Math.min(options.height, mipLevelSize.height - options.y);
|
|
293
|
+
options.depthOrArrayLayers = Math.min(options.depthOrArrayLayers, mipLevelSize.depthOrArrayLayers - options.z);
|
|
256
294
|
return options;
|
|
257
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Normalizes a texture read request and validates the color-only readback contract used by the
|
|
298
|
+
* current texture read APIs. Supported dimensions are `2d`, `cube`, `cube-array`,
|
|
299
|
+
* `2d-array`, and `3d`.
|
|
300
|
+
*
|
|
301
|
+
* @throws if the texture format, aspect, or dimension is not supported by the first-pass
|
|
302
|
+
* color-read implementation.
|
|
303
|
+
*/
|
|
304
|
+
_getSupportedColorReadOptions(options_) {
|
|
305
|
+
const options = this._normalizeTextureReadOptions(options_);
|
|
306
|
+
const formatInfo = textureFormatDecoder.getInfo(this.format);
|
|
307
|
+
this._validateColorReadAspect(options);
|
|
308
|
+
this._validateColorReadFormat(formatInfo);
|
|
309
|
+
switch (this.dimension) {
|
|
310
|
+
case '2d':
|
|
311
|
+
case 'cube':
|
|
312
|
+
case 'cube-array':
|
|
313
|
+
case '2d-array':
|
|
314
|
+
case '3d':
|
|
315
|
+
return options;
|
|
316
|
+
default:
|
|
317
|
+
throw new Error(`${this} color readback does not support ${this.dimension} textures`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** Validates that a read request targets the full color aspect of the texture. */
|
|
321
|
+
_validateColorReadAspect(options) {
|
|
322
|
+
if (options.aspect !== 'all') {
|
|
323
|
+
throw new Error(`${this} color readback only supports aspect 'all'`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/** Validates that a read request targets an uncompressed color-renderable texture format. */
|
|
327
|
+
_validateColorReadFormat(formatInfo) {
|
|
328
|
+
if (formatInfo.compressed) {
|
|
329
|
+
throw new Error(`${this} color readback does not support compressed formats (${this.format})`);
|
|
330
|
+
}
|
|
331
|
+
switch (formatInfo.attachment) {
|
|
332
|
+
case 'color':
|
|
333
|
+
return;
|
|
334
|
+
case 'depth':
|
|
335
|
+
throw new Error(`${this} color readback does not support depth formats (${this.format})`);
|
|
336
|
+
case 'stencil':
|
|
337
|
+
throw new Error(`${this} color readback does not support stencil formats (${this.format})`);
|
|
338
|
+
case 'depth-stencil':
|
|
339
|
+
throw new Error(`${this} color readback does not support depth-stencil formats (${this.format})`);
|
|
340
|
+
default:
|
|
341
|
+
throw new Error(`${this} color readback does not support format ${this.format}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
258
344
|
_normalizeTextureWriteOptions(options_) {
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
options
|
|
263
|
-
|
|
345
|
+
const optionsWithoutUndefined = Texture._omitUndefined(options_);
|
|
346
|
+
const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
|
|
347
|
+
const mipLevelSize = this._getMipLevelSize(mipLevel);
|
|
348
|
+
const options = {
|
|
349
|
+
...Texture.defaultTextureWriteOptions,
|
|
350
|
+
...mipLevelSize,
|
|
351
|
+
...optionsWithoutUndefined
|
|
352
|
+
};
|
|
353
|
+
options.width = Math.min(options.width, mipLevelSize.width - options.x);
|
|
354
|
+
options.height = Math.min(options.height, mipLevelSize.height - options.y);
|
|
355
|
+
options.depthOrArrayLayers = Math.min(options.depthOrArrayLayers, mipLevelSize.depthOrArrayLayers - options.z);
|
|
356
|
+
const layout = textureFormatDecoder.computeMemoryLayout({
|
|
357
|
+
format: this.format,
|
|
358
|
+
width: options.width,
|
|
359
|
+
height: options.height,
|
|
360
|
+
depth: options.depthOrArrayLayers,
|
|
361
|
+
byteAlignment: this.byteAlignment
|
|
362
|
+
});
|
|
363
|
+
const minimumBytesPerRow = layout.bytesPerPixel * options.width;
|
|
364
|
+
options.bytesPerRow = optionsWithoutUndefined.bytesPerRow ?? layout.bytesPerRow;
|
|
365
|
+
options.rowsPerImage = optionsWithoutUndefined.rowsPerImage ?? options.height;
|
|
366
|
+
if (options.bytesPerRow < minimumBytesPerRow) {
|
|
367
|
+
throw new Error(`bytesPerRow (${options.bytesPerRow}) must be at least ${minimumBytesPerRow} for ${this.format}`);
|
|
368
|
+
}
|
|
369
|
+
if (options.rowsPerImage < options.height) {
|
|
370
|
+
throw new Error(`rowsPerImage (${options.rowsPerImage}) must be at least ${options.height} for ${this.format}`);
|
|
371
|
+
}
|
|
372
|
+
const bytesPerPixel = this.device.getTextureFormatInfo(this.format).bytesPerPixel;
|
|
373
|
+
if (bytesPerPixel && options.bytesPerRow % bytesPerPixel !== 0) {
|
|
374
|
+
throw new Error(`bytesPerRow (${options.bytesPerRow}) must be a multiple of bytesPerPixel (${bytesPerPixel}) for ${this.format}`);
|
|
375
|
+
}
|
|
264
376
|
return options;
|
|
265
377
|
}
|
|
378
|
+
_getMipLevelSize(mipLevel) {
|
|
379
|
+
const width = Math.max(1, this.width >> mipLevel);
|
|
380
|
+
const height = this.baseDimension === '1d' ? 1 : Math.max(1, this.height >> mipLevel);
|
|
381
|
+
const depthOrArrayLayers = this.dimension === '3d' ? Math.max(1, this.depth >> mipLevel) : this.depth;
|
|
382
|
+
return { width, height, depthOrArrayLayers };
|
|
383
|
+
}
|
|
384
|
+
getAllocatedByteLength() {
|
|
385
|
+
let allocatedByteLength = 0;
|
|
386
|
+
for (let mipLevel = 0; mipLevel < this.mipLevels; mipLevel++) {
|
|
387
|
+
const { width, height, depthOrArrayLayers } = this._getMipLevelSize(mipLevel);
|
|
388
|
+
allocatedByteLength += textureFormatDecoder.computeMemoryLayout({
|
|
389
|
+
format: this.format,
|
|
390
|
+
width,
|
|
391
|
+
height,
|
|
392
|
+
depth: depthOrArrayLayers,
|
|
393
|
+
byteAlignment: 1
|
|
394
|
+
}).byteLength;
|
|
395
|
+
}
|
|
396
|
+
return allocatedByteLength * this.samples;
|
|
397
|
+
}
|
|
398
|
+
static _omitUndefined(options) {
|
|
399
|
+
return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
|
|
400
|
+
}
|
|
266
401
|
static defaultProps = {
|
|
267
402
|
...Resource.defaultProps,
|
|
268
403
|
data: null,
|
|
@@ -282,6 +417,10 @@ export class Texture extends Resource {
|
|
|
282
417
|
byteOffset: 0,
|
|
283
418
|
bytesPerRow: undefined,
|
|
284
419
|
rowsPerImage: undefined,
|
|
420
|
+
width: undefined,
|
|
421
|
+
height: undefined,
|
|
422
|
+
depthOrArrayLayers: undefined,
|
|
423
|
+
depth: 1,
|
|
285
424
|
mipLevel: 0,
|
|
286
425
|
x: 0,
|
|
287
426
|
y: 0,
|
|
@@ -315,5 +454,18 @@ export class Texture extends Resource {
|
|
|
315
454
|
mipLevel: 0,
|
|
316
455
|
aspect: 'all'
|
|
317
456
|
};
|
|
457
|
+
static defaultTextureWriteOptions = {
|
|
458
|
+
byteOffset: 0,
|
|
459
|
+
bytesPerRow: undefined,
|
|
460
|
+
rowsPerImage: undefined,
|
|
461
|
+
x: 0,
|
|
462
|
+
y: 0,
|
|
463
|
+
z: 0,
|
|
464
|
+
width: undefined,
|
|
465
|
+
height: undefined,
|
|
466
|
+
depthOrArrayLayers: 1,
|
|
467
|
+
mipLevel: 0,
|
|
468
|
+
aspect: 'all'
|
|
469
|
+
};
|
|
318
470
|
}
|
|
319
471
|
//# sourceMappingURL=texture.js.map
|