@luma.gl/core 9.0.11 → 9.1.0-alpha.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 +34 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +10 -8
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +20 -18
- package/dist/{lib → adapter}/luma.d.ts +2 -2
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/{lib → adapter}/luma.js +7 -7
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +111 -49
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +96 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +5 -16
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +2 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +266 -588
- package/dist/dist.min.js +4 -4
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.d.ts +2 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +1 -1
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +190 -411
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -36
- package/dist/init.js +1 -1
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +4 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +34 -31
- package/src/{lib → adapter}/luma.ts +9 -9
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +226 -77
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +8 -17
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +10 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +69 -84
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +14 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
luma.gl is provided under the MIT license
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 vis.gl contributors
|
|
4
|
+
|
|
5
|
+
This software includes parts initially developed by Uber and open sourced under MIT license.
|
|
6
|
+
Copyright (c) 2015 Uber Technologies, Inc.
|
|
7
|
+
|
|
8
|
+
This software includes parts of PhiloGL (https://github.com/philogb/philogl)
|
|
9
|
+
under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
|
|
10
|
+
|
|
11
|
+
This software includes adaptations of some postprocessing code from
|
|
12
|
+
THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
|
|
13
|
+
THREE.js parts Copyright © 2010-2018 three.js authors.
|
|
14
|
+
|
|
15
|
+
Additional attribution given in specific source files.
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in
|
|
25
|
+
all copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
33
|
+
THE SOFTWARE.
|
|
34
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Device } from "./device.js";
|
|
2
2
|
import type { Framebuffer } from "./resources/framebuffer.js";
|
|
3
|
+
import type { TextureFormat } from "../gpu-type-utils/texture-formats.js";
|
|
3
4
|
/** Properties for a CanvasContext */
|
|
4
5
|
export type CanvasContextProps = {
|
|
5
6
|
/** If canvas not supplied, will be created and added to the DOM. If string, will be looked up in the DOM */
|
|
@@ -36,6 +37,10 @@ export declare abstract class CanvasContext {
|
|
|
36
37
|
readonly htmlCanvas?: HTMLCanvasElement;
|
|
37
38
|
readonly offscreenCanvas?: OffscreenCanvas;
|
|
38
39
|
readonly type: 'html-canvas' | 'offscreen-canvas' | 'node';
|
|
40
|
+
/** Format of returned textures: "bgra8unorm", "rgba8unorm" */
|
|
41
|
+
abstract readonly format: TextureFormat;
|
|
42
|
+
/** Default stencil format for depth textures */
|
|
43
|
+
abstract readonly depthStencilFormat: TextureFormat;
|
|
39
44
|
width: number;
|
|
40
45
|
height: number;
|
|
41
46
|
readonly resizeObserver: ResizeObserver | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/canvas-context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,WAAW,EAAC,mCAAgC;
|
|
1
|
+
{"version":3,"file":"canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/canvas-context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,WAAW,EAAC,mCAAgC;AAEzD,OAAO,KAAK,EAAC,aAAa,EAAC,6CAA0C;AAKrE,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4GAA4G;IAC5G,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7D,0GAA0G;IAC1G,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC,oCAAoC;IACpC,KAAK,CAA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AAC,CAAwB;gBAE5C,KAAK,CAAC,EAAE,kBAAkB;IAqDtC,gFAAgF;IAChF,QAAQ,CAAC,qBAAqB,IAAI,WAAW;IAE7C;;;OAGG;IACH,mBAAmB,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM;IAoB/D;;;;;OAKG;IACH,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAkBhC,SAAS,IAAI,MAAM;IAKnB;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAY1B;;OAEG;IACH,iBAAiB,CACf,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,OAAc,GACtB;QACD,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB;IAMD;;;OAGG;IACH,mBAAmB,CACjB,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAM,GAC9C,IAAI;IAwDP,0GAA0G;IAC1G,oBAAoB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAUxC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KACpC,GAAG,IAAI;IAER,0DAA0D;IAC1D,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;IAEjC;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,EAAE,EAAE,MAAM;CAK7C"}
|
package/dist/adapter/device.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StatsManager } from "../utils/stats-manager.js";
|
|
2
|
-
import type { TextureFormat } from "
|
|
2
|
+
import type { TextureFormat } from "../gpu-type-utils//texture-formats.js";
|
|
3
3
|
import type { CanvasContext, CanvasContextProps } from "./canvas-context.js";
|
|
4
4
|
import type { BufferProps } from "./resources/buffer.js";
|
|
5
5
|
import { Buffer } from "./resources/buffer.js";
|
|
@@ -7,7 +7,7 @@ import type { RenderPipeline, RenderPipelineProps } from "./resources/render-pip
|
|
|
7
7
|
import type { ComputePipeline, ComputePipelineProps } from "./resources/compute-pipeline.js";
|
|
8
8
|
import type { Sampler, SamplerProps } from "./resources/sampler.js";
|
|
9
9
|
import type { Shader, ShaderProps } from "./resources/shader.js";
|
|
10
|
-
import type { Texture, TextureProps
|
|
10
|
+
import type { Texture, TextureProps } from "./resources/texture.js";
|
|
11
11
|
import type { ExternalTexture, ExternalTextureProps } from "./resources/external-texture.js";
|
|
12
12
|
import type { Framebuffer, FramebufferProps } from "./resources/framebuffer.js";
|
|
13
13
|
import type { RenderPass, RenderPassProps } from "./resources/render-pass.js";
|
|
@@ -105,7 +105,7 @@ export declare abstract class DeviceLimits {
|
|
|
105
105
|
export declare class DeviceFeatures {
|
|
106
106
|
protected features: Set<DeviceFeature>;
|
|
107
107
|
protected disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
|
|
108
|
-
constructor(features: DeviceFeature[], disabledFeatures: Partial<Record<DeviceFeature, boolean>>);
|
|
108
|
+
constructor(features: DeviceFeature[] | undefined, disabledFeatures: Partial<Record<DeviceFeature, boolean>>);
|
|
109
109
|
[Symbol.iterator](): IterableIterator<DeviceFeature>;
|
|
110
110
|
has(feature: DeviceFeature): boolean;
|
|
111
111
|
}
|
|
@@ -125,19 +125,21 @@ export type DeviceProps = {
|
|
|
125
125
|
requestMaxLimits?: boolean;
|
|
126
126
|
/** Error handling */
|
|
127
127
|
onError?: (error: Error) => unknown;
|
|
128
|
+
gl?: WebGL2RenderingContext | null;
|
|
128
129
|
/** WebGL: Instrument WebGL2RenderingContext (at the expense of performance) */
|
|
129
130
|
debug?: boolean;
|
|
130
131
|
/** Break on WebGL functions matching these strings */
|
|
131
132
|
break?: string[];
|
|
132
133
|
/** WebGL: Initialize the SpectorJS WebGL debugger */
|
|
133
134
|
spector?: boolean;
|
|
135
|
+
/** Set to false to disable WebGL state management instrumentation: TODO- Unclear if still supported / useful */
|
|
136
|
+
manageState?: boolean;
|
|
134
137
|
/** Initialize all features on startup */
|
|
135
138
|
initalizeFeatures?: boolean;
|
|
136
139
|
/** Disable specific features */
|
|
137
140
|
disabledFeatures?: Partial<Record<DeviceFeature, boolean>>;
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
gl?: WebGL2RenderingContext | null;
|
|
141
|
+
/** Never destroy cached shaders and pipelines */
|
|
142
|
+
_factoryDestroyPolicy?: 'unused' | 'never';
|
|
141
143
|
};
|
|
142
144
|
/**
|
|
143
145
|
* WebGPU Device/WebGL context abstraction
|
|
@@ -191,6 +193,8 @@ export declare abstract class Device {
|
|
|
191
193
|
* @note primarily intended for testing how application reacts to device loss
|
|
192
194
|
*/
|
|
193
195
|
loseDevice(): boolean;
|
|
196
|
+
/** Report error (normally for unhandled device errors) */
|
|
197
|
+
error(error: Error): void;
|
|
194
198
|
/** Default / primary canvas context. Can be null as WebGPU devices can be created without a CanvasContext */
|
|
195
199
|
abstract canvasContext: CanvasContext | null;
|
|
196
200
|
/** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */
|
|
@@ -204,8 +208,6 @@ export declare abstract class Device {
|
|
|
204
208
|
/** Create a texture */
|
|
205
209
|
abstract _createTexture(props: TextureProps): Texture;
|
|
206
210
|
createTexture(props: TextureProps): Texture;
|
|
207
|
-
createTexture(data: Promise<TextureData>): Texture;
|
|
208
|
-
createTexture(url: string): Texture;
|
|
209
211
|
/** Create a temporary texture view of a video source */
|
|
210
212
|
abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;
|
|
211
213
|
/** Create a sampler */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter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AAA;KAAC,GAAG,IAAI;IAIhG,oEAAoE;IACpE,UAAU,IAAI,IAAI;IAIlB,SAAS,EAAE,MAAM,CAAK;IAEtB,kEAAkE;IAClE,kBAAkB,IAAI,MAAM;IAM5B,qCAAqC;IACrC,OAAO,CAAC,KAAK,EAAE,KAAK;IAMpB,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW;CAqB3F"}
|
package/dist/adapter/device.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { VERSION } from "../init.js";
|
|
5
5
|
import { lumaStats } from "../utils/stats-manager.js";
|
|
6
6
|
import { log } from "../utils/log.js";
|
|
7
|
-
import { uid } from "../utils/
|
|
7
|
+
import { uid } from "../utils/uid.js";
|
|
8
8
|
import { Buffer } from "./resources/buffer.js";
|
|
9
|
-
import { isTextureFormatCompressed } from "
|
|
9
|
+
import { isTextureFormatCompressed } from "../gpu-type-utils/decode-texture-format.js";
|
|
10
10
|
/** Limits for a device (max supported sizes of resources, max number of bindings etc) */
|
|
11
11
|
export class DeviceLimits {
|
|
12
12
|
}
|
|
@@ -22,7 +22,7 @@ export class DeviceFeatures {
|
|
|
22
22
|
yield* this.features;
|
|
23
23
|
}
|
|
24
24
|
has(feature) {
|
|
25
|
-
return !this.disabledFeatures[feature] && this.features.has(feature);
|
|
25
|
+
return !this.disabledFeatures?.[feature] && this.features.has(feature);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -37,14 +37,9 @@ export class Device {
|
|
|
37
37
|
width: 800, // width are height are only used by headless gl
|
|
38
38
|
height: 600,
|
|
39
39
|
requestMaxLimits: true,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// TODO - Change these after confirming things work as expected
|
|
44
|
-
initalizeFeatures: true,
|
|
45
|
-
disabledFeatures: {
|
|
46
|
-
'compilation-status-async-webgl': true
|
|
47
|
-
},
|
|
40
|
+
// Callbacks
|
|
41
|
+
onError: (error) => log.error(error.message),
|
|
42
|
+
gl: null,
|
|
48
43
|
// alpha: undefined,
|
|
49
44
|
// depth: undefined,
|
|
50
45
|
// stencil: undefined,
|
|
@@ -52,9 +47,15 @@ export class Device {
|
|
|
52
47
|
// premultipliedAlpha: undefined,
|
|
53
48
|
// preserveDrawingBuffer: undefined,
|
|
54
49
|
// failIfMajorPerformanceCaveat: undefined
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
|
|
50
|
+
debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)
|
|
51
|
+
spector: Boolean(log.get('spector')), // Initialize the SpectorJS WebGL debugger
|
|
52
|
+
break: log.get('break') || [],
|
|
53
|
+
// TODO - Change these after confirming things work as expected
|
|
54
|
+
initalizeFeatures: true,
|
|
55
|
+
disabledFeatures: {
|
|
56
|
+
'compilation-status-async-webgl': true
|
|
57
|
+
},
|
|
58
|
+
_factoryDestroyPolicy: 'unused'
|
|
58
59
|
};
|
|
59
60
|
get [Symbol.toStringTag]() {
|
|
60
61
|
return 'Device';
|
|
@@ -86,6 +87,10 @@ export class Device {
|
|
|
86
87
|
loseDevice() {
|
|
87
88
|
return false;
|
|
88
89
|
}
|
|
90
|
+
/** Report error (normally for unhandled device errors) */
|
|
91
|
+
error(error) {
|
|
92
|
+
this.props.onError(error);
|
|
93
|
+
}
|
|
89
94
|
/** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */
|
|
90
95
|
getCanvasContext() {
|
|
91
96
|
if (!this.canvasContext) {
|
|
@@ -93,11 +98,8 @@ export class Device {
|
|
|
93
98
|
}
|
|
94
99
|
return this.canvasContext;
|
|
95
100
|
}
|
|
101
|
+
// createTexture(data: Promise<TextureData>): Texture;
|
|
96
102
|
createTexture(props) {
|
|
97
|
-
// Signature: new Texture2D(gl, url | Promise)
|
|
98
|
-
if (props instanceof Promise || typeof props === 'string') {
|
|
99
|
-
props = { data: props };
|
|
100
|
-
}
|
|
101
103
|
return this._createTexture(props);
|
|
102
104
|
}
|
|
103
105
|
createCommandEncoder(props = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Log } from '@probe.gl/log';
|
|
2
|
-
import type { DeviceProps } from "
|
|
3
|
-
import { Device } from "
|
|
2
|
+
import type { DeviceProps } from "./device.js";
|
|
3
|
+
import { Device } from "./device.js";
|
|
4
4
|
import { StatsManager } from "../utils/stats-manager.js";
|
|
5
5
|
/** Properties for creating a new device */
|
|
6
6
|
export type CreateDeviceProps = DeviceProps & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luma.d.ts","sourceRoot":"","sources":["../../src/adapter/luma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,EAAC,WAAW,EAAC,oBAAiB;AAC1C,OAAO,EAAC,MAAM,EAAC,oBAAiB;AAChC,OAAO,EAAC,YAAY,EAAC,kCAA+B;AAMpD,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,yFAAyF;IACzF,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,gBAAgB,CAAC;IACzD,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,CAAC;AAEF,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,wDAAwD;IACxD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,IAAI;IACf,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAI9C;IAEF,mCAAmC;IACnC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAa;IAEvC,iBAAiB;IACjB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAO;IAEtB,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,GAAG,EAAE,GAAyB,IAAI;IAMxE,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAKtC,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAUtC,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI5D,kFAAkF;WACrE,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCpE,wCAAwC;WAC3B,YAAY,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgDzE,MAAM,CAAC,aAAa,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;CAsBpD"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { Device } from "
|
|
4
|
+
import { Device } from "./device.js";
|
|
5
5
|
import { lumaStats } from "../utils/stats-manager.js";
|
|
6
6
|
import { log } from "../utils/log.js";
|
|
7
|
-
import { assert } from "../utils/assert.js";
|
|
8
7
|
const deviceMap = new Map();
|
|
9
8
|
/**
|
|
10
9
|
* Entry point to the luma.gl GPU abstraction
|
|
@@ -23,7 +22,6 @@ export class luma {
|
|
|
23
22
|
static log = log;
|
|
24
23
|
static registerDevices(deviceClasses /* : typeof Device */) {
|
|
25
24
|
for (const deviceClass of deviceClasses) {
|
|
26
|
-
assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);
|
|
27
25
|
deviceMap.set(deviceClass.type, deviceClass);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
@@ -39,7 +37,7 @@ export class luma {
|
|
|
39
37
|
.map(Device => Device.type));
|
|
40
38
|
}
|
|
41
39
|
static setDefaultDeviceProps(props) {
|
|
42
|
-
Object.assign(
|
|
40
|
+
Object.assign(luma.defaultProps, props);
|
|
43
41
|
}
|
|
44
42
|
/** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
|
|
45
43
|
static async attachDevice(props) {
|
|
@@ -69,20 +67,22 @@ export class luma {
|
|
|
69
67
|
}
|
|
70
68
|
/** Creates a device. Asynchronously. */
|
|
71
69
|
static async createDevice(props = {}) {
|
|
72
|
-
props = { ...
|
|
70
|
+
props = { ...luma.defaultProps, ...props };
|
|
73
71
|
if (props.gl) {
|
|
74
72
|
props.type = 'webgl';
|
|
75
73
|
}
|
|
76
74
|
const devices = getDeviceMap(props.devices) || deviceMap;
|
|
75
|
+
let WebGPUDevice;
|
|
76
|
+
let WebGLDevice;
|
|
77
77
|
switch (props.type) {
|
|
78
78
|
case 'webgpu':
|
|
79
|
-
|
|
79
|
+
WebGPUDevice = devices.get('webgpu');
|
|
80
80
|
if (WebGPUDevice) {
|
|
81
81
|
return await WebGPUDevice.create(props);
|
|
82
82
|
}
|
|
83
83
|
break;
|
|
84
84
|
case 'webgl':
|
|
85
|
-
|
|
85
|
+
WebGLDevice = devices.get('webgl');
|
|
86
86
|
if (WebGLDevice) {
|
|
87
87
|
return await WebGLDevice.create(props);
|
|
88
88
|
}
|
|
@@ -65,16 +65,16 @@ export class Buffer extends Resource {
|
|
|
65
65
|
debugData = new ArrayBuffer(0);
|
|
66
66
|
/** This doesn't handle partial non-zero offset updates correctly */
|
|
67
67
|
_setDebugData(data, byteOffset, byteLength) {
|
|
68
|
-
const
|
|
68
|
+
const arrayBuffer = ArrayBuffer.isView(data) ? data.buffer : data;
|
|
69
69
|
const debugDataLength = Math.min(data ? data.byteLength : byteLength, Buffer.DEBUG_DATA_MAX_LENGTH);
|
|
70
|
-
if (
|
|
70
|
+
if (arrayBuffer === null) {
|
|
71
71
|
this.debugData = new ArrayBuffer(debugDataLength);
|
|
72
72
|
}
|
|
73
|
-
else if (byteOffset === 0 && byteLength ===
|
|
74
|
-
this.debugData =
|
|
73
|
+
else if (byteOffset === 0 && byteLength === arrayBuffer.byteLength) {
|
|
74
|
+
this.debugData = arrayBuffer.slice(0, debugDataLength);
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
this.debugData =
|
|
77
|
+
this.debugData = arrayBuffer.slice(byteOffset, byteOffset + debugDataLength);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -23,6 +23,8 @@ export declare abstract class ComputePipeline extends Resource<ComputePipelinePr
|
|
|
23
23
|
static defaultProps: Required<ComputePipelineProps>;
|
|
24
24
|
get [Symbol.toStringTag](): string;
|
|
25
25
|
hash: string;
|
|
26
|
+
/** The merged shader layout */
|
|
27
|
+
shaderLayout: ComputeShaderLayout;
|
|
26
28
|
constructor(device: Device, props: ComputePipelineProps);
|
|
27
29
|
/**
|
|
28
30
|
* @todo Use renderpass.setBindings() ?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,KAAK,EAAC,mBAAmB,EAAE,OAAO,EAAC,kCAA+B;AACzE,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AAErC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC3C,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;
|
|
1
|
+
{"version":3,"file":"compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,KAAK,EAAC,mBAAmB,EAAE,OAAO,EAAC,kCAA+B;AACzE,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AAErC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC3C,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;IAClB,+BAA+B;IAC/B,YAAY,EAAE,mBAAmB,CAAC;gBAEtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;IAKvD;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAC9D"}
|
|
@@ -17,7 +17,10 @@ export class ComputePipeline extends Resource {
|
|
|
17
17
|
return 'ComputePipeline';
|
|
18
18
|
}
|
|
19
19
|
hash = '';
|
|
20
|
+
/** The merged shader layout */
|
|
21
|
+
shaderLayout;
|
|
20
22
|
constructor(device, props) {
|
|
21
23
|
super(device, props, ComputePipeline.defaultProps);
|
|
24
|
+
this.shaderLayout = props.shaderLayout;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Device } from "../device.js";
|
|
2
2
|
import { Resource, ResourceProps } from "./resource.js";
|
|
3
3
|
export type ExternalTextureProps = ResourceProps & {
|
|
4
|
-
source: HTMLVideoElement
|
|
4
|
+
source: HTMLVideoElement;
|
|
5
5
|
colorSpace?: 'srgb';
|
|
6
6
|
};
|
|
7
7
|
export declare abstract class ExternalTexture extends Resource<ExternalTextureProps> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/external-texture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/external-texture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AACF,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,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAGxD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from "
|
|
1
|
+
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
2
2
|
import type { Device } from "../device.js";
|
|
3
3
|
import { Resource, ResourceProps } from "./resource.js";
|
|
4
4
|
import { Texture } from "./texture.js";
|
|
@@ -21,9 +21,9 @@ export declare abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
21
21
|
/** Height of all attachments in this framebuffer */
|
|
22
22
|
height: number;
|
|
23
23
|
/** Color attachments */
|
|
24
|
-
colorAttachments: TextureView[];
|
|
24
|
+
abstract colorAttachments: TextureView[];
|
|
25
25
|
/** Depth-stencil attachment, if provided */
|
|
26
|
-
depthStencilAttachment: TextureView | null;
|
|
26
|
+
abstract depthStencilAttachment: TextureView | null;
|
|
27
27
|
constructor(device: Device, props?: FramebufferProps);
|
|
28
28
|
/**
|
|
29
29
|
* Resizes all attachments
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,
|
|
1
|
+
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,gDAA6C;AAC9C,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,EAAC,OAAO,EAAC,qBA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AC,MAAM,EAAE,aAAa,GAAG,OAAO;IAUnE;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAyBjE"}
|
|
@@ -23,16 +23,10 @@ export class Framebuffer extends Resource {
|
|
|
23
23
|
width;
|
|
24
24
|
/** Height of all attachments in this framebuffer */
|
|
25
25
|
height;
|
|
26
|
-
/** Color attachments */
|
|
27
|
-
colorAttachments = [];
|
|
28
|
-
/** Depth-stencil attachment, if provided */
|
|
29
|
-
depthStencilAttachment = null;
|
|
30
26
|
constructor(device, props = {}) {
|
|
31
27
|
super(device, props, Framebuffer.defaultProps);
|
|
32
28
|
this.width = this.props.width;
|
|
33
29
|
this.height = this.props.height;
|
|
34
|
-
// NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)
|
|
35
|
-
// this.autoCreateAttachmentTextures();
|
|
36
30
|
}
|
|
37
31
|
resize(size) {
|
|
38
32
|
let updateSize = !size;
|
|
@@ -107,7 +101,7 @@ export class Framebuffer extends Resource {
|
|
|
107
101
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
108
102
|
if (this.colorAttachments[i]) {
|
|
109
103
|
const resizedTexture = this.device._createTexture({
|
|
110
|
-
...this.colorAttachments[i].props,
|
|
104
|
+
...this.colorAttachments[i].texture.props,
|
|
111
105
|
width,
|
|
112
106
|
height
|
|
113
107
|
});
|
|
@@ -118,7 +112,7 @@ export class Framebuffer extends Resource {
|
|
|
118
112
|
}
|
|
119
113
|
if (this.depthStencilAttachment) {
|
|
120
114
|
const resizedTexture = this.device._createTexture({
|
|
121
|
-
...this.depthStencilAttachment.props,
|
|
115
|
+
...this.depthStencilAttachment.texture.props,
|
|
122
116
|
width,
|
|
123
117
|
height
|
|
124
118
|
});
|
|
@@ -128,78 +122,3 @@ export class Framebuffer extends Resource {
|
|
|
128
122
|
}
|
|
129
123
|
}
|
|
130
124
|
}
|
|
131
|
-
// TODO - remove if not needed
|
|
132
|
-
// Create a color attachment for WebGL *
|
|
133
|
-
// protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {
|
|
134
|
-
// return this.device._createTexture({
|
|
135
|
-
// id: `${this.id}-color`,
|
|
136
|
-
// data: null, // reserves texture memory, but texels are undefined
|
|
137
|
-
// format,
|
|
138
|
-
// // type: GL.UNSIGNED_BYTE,
|
|
139
|
-
// width: this.width,
|
|
140
|
-
// height: this.height,
|
|
141
|
-
// // Note: Mipmapping can be disabled by texture resource when we resize the texture
|
|
142
|
-
// // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
|
|
143
|
-
// // behavior we always disable mipmaps.
|
|
144
|
-
// mipmaps: false,
|
|
145
|
-
// // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
|
|
146
|
-
// // Use LINEAR so subpixel algos like fxaa work.
|
|
147
|
-
// // Set WRAP modes that support NPOT textures too.
|
|
148
|
-
// sampler: {
|
|
149
|
-
// minFilter: 'linear',
|
|
150
|
-
// magFilter: 'linear',
|
|
151
|
-
// addressModeU: 'clamp-to-edge',
|
|
152
|
-
// addressModeV: 'clamp-to-edge'
|
|
153
|
-
// }
|
|
154
|
-
// // parameters: {
|
|
155
|
-
// // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
|
|
156
|
-
// // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
157
|
-
// // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
158
|
-
// // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
|
|
159
|
-
// // }
|
|
160
|
-
// });
|
|
161
|
-
// }
|
|
162
|
-
// /** Returns fully populated attachment object. */
|
|
163
|
-
// protected normalizeColorAttachment(
|
|
164
|
-
// attachment: Texture | ColorTextureFormat
|
|
165
|
-
// ): Required<ColorAttachment> {
|
|
166
|
-
// const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {
|
|
167
|
-
// texture: undefined!,
|
|
168
|
-
// format: undefined!,
|
|
169
|
-
// clearValue: [0.0, 0.0, 0.0, 0.0],
|
|
170
|
-
// loadOp: 'clear',
|
|
171
|
-
// storeOp: 'store'
|
|
172
|
-
// };
|
|
173
|
-
// if (attachment instanceof Texture) {
|
|
174
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};
|
|
175
|
-
// }
|
|
176
|
-
// if (typeof attachment === 'string') {
|
|
177
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};
|
|
178
|
-
// }
|
|
179
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};
|
|
180
|
-
// }
|
|
181
|
-
// /** Wraps texture inside fully populated attachment object. */
|
|
182
|
-
// protected normalizeDepthStencilAttachment(
|
|
183
|
-
// attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat
|
|
184
|
-
// ): Required<DepthStencilAttachment> {
|
|
185
|
-
// const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {
|
|
186
|
-
// texture: undefined!,
|
|
187
|
-
// format: undefined!,
|
|
188
|
-
// depthClearValue: 1.0,
|
|
189
|
-
// depthLoadOp: 'clear',
|
|
190
|
-
// depthStoreOp: 'store',
|
|
191
|
-
// depthReadOnly: false,
|
|
192
|
-
// stencilClearValue: 0,
|
|
193
|
-
// stencilLoadOp: 'clear',
|
|
194
|
-
// stencilStoreOp: 'store',
|
|
195
|
-
// stencilReadOnly: false
|
|
196
|
-
// };
|
|
197
|
-
// if (typeof attachment === 'string') {
|
|
198
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};
|
|
199
|
-
// }
|
|
200
|
-
// // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer
|
|
201
|
-
// if (attachment.handle || attachment instanceof Texture) {
|
|
202
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};
|
|
203
|
-
// }
|
|
204
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};
|
|
205
|
-
// }
|
|
@@ -14,6 +14,8 @@ export type RenderPassProps = ResourceProps & {
|
|
|
14
14
|
parameters?: RenderPassParameters;
|
|
15
15
|
/** Clear value for color attachment, or `load` to preserve the previous value */
|
|
16
16
|
clearColor?: NumberArray | false;
|
|
17
|
+
/** Whether to disable / discard the output of the rasterizer */
|
|
18
|
+
discard?: boolean;
|
|
17
19
|
/** Clear value for depth attachment, or `load` to preserve the previous value */
|
|
18
20
|
clearDepth?: number | false;
|
|
19
21
|
/** Clear value for stencil attachment, or `load` to preserve the previous value */
|
|
@@ -22,8 +24,6 @@ export type RenderPassProps = ResourceProps & {
|
|
|
22
24
|
depthReadOnly?: boolean;
|
|
23
25
|
/** Indicates that the stencil component is read only. */
|
|
24
26
|
stencilReadOnly?: boolean;
|
|
25
|
-
/** Whether to disable / discard the output of the rasterizer */
|
|
26
|
-
discard?: boolean;
|
|
27
27
|
/** QuerySet to write begin/end timestamps to */
|
|
28
28
|
occlusionQuerySet?: QuerySet;
|
|
29
29
|
/** QuerySet to write begin/end timestamps to */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,oBAAoB,EAAC,+BAA4B;AAE9D,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,EAAC,WAAW,EAAC,yBAAsB;AAC1C,OAAO,EAAC,WAAW,EAAC,uBAAoB;AACxC,OAAO,EAAC,QAAQ,EAAC,uBAAoB;AAErC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,yGAAyG;IACzG,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,qEAAqE;IACrE,UAAU,CAAC,EAAE,oBAA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C,eAAe,CAAC,CAerD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAIlD,gDAAgD;IAChD,QAAQ,CAAC,GAAG,IAAI,IAAI;IAEpB,wGAAwG;IACxG,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAI9D,gIAAgI;IAChI,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACtD,2FAA2F;IAC3F,QAAQ,CAAC,iBAAiB,IAAI,IAAI;IAElC,kEAAkE;IAClE,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACjD,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,IAAI,IAAI;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CActD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Device } from "../device.js";
|
|
2
|
-
import type { UniformValue } from "../types/
|
|
2
|
+
import type { UniformValue } from "../types/uniforms.js";
|
|
3
3
|
import type { PrimitiveTopology, RenderPipelineParameters } from "../types/parameters.js";
|
|
4
4
|
import type { ShaderLayout, Binding } from "../types/shader-layout.js";
|
|
5
5
|
import type { BufferLayout } from "../types/buffer-layout.js";
|
|
@@ -23,10 +23,7 @@ export type RenderPipelineProps = ResourceProps & {
|
|
|
23
23
|
fsConstants?: Record<string, number>;
|
|
24
24
|
/** Describes the attributes and bindings exposed by the pipeline shader(s). */
|
|
25
25
|
shaderLayout?: ShaderLayout | null;
|
|
26
|
-
/**
|
|
27
|
-
* Describes the buffers accepted by this pipeline and how they are mapped to shader attributes.
|
|
28
|
-
* A default mapping of one buffer per attribute is always created.
|
|
29
|
-
*/
|
|
26
|
+
/** Describes the buffers accepted by this pipeline and how they are mapped to shader attributes. */
|
|
30
27
|
bufferLayout?: BufferLayout[];
|
|
31
28
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
32
29
|
topology?: PrimitiveTopology;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,YAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,YAAY,EAAC,6BAA0B;AACpD,OAAO,KAAK,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,+BAA4B;AACrF,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAC,kCAA+B;AAClE,OAAO,KAAK,EAAC,YAAY,EAAC,kCAA+B;AAEzD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,yBAAsB;AAC9C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EAAC,iBAAiB,EAAC,gCAA6B;AAEvD,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAGhD,6BAA6B;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,+BAA+B;IAC/B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uGAA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