@luma.gl/core 9.0.0-alpha.9 → 9.0.0-beta.2
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/LICENSE +3 -1
- package/README.md +4 -4
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts +52 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js +130 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js.map +1 -0
- package/dist/adapter/canvas-context.d.ts +109 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -0
- package/dist/adapter/canvas-context.js +254 -0
- package/dist/adapter/canvas-context.js.map +1 -0
- package/dist/adapter/device.d.ts +219 -0
- package/dist/adapter/device.d.ts.map +1 -0
- package/dist/adapter/device.js +99 -0
- package/dist/adapter/device.js.map +1 -0
- package/dist/adapter/resources/buffer.d.ts +56 -0
- package/dist/adapter/resources/buffer.d.ts.map +1 -0
- package/dist/adapter/resources/buffer.js +62 -0
- package/dist/adapter/resources/buffer.js.map +1 -0
- package/dist/adapter/resources/command-buffer.d.ts +12 -0
- package/dist/adapter/resources/command-buffer.d.ts.map +1 -0
- package/dist/adapter/resources/command-buffer.js +15 -0
- package/dist/adapter/resources/command-buffer.js.map +1 -0
- package/dist/adapter/resources/command-encoder.d.ts +113 -0
- package/dist/adapter/resources/command-encoder.d.ts.map +1 -0
- package/dist/adapter/resources/command-encoder.js +19 -0
- package/dist/adapter/resources/command-encoder.js.map +1 -0
- package/dist/adapter/resources/compute-pass.d.ts +31 -0
- package/dist/adapter/resources/compute-pass.d.ts.map +1 -0
- package/dist/adapter/resources/compute-pass.js +15 -0
- package/dist/adapter/resources/compute-pass.js.map +1 -0
- package/dist/adapter/resources/compute-pipeline.d.ts +24 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -0
- package/dist/adapter/resources/compute-pipeline.js +20 -0
- package/dist/adapter/resources/compute-pipeline.js.map +1 -0
- package/dist/adapter/resources/external-texture.d.ts +12 -0
- package/dist/adapter/resources/external-texture.d.ts.map +1 -0
- package/dist/adapter/resources/external-texture.js +17 -0
- package/dist/adapter/resources/external-texture.js.map +1 -0
- package/dist/adapter/resources/framebuffer.d.ts +50 -0
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -0
- package/dist/adapter/resources/framebuffer.js +102 -0
- package/dist/adapter/resources/framebuffer.js.map +1 -0
- package/dist/adapter/resources/render-pass.d.ts +51 -0
- package/dist/adapter/resources/render-pass.d.ts.map +1 -0
- package/dist/adapter/resources/render-pass.js +23 -0
- package/dist/adapter/resources/render-pass.js.map +1 -0
- package/dist/adapter/resources/render-pipeline.d.ts +89 -0
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -0
- package/dist/adapter/resources/render-pipeline.js +36 -0
- package/dist/adapter/resources/render-pipeline.js.map +1 -0
- package/dist/adapter/resources/resource.d.ts +73 -0
- package/dist/adapter/resources/resource.d.ts.map +1 -0
- package/dist/adapter/resources/resource.js +101 -0
- package/dist/adapter/resources/resource.js.map +1 -0
- package/dist/adapter/resources/sampler.d.ts +42 -0
- package/dist/adapter/resources/sampler.d.ts.map +1 -0
- package/dist/adapter/resources/sampler.js +26 -0
- package/dist/adapter/resources/sampler.js.map +1 -0
- package/dist/adapter/resources/shader.d.ts +45 -0
- package/dist/adapter/resources/shader.d.ts.map +1 -0
- package/dist/adapter/resources/shader.js +90 -0
- package/dist/adapter/resources/shader.js.map +1 -0
- package/dist/adapter/resources/texture.d.ts +90 -0
- package/dist/adapter/resources/texture.d.ts.map +1 -0
- package/dist/adapter/resources/texture.js +45 -0
- package/dist/adapter/resources/texture.js.map +1 -0
- package/dist/adapter/resources/transform-feedback.d.ts +30 -0
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -0
- package/dist/adapter/resources/transform-feedback.js +17 -0
- package/dist/adapter/resources/transform-feedback.js.map +1 -0
- package/dist/adapter/resources/vertex-array.d.ts +40 -0
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -0
- package/dist/adapter/resources/vertex-array.js +24 -0
- package/dist/adapter/resources/vertex-array.js.map +1 -0
- package/dist/adapter/type-utils/decode-attribute-type.d.ts +20 -0
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-attribute-type.js +60 -0
- package/dist/adapter/type-utils/decode-attribute-type.js.map +1 -0
- package/dist/adapter/type-utils/decode-data-type.d.ts +16 -0
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-data-type.js +43 -0
- package/dist/adapter/type-utils/decode-data-type.js.map +1 -0
- package/dist/adapter/type-utils/decode-shader-types.d.ts +9 -0
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-shader-types.js +103 -0
- package/dist/adapter/type-utils/decode-shader-types.js.map +1 -0
- package/dist/adapter/type-utils/decode-texture-format.d.ts +19 -0
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-texture-format.js +101 -0
- package/dist/adapter/type-utils/decode-texture-format.js.map +1 -0
- package/dist/adapter/type-utils/decode-vertex-format.d.ts +22 -0
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-vertex-format.js +25 -0
- package/dist/adapter/type-utils/decode-vertex-format.js.map +1 -0
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts +10 -0
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/adapter/type-utils/vertex-format-from-attribute.js +76 -0
- package/dist/adapter/type-utils/vertex-format-from-attribute.js.map +1 -0
- package/dist/adapter/type-utils/wgsl-utils.d.ts +4 -0
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/adapter/type-utils/wgsl-utils.js +15 -0
- package/dist/adapter/type-utils/wgsl-utils.js.map +1 -0
- package/dist/adapter/types/accessor.d.ts +23 -0
- package/dist/adapter/types/accessor.d.ts.map +1 -0
- package/dist/adapter/types/accessor.js +2 -0
- package/dist/adapter/types/accessor.js.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +59 -0
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.js +2 -0
- package/dist/adapter/types/buffer-layout.js.map +1 -0
- package/dist/adapter/types/parameters.d.ts +97 -0
- package/dist/adapter/types/parameters.d.ts.map +1 -0
- package/dist/adapter/types/parameters.js +28 -0
- package/dist/adapter/types/parameters.js.map +1 -0
- package/dist/adapter/types/shader-layout.d.ts +145 -0
- package/dist/adapter/types/shader-layout.d.ts.map +1 -0
- package/dist/adapter/types/shader-layout.js +2 -0
- package/dist/adapter/types/shader-layout.js.map +1 -0
- package/dist/adapter/types/shader-types.d.ts +21 -0
- package/dist/adapter/types/shader-types.d.ts.map +1 -0
- package/dist/adapter/types/shader-types.js +2 -0
- package/dist/adapter/types/shader-types.js.map +1 -0
- package/dist/adapter/types/texture-formats.d.ts +12 -0
- package/dist/adapter/types/texture-formats.d.ts.map +1 -0
- package/dist/adapter/types/texture-formats.js +2 -0
- package/dist/adapter/types/texture-formats.js.map +1 -0
- package/dist/adapter/types/types.d.ts +90 -0
- package/dist/adapter/types/types.d.ts.map +1 -0
- package/dist/adapter/types/types.js +2 -0
- package/dist/adapter/types/types.js.map +1 -0
- package/dist/adapter/types/vertex-formats.d.ts +14 -0
- package/dist/adapter/types/vertex-formats.d.ts.map +1 -0
- package/dist/adapter/types/vertex-formats.js +2 -0
- package/dist/adapter/types/vertex-formats.js.map +1 -0
- package/dist/dist.dev.js +2976 -0
- package/dist/index.cjs +2445 -0
- package/dist/index.d.ts +81 -128
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -18
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +5 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +24 -0
- package/dist/init.js.map +1 -0
- package/dist/lib/compiler-log/compiler-message.d.ts +8 -0
- package/dist/lib/compiler-log/compiler-message.d.ts.map +1 -0
- package/dist/lib/compiler-log/compiler-message.js +2 -0
- package/dist/lib/compiler-log/compiler-message.js.map +1 -0
- package/dist/lib/compiler-log/format-compiler-log.d.ts +8 -0
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +1 -0
- package/dist/lib/compiler-log/format-compiler-log.js +64 -0
- package/dist/lib/compiler-log/format-compiler-log.js.map +1 -0
- package/dist/lib/compiler-log/get-shader-info.d.ts +9 -0
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +1 -0
- package/dist/lib/compiler-log/get-shader-info.js +25 -0
- package/dist/lib/compiler-log/get-shader-info.js.map +1 -0
- package/dist/lib/luma.d.ts +22 -0
- package/dist/lib/luma.d.ts.map +1 -0
- package/dist/lib/luma.js +63 -0
- package/dist/lib/luma.js.map +1 -0
- package/dist/lib/uniforms/uniform-block.d.ts +29 -0
- package/dist/lib/uniforms/uniform-block.d.ts.map +1 -0
- package/dist/lib/uniforms/uniform-block.js +48 -0
- package/dist/lib/uniforms/uniform-block.js.map +1 -0
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts +27 -0
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/lib/uniforms/uniform-buffer-layout.js +76 -0
- package/dist/lib/uniforms/uniform-buffer-layout.js.map +1 -0
- package/dist/lib/uniforms/uniform-store.d.ts +62 -0
- package/dist/lib/uniforms/uniform-store.d.ts.map +1 -0
- package/dist/lib/uniforms/uniform-store.js +89 -0
- package/dist/lib/uniforms/uniform-store.js.map +1 -0
- package/dist/lib/uniforms/uniform.d.ts +10 -0
- package/dist/lib/uniforms/uniform.d.ts.map +1 -0
- package/dist/lib/uniforms/uniform.js +20 -0
- package/dist/lib/uniforms/uniform.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/array-equal.d.ts +5 -0
- package/dist/utils/array-equal.d.ts.map +1 -0
- package/dist/utils/array-equal.js +28 -0
- package/dist/utils/array-equal.js.map +1 -0
- package/dist/utils/array-utils-flat.d.ts +10 -0
- package/dist/utils/array-utils-flat.d.ts.map +1 -0
- package/dist/utils/array-utils-flat.js +36 -0
- package/dist/utils/array-utils-flat.js.map +1 -0
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/dist/utils/assert.js +6 -0
- package/dist/utils/assert.js.map +1 -0
- package/dist/utils/cast.d.ts +3 -0
- package/dist/utils/cast.d.ts.map +1 -0
- package/dist/utils/cast.js +4 -0
- package/dist/utils/cast.js.map +1 -0
- package/dist/utils/check-props.d.ts +7 -0
- package/dist/utils/check-props.d.ts.map +1 -0
- package/dist/utils/check-props.js +32 -0
- package/dist/utils/check-props.js.map +1 -0
- package/dist/utils/deep-equal.d.ts +9 -0
- package/dist/utils/deep-equal.d.ts.map +1 -0
- package/dist/utils/deep-equal.js +40 -0
- package/dist/utils/deep-equal.js.map +1 -0
- package/dist/utils/format-value.d.ts +7 -0
- package/dist/utils/format-value.d.ts.map +1 -0
- package/dist/utils/format-value.js +42 -0
- package/dist/utils/format-value.js.map +1 -0
- package/dist/utils/is-array.d.ts +16 -0
- package/dist/utils/is-array.d.ts.map +1 -0
- package/dist/utils/is-array.js +10 -0
- package/dist/utils/is-array.js.map +1 -0
- package/dist/utils/load-file.d.ts +35 -0
- package/dist/utils/load-file.d.ts.map +1 -0
- package/dist/utils/load-file.js +48 -0
- package/dist/utils/load-file.js.map +1 -0
- package/dist/utils/log.d.ts +4 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/log.js +5 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/random.d.ts +5 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/random.js +14 -0
- package/dist/utils/random.js.map +1 -0
- package/dist/utils/request-animation-frame.d.ts +3 -0
- package/dist/utils/request-animation-frame.d.ts.map +1 -0
- package/dist/utils/request-animation-frame.js +7 -0
- package/dist/utils/request-animation-frame.js.map +1 -0
- package/dist/utils/stats-manager.d.ts +12 -0
- package/dist/utils/stats-manager.d.ts.map +1 -0
- package/dist/utils/stats-manager.js +19 -0
- package/dist/utils/stats-manager.js.map +1 -0
- package/dist/utils/stub-methods.d.ts +2 -0
- package/dist/utils/stub-methods.d.ts.map +1 -0
- package/dist/utils/stub-methods.js +16 -0
- package/dist/utils/stub-methods.js.map +1 -0
- package/dist/utils/utils.d.ts +15 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +19 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist.min.js +33 -0
- package/package.json +17 -12
- package/src/adapter/attribute-utils/get-attribute-from-layouts.ts +259 -0
- package/src/adapter/canvas-context.ts +433 -0
- package/src/adapter/device.ts +435 -0
- package/src/adapter/resources/buffer.ts +106 -0
- package/src/adapter/resources/command-buffer.ts +38 -0
- package/src/adapter/resources/command-encoder.ts +172 -0
- package/src/adapter/resources/compute-pass.ts +52 -0
- package/src/adapter/resources/compute-pipeline.ts +39 -0
- package/src/adapter/resources/external-texture.ts +20 -0
- package/src/adapter/resources/framebuffer.ts +230 -0
- package/src/adapter/resources/render-pass.ts +117 -0
- package/src/adapter/resources/render-pipeline.ts +133 -0
- package/src/adapter/resources/resource.ts +176 -0
- package/src/adapter/resources/sampler.ts +69 -0
- package/src/adapter/resources/shader.ts +143 -0
- package/src/adapter/resources/texture.ts +140 -0
- package/src/adapter/resources/transform-feedback.ts +45 -0
- package/src/adapter/resources/vertex-array.ts +65 -0
- package/src/adapter/type-utils/decode-attribute-type.ts +82 -0
- package/src/adapter/type-utils/decode-data-type.ts +62 -0
- package/src/adapter/type-utils/decode-shader-types.ts +48 -0
- package/src/adapter/type-utils/decode-texture-format.ts +190 -0
- package/src/adapter/type-utils/decode-vertex-format.ts +49 -0
- package/src/adapter/type-utils/vertex-format-from-attribute.ts +103 -0
- package/src/adapter/type-utils/wgsl-utils.ts +18 -0
- package/src/adapter/types/accessor.ts +34 -0
- package/src/adapter/types/buffer-layout.ts +62 -0
- package/src/adapter/types/parameters.ts +250 -0
- package/src/adapter/types/shader-layout.ts +193 -0
- package/src/adapter/types/shader-types.ts +77 -0
- package/src/adapter/types/texture-formats.ts +168 -0
- package/src/adapter/types/types.ts +109 -0
- package/src/adapter/types/vertex-formats.ts +91 -0
- package/src/index.ts +160 -92
- package/src/init.ts +47 -0
- package/src/lib/compiler-log/compiler-message.ts +10 -0
- package/src/lib/compiler-log/format-compiler-log.ts +113 -0
- package/src/lib/compiler-log/get-shader-info.ts +41 -0
- package/src/lib/luma.ts +84 -0
- package/src/lib/uniforms/uniform-block.ts +80 -0
- package/src/lib/uniforms/uniform-buffer-layout.ts +109 -0
- package/src/lib/uniforms/uniform-store.ts +173 -0
- package/src/lib/uniforms/uniform.ts +25 -0
- package/src/types.ts +33 -0
- package/src/utils/array-equal.ts +33 -0
- package/src/utils/array-utils-flat.ts +43 -0
- package/src/utils/assert.ts +7 -0
- package/src/utils/cast.ts +4 -0
- package/src/utils/check-props.ts +74 -0
- package/src/utils/deep-equal.ts +47 -0
- package/src/utils/format-value.ts +40 -0
- package/src/utils/is-array.ts +24 -0
- package/src/utils/load-file.ts +89 -0
- package/src/utils/log.ts +4 -0
- package/src/utils/random.ts +17 -0
- package/src/utils/request-animation-frame.ts +15 -0
- package/src/utils/stats-manager.ts +23 -0
- package/src/utils/stub-methods.ts +20 -0
- package/src/utils/utils.ts +36 -0
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/src/bundle.ts +0 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Device } from '../device';
|
|
2
|
+
import { Resource, ResourceProps } from './resource';
|
|
3
|
+
import { Buffer } from './buffer';
|
|
4
|
+
import { Texture } from './texture';
|
|
5
|
+
export type WriteBufferOptions = {
|
|
6
|
+
buffer: Buffer;
|
|
7
|
+
bufferOffset?: number;
|
|
8
|
+
data: BufferSource;
|
|
9
|
+
dataOffset?: number;
|
|
10
|
+
size?: number;
|
|
11
|
+
};
|
|
12
|
+
export type WriteTextureOptions = {
|
|
13
|
+
destination: Texture;
|
|
14
|
+
mipLevel?: number;
|
|
15
|
+
origin?: [number, number, number] | number[];
|
|
16
|
+
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
17
|
+
data: BufferSource;
|
|
18
|
+
offset: number;
|
|
19
|
+
bytesPerRow: number;
|
|
20
|
+
rowsPerImage: number;
|
|
21
|
+
size: [number, number, number] | number[];
|
|
22
|
+
};
|
|
23
|
+
export type CopyBufferToBufferOptions = {
|
|
24
|
+
source: Buffer;
|
|
25
|
+
sourceOffset?: number;
|
|
26
|
+
destination: Buffer;
|
|
27
|
+
destinationOffset?: number;
|
|
28
|
+
size: number;
|
|
29
|
+
};
|
|
30
|
+
export type CopyBufferToTextureOptions = {
|
|
31
|
+
source: Buffer;
|
|
32
|
+
byteOffset?: number;
|
|
33
|
+
destination: Texture;
|
|
34
|
+
mipLevel?: number;
|
|
35
|
+
origin?: [number, number, number] | number[];
|
|
36
|
+
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
37
|
+
bytesPerRow: number;
|
|
38
|
+
rowsPerImage: number;
|
|
39
|
+
size: [number, number, number] | number[];
|
|
40
|
+
};
|
|
41
|
+
export type CopyTextureToBufferOptions = {
|
|
42
|
+
/** Texture to copy to/from. */
|
|
43
|
+
source: Texture;
|
|
44
|
+
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
45
|
+
mipLevel?: number;
|
|
46
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from.
|
|
47
|
+
* Together with `copySize`, defines the full copy sub-region.
|
|
48
|
+
*/
|
|
49
|
+
/** Defines which aspects of the texture to copy to/from. */
|
|
50
|
+
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
51
|
+
/** Width to copy */
|
|
52
|
+
width?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
depthOrArrayLayers?: number;
|
|
55
|
+
origin?: number[];
|
|
56
|
+
/** Destination buffer */
|
|
57
|
+
destination: Buffer;
|
|
58
|
+
/** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
|
|
59
|
+
byteOffset?: number;
|
|
60
|
+
/**
|
|
61
|
+
* The stride, in bytes, between the beginning of each block row and the subsequent block row.
|
|
62
|
+
* Required if there are multiple block rows (i.e. the copy height or depth is more than one block).
|
|
63
|
+
*/
|
|
64
|
+
bytesPerRow?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Number of block rows per single image of the texture.
|
|
67
|
+
* rowsPerImage × bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.
|
|
68
|
+
* Required if there are multiple images (i.e. the copy depth is more than one).
|
|
69
|
+
*/
|
|
70
|
+
rowsPerImage?: number;
|
|
71
|
+
};
|
|
72
|
+
export type CopyTextureToTextureOptions = {
|
|
73
|
+
/** Texture to copy to/from. */
|
|
74
|
+
source: Texture;
|
|
75
|
+
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
76
|
+
mipLevel?: number;
|
|
77
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */
|
|
78
|
+
/** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */
|
|
79
|
+
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
80
|
+
/** Texture to copy to/from. */
|
|
81
|
+
destination: Texture;
|
|
82
|
+
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
83
|
+
destinationMipLevel?: number;
|
|
84
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
|
|
85
|
+
destinationOrigin?: number[];
|
|
86
|
+
/** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */
|
|
87
|
+
destinationAspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
88
|
+
origin?: number[];
|
|
89
|
+
/** Width to copy */
|
|
90
|
+
width?: number;
|
|
91
|
+
height?: number;
|
|
92
|
+
depthOrArrayLayers?: number;
|
|
93
|
+
};
|
|
94
|
+
export type CommandEncoderProps = ResourceProps & {
|
|
95
|
+
measureExecutionTime?: boolean;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Encodes commands to queue that can be executed later
|
|
99
|
+
*/
|
|
100
|
+
export declare abstract class CommandEncoder extends Resource<CommandEncoderProps> {
|
|
101
|
+
static defaultProps: Required<CommandEncoderProps>;
|
|
102
|
+
get [Symbol.toStringTag](): string;
|
|
103
|
+
constructor(device: Device, props: CommandEncoderProps);
|
|
104
|
+
abstract finish(): void;
|
|
105
|
+
abstract copyBufferToBuffer(options: CopyBufferToBufferOptions): void;
|
|
106
|
+
abstract copyBufferToTexture(options: CopyBufferToTextureOptions): void;
|
|
107
|
+
abstract copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
|
|
108
|
+
abstract copyTextureToTexture(options: CopyTextureToTextureOptions): void;
|
|
109
|
+
pushDebugGroup(groupLabel: string): void;
|
|
110
|
+
popDebugGroup(): void;
|
|
111
|
+
insertDebugMarker(markerLabel: string): void;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=command-encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-encoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,YAA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C7B,CAAC;AAiBF,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,8BAAsB,cAAe,SAAQ,QAAQ,CAAC,mBAAmB,CAAC;IACxE,OAAgB,YAAY,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAGzD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAItD,QAAQ,CAAC,MAAM,IAAI,IAAI;IAMvB,QAAQ,CAAC,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAErE,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAEvE,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAEvE,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAEzE,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAExC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAW7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
let _Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4
|
+
export class CommandEncoder extends Resource {
|
|
5
|
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'CommandEncoder';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, CommandEncoder.defaultProps);
|
|
10
|
+
}
|
|
11
|
+
pushDebugGroup(groupLabel) {}
|
|
12
|
+
popDebugGroup() {}
|
|
13
|
+
insertDebugMarker(markerLabel) {}
|
|
14
|
+
}
|
|
15
|
+
CommandEncoder.defaultProps = {
|
|
16
|
+
...Resource.defaultProps,
|
|
17
|
+
measureExecutionTime: undefined
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=command-encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-encoder.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","CommandEncoder","constructor","device","props","defaultProps","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel","measureExecutionTime","undefined"],"sources":["../../../src/adapter/resources/command-encoder.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\nimport {Buffer} from './buffer';\nimport {Texture} from './texture';\n\nexport type WriteBufferOptions = {\n buffer: Buffer,\n bufferOffset?: number,\n data: BufferSource,\n dataOffset?: number,\n size?: number\n};\n\nexport type WriteTextureOptions = {\n destination: Texture;\n mipLevel?: number; // = 0;\n origin?: [number, number, number] | number[];\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n data: BufferSource;\n // dataLayout;\n offset: number;\n bytesPerRow: number;\n rowsPerImage: number;\n size: [number, number, number] | number[];\n}\n\nexport type CopyBufferToBufferOptions = {\n source: Buffer;\n sourceOffset?: number;\n destination: Buffer;\n destinationOffset?: number;\n size: number;\n};\n\nexport type CopyBufferToTextureOptions = {\n source: Buffer;\n byteOffset?: number;\n destination: Texture;\n mipLevel?: number // = 0;\n origin?: [number, number, number] | number[];\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n bytesPerRow: number;\n rowsPerImage: number;\n size: [number, number, number] | number[];\n};\n\nexport type CopyTextureToBufferOptions = {\n /** Texture to copy to/from. */\n source: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from.\n * Together with `copySize`, defines the full copy sub-region.\n */\n /** Defines which aspects of the texture to copy to/from. */\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n /** Width to copy */\n width?: number;\n height?: number;\n depthOrArrayLayers?: number;\n origin?: number[];\n\n /** Destination buffer */\n destination: Buffer;\n /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */\n byteOffset?: number;\n /**\n * The stride, in bytes, between the beginning of each block row and the subsequent block row.\n * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).\n */\n bytesPerRow?: number;\n /**\n * Number of block rows per single image of the texture.\n * rowsPerImage × bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.\n * Required if there are multiple images (i.e. the copy depth is more than one).\n */\n rowsPerImage?: number;\n};\n\nexport type CopyTextureToTextureOptions = {\n /** Texture to copy to/from. */\n source: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */\n /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n /** Texture to copy to/from. */\n destination: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n destinationMipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */\n destinationOrigin?: number[];\n /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */\n destinationAspect?: 'all' | 'stencil-only' | 'depth-only';\n\n origin?: number[];\n /** Width to copy */\n width?: number;\n height?: number;\n depthOrArrayLayers?: number;\n};\n\n// interface Queue {\n// submit(commandBuffers);\n\n// // onSubmittedWorkDone(): Promise<undefined>;\n\n// writeBuffer(options: WriteBufferOptions): void;\n// writeTexture(options: WriteTextureOptions): void;\n\n// // copyExternalImageToTexture(\n// // GPUImageCopyExternalImage source,\n// // GPUImageCopyTextureTagged destination,\n// // GPUExtent3D copySize\n// // ): void;\n// }\n\nexport type CommandEncoderProps = ResourceProps & {\n measureExecutionTime?: boolean;\n};\n\n/**\n * Encodes commands to queue that can be executed later\n */\nexport abstract class CommandEncoder extends Resource<CommandEncoderProps> {\n static override defaultProps: Required<CommandEncoderProps> = {\n ...Resource.defaultProps,\n measureExecutionTime: undefined\n };\n \n override get [Symbol.toStringTag](): string {\n return 'CommandEncoder';\n }\n\n constructor(device: Device, props: CommandEncoderProps) {\n super(device, props, CommandEncoder.defaultProps);\n }\n \n abstract finish(): void; // TODO - return the CommandBuffer?\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n abstract copyBufferToBuffer(options: CopyBufferToBufferOptions): void;\n\n abstract copyBufferToTexture(options: CopyBufferToTextureOptions): void;\n\n abstract copyTextureToBuffer(options: CopyTextureToBufferOptions): void;\n\n abstract copyTextureToTexture(options: CopyTextureToTextureOptions): void;\n\n pushDebugGroup(groupLabel: string): void {}\n\n popDebugGroup() {}\n\n insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void;\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";SAEQA,QAAQ;AAAAC,mBAAA,GAoIAC,MAAM,CAACC,WAAW;AANlC,OAAO,MAAeC,cAAc,SAASJ,QAAQ,CAAsB;EAMzE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,gBAAgB;EACzB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAA0B,EAAE;IACtD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,cAAc,CAACI,YAAY,CAAC;EACnD;EAgBAC,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAE1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWhD;AA3CsBT,cAAc,CAClBI,YAAY,GAAkC;EAC5D,GAAGR,QAAQ,CAACQ,YAAY;EACxBM,oBAAoB,EAAEC;AACxB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Resource, ResourceProps } from './resource';
|
|
2
|
+
import { ComputePipeline } from './compute-pipeline';
|
|
3
|
+
import { Buffer } from './buffer';
|
|
4
|
+
import type { Device } from '../device';
|
|
5
|
+
export type ComputePassProps = ResourceProps & {};
|
|
6
|
+
export declare abstract class ComputePass extends Resource<ComputePassProps> {
|
|
7
|
+
static defaultProps: Required<ComputePassProps>;
|
|
8
|
+
get [Symbol.toStringTag](): string;
|
|
9
|
+
constructor(device: Device, props: ComputePassProps);
|
|
10
|
+
abstract destroy(): void;
|
|
11
|
+
abstract end(): void;
|
|
12
|
+
abstract setPipeline(pipeline: ComputePipeline): void;
|
|
13
|
+
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
14
|
+
/**
|
|
15
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
16
|
+
* @param x X dimension of the grid of workgroups to dispatch.
|
|
17
|
+
* @param y Y dimension of the grid of workgroups to dispatch.
|
|
18
|
+
* @param z Z dimension of the grid of workgroups to dispatch.
|
|
19
|
+
*/
|
|
20
|
+
abstract dispatch(x: number, y?: number, z?: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
23
|
+
* @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
|
|
24
|
+
* @param indirectOffset
|
|
25
|
+
*/
|
|
26
|
+
abstract dispatchIndirect(indirectBuffer: Buffer, indirectOffset?: number): void;
|
|
27
|
+
abstract pushDebugGroup(groupLabel: string): void;
|
|
28
|
+
abstract popDebugGroup(): void;
|
|
29
|
+
abstract insertDebugMarker(markerLabel: string): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=compute-pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pass.ts"],"names":[],"mapp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
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'ComputePass';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, Resource.defaultProps);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
ComputePass.defaultProps = {
|
|
13
|
+
...Resource.defaultProps
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=compute-pass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-pass.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","ComputePass","constructor","device","props","defaultProps"],"sources":["../../../src/adapter/resources/compute-pass.ts"],"sourcesContent":["import {Resource, ResourceProps} from './resource';\nimport {ComputePipeline} from './compute-pipeline';\nimport {Buffer} from './buffer';\nimport type {Device} from '../device';\n\nexport type ComputePassProps = ResourceProps & {};\n\nexport abstract class ComputePass extends Resource<ComputePassProps> {\n static override defaultProps: Required<ComputePassProps> = {\n ...Resource.defaultProps\n }\n\n override get [Symbol.toStringTag](): string {\n return 'ComputePass';\n }\n\n constructor(device: Device, props: ComputePassProps) {\n super(device, props, Resource.defaultProps);\n }\n\n abstract override destroy(): void;\n\n abstract end(): void;\n\n abstract setPipeline(pipeline: ComputePipeline): void;\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n // abstract setBindings(bindings: Binding[]): void;\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param x X dimension of the grid of workgroups to dispatch.\n * @param y Y dimension of the grid of workgroups to dispatch.\n * @param z Z dimension of the grid of workgroups to dispatch.\n */\n abstract dispatch(x: number, y?: number, z?: number): void;\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()\n * @param indirectOffset\n */\n abstract dispatchIndirect(indirectBuffer: Buffer, indirectOffset?: number): void;\n\n abstract pushDebugGroup(groupLabel: string): void;\n abstract popDebugGroup(): void;\n abstract insertDebugMarker(markerLabel: string): void;\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n}\n"],"mappings":";SAAQA,QAAQ;AAAAC,mBAAA,GAYAC,MAAM,CAACC,WAAW;AALlC,OAAO,MAAeC,WAAW,SAASJ,QAAQ,CAAmB;EAKnE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAAuB,EAAE;IACnD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEP,QAAQ,CAACQ,YAAY,CAAC;EAC7C;AAiCF;AA5CsBJ,WAAW,CACfI,YAAY,GAA+B;EACzD,GAAGR,QAAQ,CAACQ;AACd,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Resource, ResourceProps } from './resource';
|
|
2
|
+
import { BindingDeclaration } from '../types/shader-layout';
|
|
3
|
+
import type { Device } from '../device';
|
|
4
|
+
import type { Shader } from './shader';
|
|
5
|
+
/**
|
|
6
|
+
* Properties for a compute pipeline
|
|
7
|
+
*/
|
|
8
|
+
export type ComputePipelineProps = ResourceProps & {
|
|
9
|
+
handle?: unknown;
|
|
10
|
+
cs: Shader;
|
|
11
|
+
csEntryPoint?: string;
|
|
12
|
+
csConstants?: Record<string, number>;
|
|
13
|
+
shaderLayout?: BindingDeclaration[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A compiled and linked shader program for compute
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class ComputePipeline extends Resource<ComputePipelineProps> {
|
|
19
|
+
static defaultProps: Required<ComputePipelineProps>;
|
|
20
|
+
get [Symbol.toStringTag](): string;
|
|
21
|
+
hash: string;
|
|
22
|
+
constructor(device: Device, props: ComputePipelineProps);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=compute-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,8BAAsB,eAAgB,SAAQ,QAAQ,CAAC,oBAAoB,CAAC;IAC1E,OAAgB,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAM1D;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,IAAI,EAAE,MAAM,CAAM;gBAEN,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAGxD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let _Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4
|
+
export class ComputePipeline extends Resource {
|
|
5
|
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'ComputePipeline';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, ComputePipeline.defaultProps);
|
|
10
|
+
this.hash = '';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
ComputePipeline.defaultProps = {
|
|
14
|
+
...Resource.defaultProps,
|
|
15
|
+
cs: undefined,
|
|
16
|
+
csEntryPoint: undefined,
|
|
17
|
+
csConstants: {},
|
|
18
|
+
shaderLayout: []
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=compute-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-pipeline.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","ComputePipeline","constructor","device","props","defaultProps","hash","cs","undefined","csEntryPoint","csConstants","shaderLayout"],"sources":["../../../src/adapter/resources/compute-pipeline.ts"],"sourcesContent":["//\nimport {Resource, ResourceProps} from './resource';\nimport {BindingDeclaration} from '../types/shader-layout';\nimport type {Device} from '../device';\nimport type {Shader} from './shader';\n\n/**\n * Properties for a compute pipeline\n */\nexport type ComputePipelineProps = ResourceProps & {\n handle?: unknown;\n cs: Shader;\n csEntryPoint?: string;\n csConstants?: Record<string, number>; // WGSL only\n shaderLayout?: BindingDeclaration[];\n};\n\n/**\n * A compiled and linked shader program for compute\n */\nexport abstract class ComputePipeline extends Resource<ComputePipelineProps> {\n static override defaultProps: Required<ComputePipelineProps> = {\n ...Resource.defaultProps,\n cs: undefined,\n csEntryPoint: undefined,\n csConstants: {},\n shaderLayout: []\n }; \n\n override get [Symbol.toStringTag](): string {\n return 'ComputePipeline';\n }\n\n hash: string = '';\n\n constructor(device: Device, props: ComputePipelineProps) {\n super(device, props, ComputePipeline.defaultProps);\n }\n}\n"],"mappings":";SACQA,QAAQ;AAAAC,mBAAA,GA4BAC,MAAM,CAACC,WAAW;AATlC,OAAO,MAAeC,eAAe,SAASJ,QAAQ,CAAuB;EAS3E,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,iBAAiB;EAC1B;EAIAI,WAAWA,CAACC,MAAc,EAAEC,KAA2B,EAAE;IACvD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,eAAe,CAACI,YAAY,CAAC;IAAC,KAHrDC,IAAI,GAAW,EAAE;EAIjB;AACF;AAlBsBL,eAAe,CACnBI,YAAY,GAAmC;EAC7D,GAAGR,QAAQ,CAACQ,YAAY;EACxBE,EAAE,EAAEC,SAAS;EACbC,YAAY,EAAED,SAAS;EACvBE,WAAW,EAAE,CAAC,CAAC;EACfC,YAAY,EAAE;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Device } from '../device';
|
|
2
|
+
import { Resource, ResourceProps } from './resource';
|
|
3
|
+
export type ExternalTextureProps = ResourceProps & {
|
|
4
|
+
source: HTMLVideoElement | null;
|
|
5
|
+
colorSpace?: 'srgb';
|
|
6
|
+
};
|
|
7
|
+
export declare abstract class ExternalTexture extends Resource<ExternalTextureProps> {
|
|
8
|
+
static defaultProps: Required<ExternalTextureProps>;
|
|
9
|
+
get [Symbol.toStringTag](): string;
|
|
10
|
+
constructor(device: Device, props: ExternalTextureProps);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=external-texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/external-texture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAA;AACD,8BAAsB,eAAgB,SAAQ,QAAQ,CAAC,oBAAoB,CAAC;IAC1E,OAAgB,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAI1D;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAA8B;gBAE7D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAGxD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let _Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4
|
+
export class ExternalTexture extends Resource {
|
|
5
|
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'ExternalTexture';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, ExternalTexture.defaultProps);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
ExternalTexture.defaultProps = {
|
|
13
|
+
...Resource.defaultProps,
|
|
14
|
+
source: null,
|
|
15
|
+
colorSpace: 'srgb'
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=external-texture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-texture.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","ExternalTexture","constructor","device","props","defaultProps","source","colorSpace"],"sources":["../../../src/adapter/resources/external-texture.ts"],"sourcesContent":["import type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n\nexport type ExternalTextureProps = ResourceProps & {\n source: HTMLVideoElement | null;\n colorSpace?: 'srgb';\n}\nexport abstract class ExternalTexture extends Resource<ExternalTextureProps> {\n static override defaultProps: Required<ExternalTextureProps> = {\n ...Resource.defaultProps,\n source: null,\n colorSpace: 'srgb'\n };\n\n override get [Symbol.toStringTag](): string { return 'ExternalTexture'; }\n\n constructor(device: Device, props: ExternalTextureProps) {\n super(device, props, ExternalTexture.defaultProps);\n }\n}\n"],"mappings":";SACQA,QAAQ;AAAAC,mBAAA,GAaAC,MAAM,CAACC,WAAW;AAPlC,OAAO,MAAeC,eAAe,SAASJ,QAAQ,CAAuB;EAO3E,KAAAC,mBAAA,IAA4C;IAAE,OAAO,iBAAiB;EAAE;EAExEI,WAAWA,CAACC,MAAc,EAAEC,KAA2B,EAAE;IACvD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,eAAe,CAACI,YAAY,CAAC;EACpD;AACF;AAZsBJ,eAAe,CACnBI,YAAY,GAAmC;EAC7D,GAAGR,QAAQ,CAACQ,YAAY;EACxBC,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from '../types/texture-formats';
|
|
2
|
+
import type { Device } from '../device';
|
|
3
|
+
import { Resource, ResourceProps } from './resource';
|
|
4
|
+
import { Texture } from './texture';
|
|
5
|
+
export type FramebufferProps = ResourceProps & {
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
colorAttachments?: (Texture | ColorTextureFormat)[];
|
|
9
|
+
depthStencilAttachment?: (Texture | DepthStencilTextureFormat) | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Create new textures with correct size for all attachments.
|
|
13
|
+
* @note resize() destroys existing textures (if size has changed).
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
16
|
+
static defaultProps: Required<FramebufferProps>;
|
|
17
|
+
get [Symbol.toStringTag](): string;
|
|
18
|
+
/** Width of all attachments in this framebuffer */
|
|
19
|
+
width: number;
|
|
20
|
+
/** Height of all attachments in this framebuffer */
|
|
21
|
+
height: number;
|
|
22
|
+
/** Color attachments */
|
|
23
|
+
colorAttachments: Texture[];
|
|
24
|
+
/** Depth-stencil attachment, if provided */
|
|
25
|
+
depthStencilAttachment: Texture | null;
|
|
26
|
+
constructor(device: Device, props?: FramebufferProps);
|
|
27
|
+
/**
|
|
28
|
+
* Resizes all attachments
|
|
29
|
+
* @note resize() destroys existing textures (if size has changed).
|
|
30
|
+
*/
|
|
31
|
+
resize(size: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}): void;
|
|
35
|
+
resize(size: [width: number, height: number]): void;
|
|
36
|
+
resize(): void;
|
|
37
|
+
/** Auto creates any textures */
|
|
38
|
+
protected autoCreateAttachmentTextures(): void;
|
|
39
|
+
/** Create a color texture */
|
|
40
|
+
protected createColorTexture(format: TextureFormat): Texture;
|
|
41
|
+
/** Create depth stencil texture */
|
|
42
|
+
protected createDepthStencilTexture(format: TextureFormat): Texture;
|
|
43
|
+
/**
|
|
44
|
+
* Default implementation of resize
|
|
45
|
+
* Creates new textures with correct size for all attachments.
|
|
46
|
+
* and destroys existing textures if owned
|
|
47
|
+
*/
|
|
48
|
+
protected resizeAttachments(width: number, height: number): void;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=framebuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAE,yBAAyB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC3G,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAGlC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,CAAC,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC;IACpD,sBAAsB,CAAC,EAAE,CAAC,OAAO,GAAG,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACvE,CAAC;AAEF;;;GAGG;AACH,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAMtD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,gBAAgB,EAAE,OAAO,EAAE,CAAM;IACjC,4CAA4C;IAC5C,sBAAsB,EAAE,OAAO,GAAG,IAAI,CAAQ;gBAElC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,gBAAqB;IASxD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;KAAC,GAAG,IAAI;IACpD,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IACnD,MAAM,IAAI,IAAI;IAkEd,gCAAgC;IAChC,SAAS,CAAC,4BAA4B;IAqBtC,6BAA6B;IAC7B,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAU5D,mCAAmC;IACnC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAUnE;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAyDjE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
let _Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
import { Texture } from "./texture.js";
|
|
4
|
+
import { log } from "../../utils/log.js";
|
|
5
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
6
|
+
export class Framebuffer extends Resource {
|
|
7
|
+
get [_Symbol$toStringTag]() {
|
|
8
|
+
return 'Framebuffer';
|
|
9
|
+
}
|
|
10
|
+
constructor(device) {
|
|
11
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12
|
+
super(device, props, Framebuffer.defaultProps);
|
|
13
|
+
this.width = void 0;
|
|
14
|
+
this.height = void 0;
|
|
15
|
+
this.colorAttachments = [];
|
|
16
|
+
this.depthStencilAttachment = null;
|
|
17
|
+
this.width = this.props.width;
|
|
18
|
+
this.height = this.props.height;
|
|
19
|
+
}
|
|
20
|
+
resize(size) {
|
|
21
|
+
let updateSize = !size;
|
|
22
|
+
if (size) {
|
|
23
|
+
const [width, height] = Array.isArray(size) ? size : [size.width, size.height];
|
|
24
|
+
updateSize = updateSize || height !== this.height || width !== this.width;
|
|
25
|
+
this.width = width;
|
|
26
|
+
this.height = height;
|
|
27
|
+
}
|
|
28
|
+
if (updateSize) {
|
|
29
|
+
log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();
|
|
30
|
+
this.resizeAttachments(this.width, this.height);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
autoCreateAttachmentTextures() {
|
|
34
|
+
this.colorAttachments = this.props.colorAttachments.map(attachment => {
|
|
35
|
+
if (typeof attachment === 'string') {
|
|
36
|
+
const texture = this.createColorTexture(attachment);
|
|
37
|
+
this.attachResource(texture);
|
|
38
|
+
return texture;
|
|
39
|
+
}
|
|
40
|
+
return attachment;
|
|
41
|
+
});
|
|
42
|
+
if (this.props.depthStencilAttachment) {
|
|
43
|
+
if (typeof this.props.depthStencilAttachment === 'string') {
|
|
44
|
+
const texture = this.createDepthStencilTexture(this.props.depthStencilAttachment);
|
|
45
|
+
this.attachResource(texture);
|
|
46
|
+
this.depthStencilAttachment = texture;
|
|
47
|
+
} else {
|
|
48
|
+
this.depthStencilAttachment = this.props.depthStencilAttachment;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
createColorTexture(format) {
|
|
53
|
+
return this.device.createTexture({
|
|
54
|
+
id: 'color-attachment',
|
|
55
|
+
usage: Texture.RENDER_ATTACHMENT,
|
|
56
|
+
format,
|
|
57
|
+
width: this.width,
|
|
58
|
+
height: this.height
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
createDepthStencilTexture(format) {
|
|
62
|
+
return this.device.createTexture({
|
|
63
|
+
id: 'depth-stencil-attachment',
|
|
64
|
+
usage: Texture.RENDER_ATTACHMENT,
|
|
65
|
+
format,
|
|
66
|
+
width: this.width,
|
|
67
|
+
height: this.height
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
resizeAttachments(width, height) {
|
|
71
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
72
|
+
if (this.colorAttachments[i]) {
|
|
73
|
+
const resizedTexture = this.device._createTexture({
|
|
74
|
+
...this.colorAttachments[i].props,
|
|
75
|
+
width,
|
|
76
|
+
height
|
|
77
|
+
});
|
|
78
|
+
this.destroyAttachedResource(this.colorAttachments[i]);
|
|
79
|
+
this.colorAttachments[i] = resizedTexture;
|
|
80
|
+
this.attachResource(resizedTexture);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (this.depthStencilAttachment) {
|
|
84
|
+
const resizedTexture = this.device._createTexture({
|
|
85
|
+
...this.depthStencilAttachment.props,
|
|
86
|
+
width,
|
|
87
|
+
height
|
|
88
|
+
});
|
|
89
|
+
this.destroyAttachedResource(this.depthStencilAttachment);
|
|
90
|
+
this.depthStencilAttachment = resizedTexture;
|
|
91
|
+
this.attachResource(resizedTexture);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
Framebuffer.defaultProps = {
|
|
96
|
+
...Resource.defaultProps,
|
|
97
|
+
width: 1,
|
|
98
|
+
height: 1,
|
|
99
|
+
colorAttachments: [],
|
|
100
|
+
depthStencilAttachment: null
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=framebuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framebuffer.js","names":["Resource","Texture","log","_Symbol$toStringTag","Symbol","toStringTag","Framebuffer","constructor","device","props","arguments","length","undefined","defaultProps","width","height","colorAttachments","depthStencilAttachment","resize","size","updateSize","Array","isArray","id","resizeAttachments","autoCreateAttachmentTextures","map","attachment","texture","createColorTexture","attachResource","createDepthStencilTexture","format","createTexture","usage","RENDER_ATTACHMENT","i","resizedTexture","_createTexture","destroyAttachedResource"],"sources":["../../../src/adapter/resources/framebuffer.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {ColorTextureFormat, DepthStencilTextureFormat, TextureFormat} from '../types/texture-formats';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\nimport {Texture} from './texture';\nimport {log} from '../../utils/log';\n\nexport type FramebufferProps = ResourceProps & {\n width?: number;\n height?: number;\n colorAttachments?: (Texture | ColorTextureFormat)[];\n depthStencilAttachment?: (Texture | DepthStencilTextureFormat) | null;\n};\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport abstract class Framebuffer extends Resource<FramebufferProps> {\n static override defaultProps: Required<FramebufferProps> = {\n ...Resource.defaultProps,\n width: 1,\n height: 1,\n colorAttachments: [], // ['rgba8unorm-unsized'],\n depthStencilAttachment: null // 'depth24plus-stencil8'\n }; \n\n override get [Symbol.toStringTag](): string {\n return 'Framebuffer';\n }\n\n /** Width of all attachments in this framebuffer */\n width: number;\n /** Height of all attachments in this framebuffer */\n height: number;\n /** Color attachments */\n colorAttachments: Texture[] = [];\n /** Depth-stencil attachment, if provided */\n depthStencilAttachment: Texture | null = null;\n\n constructor(device: Device, props: FramebufferProps = {}) {\n super(device, props, Framebuffer.defaultProps);\n this.width = this.props.width;\n this.height = this.props.height;\n\n // NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)\n // this.autoCreateAttachmentTextures();\n }\n\n /**\n * Resizes all attachments\n * @note resize() destroys existing textures (if size has changed).\n */\n resize(size: {width: number; height: number;}): void;\n resize(size: [width: number, height: number]): void;\n resize(): void;\n resize(size?: {width: number; height: number} | [width: number, height: number]): void {\n let updateSize: boolean = !size;\n if (size) {\n const [width, height] = Array.isArray(size) ? size : [size.width, size.height];\n updateSize = updateSize || height !== this.height || width !== this.width;\n this.width = width;\n this.height = height;\n }\n if (updateSize) {\n log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();\n this.resizeAttachments(this.width, this.height);\n }\n }\n\n // /** Returns fully populated attachment object. */\n // protected normalizeColorAttachment(\n // attachment: Texture | ColorTextureFormat\n // ): Required<ColorAttachment> {\n\n // const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n // clearValue: [0.0, 0.0, 0.0, 0.0],\n // loadOp: 'clear',\n // storeOp: 'store'\n // };\n\n // if (attachment instanceof Texture) {\n // return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};\n // }\n // if (typeof attachment === 'string') {\n // return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n // /** Wraps texture inside fully populated attachment object. */\n // protected normalizeDepthStencilAttachment(\n // attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat\n // ): Required<DepthStencilAttachment> {\n // const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n\n // depthClearValue: 1.0,\n // depthLoadOp: 'clear',\n // depthStoreOp: 'store',\n // depthReadOnly: false,\n\n // stencilClearValue: 0,\n // stencilLoadOp: 'clear',\n // stencilStoreOp: 'store',\n // stencilReadOnly: false\n // };\n\n // if (typeof attachment === 'string') {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer\n // if (attachment.handle || attachment instanceof Texture) {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};\n // }\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n /** Auto creates any textures */\n protected autoCreateAttachmentTextures(){\n this.colorAttachments = this.props.colorAttachments.map(attachment => {\n if (typeof attachment === 'string') {\n const texture = this.createColorTexture(attachment);\n this.attachResource(texture);\n return texture;\n }\n return attachment;\n });\n\n if (this.props.depthStencilAttachment) {\n if (typeof this.props.depthStencilAttachment === 'string') {\n const texture = this.createDepthStencilTexture(this.props.depthStencilAttachment);\n this.attachResource(texture);\n this.depthStencilAttachment = texture;\n } else {\n this.depthStencilAttachment = this.props.depthStencilAttachment;\n }\n }\n }\n\n /** Create a color texture */\n protected createColorTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'color-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height,\n });\n }\n\n /** Create depth stencil texture */\n protected createDepthStencilTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'depth-stencil-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n\n /**\n * Default implementation of resize\n * Creates new textures with correct size for all attachments.\n * and destroys existing textures if owned\n */\n protected resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({\n ...this.colorAttachments[i].props,\n width,\n height\n });\n this.destroyAttachedResource(this.colorAttachments[i]);\n this.colorAttachments[i] = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({\n ...this.depthStencilAttachment.props,\n width,\n height\n });\n this.destroyAttachedResource(this.depthStencilAttachment);\n this.depthStencilAttachment = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n /** Create a color attachment for WebGL *\n protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {\n return this.device._createTexture({\n id: `${this.id}-color`,\n data: null, // reserves texture memory, but texels are undefined\n format,\n // type: GL.UNSIGNED_BYTE,\n width: this.width,\n height: this.height,\n // Note: Mipmapping can be disabled by texture resource when we resize the texture\n // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n // behavior we always disable mipmaps.\n mipmaps: false,\n // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n // Use LINEAR so subpixel algos like fxaa work.\n // Set WRAP modes that support NPOT textures too.\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n }\n // parameters: {\n // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n // }\n });\n }\n */\n}\n"],"mappings":";SAKQA,QAAQ;AAAA,SACRC,OAAO;AAAA,SACPC,GAAG;AAAAC,mBAAA,GAsBKC,MAAM,CAACC,WAAW;AATlC,OAAO,MAAeC,WAAW,SAASN,QAAQ,CAAmB;EASnE,KAAAG,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAWAI,WAAWA,CAACC,MAAc,EAAgC;IAAA,IAA9BC,KAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,EAAEH,WAAW,CAACO,YAAY,CAAC;IAAC,KATjDC,KAAK;IAAA,KAELC,MAAM;IAAA,KAENC,gBAAgB,GAAc,EAAE;IAAA,KAEhCC,sBAAsB,GAAmB,IAAI;IAI3C,IAAI,CAACH,KAAK,GAAG,IAAI,CAACL,KAAK,CAACK,KAAK;IAC7B,IAAI,CAACC,MAAM,GAAG,IAAI,CAACN,KAAK,CAACM,MAAM;EAIjC;EASAG,MAAMA,CAACC,IAAwE,EAAQ;IACrF,IAAIC,UAAmB,GAAG,CAACD,IAAI;IAC/B,IAA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;MACrC;IACF;IAEA,IAAI,IAAI,CAACpB,sBAAsB,EAAE;MAC/B,MAAMoB,cAAc,GAAG,IAAI,CAAC7B,MAAM,CAAC8B,cAAc,CAAC;QAChD,GAAG,IAAI,CAACrB,sBAAsB,CAACR,KAAK;QACpCK,KAAK;QACLC;MACF,CAAC,CAAC;MACF,IAAI,CAACwB,uBAAuB,CAAC,IAAI,CAACtB,sBAAsB,CAAC;MACzD,IAAI,CAACA,sBAAsB,GAAGoB,cAAc;MAC5C,IAAI,CAACP,cAAc,CAACO,cAAc,CAAC;IACrC;EACF;AAiCF;AAjNsB/B,WAAW,CACfO,YAAY,GAA+B;EACzD,GAAGb,QAAQ,CAACa,YAAY;EACxBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,gBAAgB,EAAE,EAAE;EACpBC,sBAAsB,EAAE;AAC1B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Device } from '../device';
|
|
2
|
+
import type { RenderPassParameters } from '../types/parameters';
|
|
3
|
+
import { Resource, ResourceProps } from './resource';
|
|
4
|
+
import { Framebuffer } from './framebuffer';
|
|
5
|
+
import { NumberArray } from '../..';
|
|
6
|
+
/**
|
|
7
|
+
* Properties for a RenderPass instance is a required parameter to all draw calls.
|
|
8
|
+
*/
|
|
9
|
+
export type RenderPassProps = ResourceProps & {
|
|
10
|
+
/** Framebuffer specifies which textures to render into. Default gets framebuffer from canvas context. */
|
|
11
|
+
framebuffer?: Framebuffer | null;
|
|
12
|
+
/** Control viewport, scissor rect, blend constant and stencil ref */
|
|
13
|
+
parameters?: RenderPassParameters;
|
|
14
|
+
/** Clear value for color attachment, or `load` to preserve the previous value */
|
|
15
|
+
clearColor?: NumberArray | false;
|
|
16
|
+
/** Clear value for depth attachment, or `load` to preserve the previous value */
|
|
17
|
+
clearDepth?: number | false;
|
|
18
|
+
/** Clear value for stencil attachment, or `load` to preserve the previous value */
|
|
19
|
+
clearStencil?: number | false;
|
|
20
|
+
/** Indicates that the depth component is read only. */
|
|
21
|
+
depthReadOnly?: boolean;
|
|
22
|
+
/** Indicates that the stencil component is read only. */
|
|
23
|
+
stencilReadOnly?: boolean;
|
|
24
|
+
/** Whether to disable / discard the output of the rasterizer */
|
|
25
|
+
discard?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A RenderPass instance is a required parameter to all draw calls.
|
|
29
|
+
*
|
|
30
|
+
* It holds a combination of
|
|
31
|
+
* - render targets (specified via a framebuffer)
|
|
32
|
+
* - clear colors, read/write, discard information for the framebuffer attachments
|
|
33
|
+
* - a couple of mutable parameters ()
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class RenderPass extends Resource<RenderPassProps> {
|
|
36
|
+
/** Default properties for RenderPass */
|
|
37
|
+
static defaultProps: Required<RenderPassProps>;
|
|
38
|
+
get [Symbol.toStringTag](): string;
|
|
39
|
+
constructor(device: Device, props: RenderPassProps);
|
|
40
|
+
/** Call when rendering is done in this pass. */
|
|
41
|
+
abstract end(): void;
|
|
42
|
+
/**
|
|
43
|
+
* A small set of parameters can be changed between every draw call
|
|
44
|
+
* (viewport, scissorRect, blendColor, stencilReference)
|
|
45
|
+
*/
|
|
46
|
+
abstract setParameters(parameters: RenderPassParameters): void;
|
|
47
|
+
abstract pushDebugGroup(groupLabel: string): void;
|
|
48
|
+
abstract popDebugGroup(): void;
|
|
49
|
+
abstract insertDebugMarker(markerLabel: string): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=render-pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,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Symbol$toStringTag;
|
|
2
|
+
import { Resource } from "./resource.js";
|
|
3
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4
|
+
export class RenderPass extends Resource {
|
|
5
|
+
get [_Symbol$toStringTag]() {
|
|
6
|
+
return 'RenderPass';
|
|
7
|
+
}
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props, RenderPass.defaultProps);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
RenderPass.defaultProps = {
|
|
13
|
+
...Resource.defaultProps,
|
|
14
|
+
framebuffer: null,
|
|
15
|
+
parameters: undefined,
|
|
16
|
+
clearColor: [0, 0, 0, 0],
|
|
17
|
+
clearDepth: 1,
|
|
18
|
+
clearStencil: 0,
|
|
19
|
+
depthReadOnly: false,
|
|
20
|
+
stencilReadOnly: false,
|
|
21
|
+
discard: false
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=render-pass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-pass.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","RenderPass","constructor","device","props","defaultProps","framebuffer","parameters","undefined","clearColor","clearDepth","clearStencil","depthReadOnly","stencilReadOnly","discard"],"sources":["../../../src/adapter/resources/render-pass.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device'\nimport type { RenderPassParameters } from '../types/parameters';\n// import {Binding} from '../types/shader-layout';\nimport {Resource, ResourceProps} from './resource';\n// import {Buffer} from './buffer';\n// import {RenderPipeline} from './render-pipeline';\n// import {CommandEncoder} from './command-encoder';\nimport {Framebuffer} from './framebuffer';\nimport {NumberArray} from '../..';\n\n/**\n * Properties for a RenderPass instance is a required parameter to all draw calls.\n */\nexport type RenderPassProps = ResourceProps & {\n /** Framebuffer specifies which textures to render into. Default gets framebuffer from canvas context. */\n framebuffer?: Framebuffer | null;\n /** Control viewport, scissor rect, blend constant and stencil ref */\n parameters?: RenderPassParameters;\n /** Clear value for color attachment, or `load` to preserve the previous value */\n clearColor?: NumberArray | false;\n /** Clear value for depth attachment, or `load` to preserve the previous value */\n clearDepth?: number | false;\n /** Clear value for stencil attachment, or `load` to preserve the previous value */\n clearStencil?: number | false;\n /** Indicates that the depth component is read only. */\n depthReadOnly?: boolean;\n /** Indicates that the stencil component is read only. */\n stencilReadOnly?: boolean;\n /** Whether to disable / discard the output of the rasterizer */\n discard?: boolean; \n};\n\n/**\n * A RenderPass instance is a required parameter to all draw calls.\n * \n * It holds a combination of \n * - render targets (specified via a framebuffer)\n * - clear colors, read/write, discard information for the framebuffer attachments\n * - a couple of mutable parameters ()\n */\nexport abstract class RenderPass extends Resource<RenderPassProps> {\n\n /** Default properties for RenderPass */\n static override defaultProps: Required<RenderPassProps> = {\n ...Resource.defaultProps,\n framebuffer: null,\n parameters: undefined,\n clearColor: [0, 0, 0, 0],\n clearDepth: 1,\n clearStencil: 0,\n depthReadOnly: false,\n stencilReadOnly: false,\n discard: false\n };\n\n override get [Symbol.toStringTag](): string {\n return 'RenderPass';\n }\n\n constructor(device: Device, props: RenderPassProps) {\n super(device, props, RenderPass.defaultProps);\n }\n\n /** Call when rendering is done in this pass. */\n abstract end(): void;\n\n /** \n * A small set of parameters can be changed between every draw call \n * (viewport, scissorRect, blendColor, stencilReference) \n */\n abstract setParameters(parameters: RenderPassParameters): void;\n\n abstract pushDebugGroup(groupLabel: string): void;\n abstract popDebugGroup(): void;\n abstract insertDebugMarker(markerLabel: string): void;\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n\n // beginOcclusionQuery(queryIndex: number): void;\n // endOcclusionQuery(): void;\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n\n // In WebGPU the following methods are on the renderpass.\n // luma.gl keeps them on the pipeline for now\n\n /*\n setPipeline(pipeline: RenderPipeline): void {}\n\n setIndexBuffer(\n buffer: Buffer,\n indexFormat: 'uint16' | 'uint32',\n offset?: number,\n size?: number\n ): void {}\n\n abstract setVertexBuffer(slot: number, buffer: Buffer, offset: number): void;\n\n abstract setBindings(bindings: Record<string, Binding>): void;\n\n abstract setParameters(parameters: RenderPassParameters);\n\n draw(options: {\n vertexCount?: number; // Either vertexCount or indexCount must be provided\n indexCount?: number; // Activates indexed drawing (call setIndexBuffer())\n instanceCount?: number; //\n firstVertex?: number;\n firstIndex?: number; // requires device.features.has('indirect-first-instance')?\n firstInstance?: number;\n baseVertex?: number;\n }): void {}\n\n drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n */\n}\n"],"mappings":";SAIQA,QAAQ;AAAAC,mBAAA,GAoDAC,MAAM,CAACC,WAAW;AAflC,OAAO,MAAeC,UAAU,SAASJ,QAAQ,CAAkB;EAejE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,YAAY;EACrB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAAsB,EAAE;IAClD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,UAAU,CAACI,YAAY,CAAC;EAC/C;AAsDF;AA3EsBJ,UAAU,CAGdI,YAAY,GAA8B;EACxD,GAAGR,QAAQ,CAACQ,YAAY;EACxBC,WAAW,EAAE,IAAI;EACjBC,UAAU,EAAEC,SAAS;EACrBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACxBC,UAAU,EAAE,CAAC;EACbC,YAAY,EAAE,CAAC;EACfC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,OAAO,EAAE;AACX,CAAC"}
|