@luma.gl/core 9.0.0-beta.4 → 9.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts +4 -4
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +1 -1
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js +138 -106
- package/dist/adapter/canvas-context.d.ts +2 -2
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/canvas-context.js +306 -232
- package/dist/adapter/device.d.ts +112 -69
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +145 -94
- package/dist/adapter/resources/buffer.d.ts +3 -3
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js +70 -56
- package/dist/adapter/resources/command-buffer.d.ts +2 -2
- package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/command-buffer.js +15 -12
- package/dist/adapter/resources/command-encoder.d.ts +22 -7
- package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/command-encoder.js +16 -16
- package/dist/adapter/resources/compute-pass.d.ts +16 -5
- package/dist/adapter/resources/compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pass.js +15 -12
- package/dist/adapter/resources/compute-pipeline.d.ts +4 -4
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +20 -17
- package/dist/adapter/resources/external-texture.d.ts +2 -2
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +14 -14
- package/dist/adapter/resources/framebuffer.d.ts +9 -8
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +191 -91
- package/dist/adapter/resources/query-set.d.ts +26 -0
- package/dist/adapter/resources/query-set.d.ts.map +1 -0
- package/dist/adapter/resources/query-set.js +18 -0
- package/dist/adapter/resources/render-pass.d.ts +22 -9
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pass.js +34 -20
- package/dist/adapter/resources/render-pipeline.d.ts +22 -18
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +50 -33
- package/dist/adapter/resources/resource.d.ts +1 -1
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +133 -92
- package/dist/adapter/resources/sampler.d.ts +3 -3
- package/dist/adapter/resources/sampler.d.ts.map +1 -1
- package/dist/adapter/resources/sampler.js +24 -23
- package/dist/adapter/resources/shader.d.ts +8 -6
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +98 -74
- package/dist/adapter/resources/texture-view.d.ts +32 -0
- package/dist/adapter/resources/texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/texture-view.js +24 -0
- package/dist/adapter/resources/texture.d.ts +10 -15
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +54 -42
- package/dist/adapter/resources/transform-feedback.d.ts +7 -7
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/transform-feedback.js +15 -14
- package/dist/adapter/resources/vertex-array.d.ts +9 -9
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +36 -20
- package/dist/adapter/type-utils/decode-attribute-type.d.ts +2 -2
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-attribute-type.js +59 -52
- package/dist/adapter/type-utils/decode-data-type.d.ts +1 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-data-type.js +39 -35
- package/dist/adapter/type-utils/decode-shader-types.d.ts +1 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-shader-types.js +36 -96
- package/dist/adapter/type-utils/decode-texture-format.d.ts +6 -2
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-texture-format.js +172 -92
- package/dist/adapter/type-utils/decode-vertex-format.d.ts +1 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-vertex-format.js +30 -22
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts +2 -2
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +1 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.js +72 -65
- package/dist/adapter/type-utils/wgsl-utils.d.ts +1 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +1 -1
- package/dist/adapter/type-utils/wgsl-utils.js +17 -13
- package/dist/adapter/types/accessor.d.ts +1 -1
- package/dist/adapter/types/accessor.d.ts.map +1 -1
- package/dist/adapter/types/accessor.js +3 -1
- 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/buffer-layout.js +3 -1
- package/dist/adapter/types/parameters.d.ts +28 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/parameters.js +46 -26
- package/dist/adapter/types/shader-layout.d.ts +8 -7
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.js +3 -1
- package/dist/adapter/types/shader-types.d.ts.map +1 -1
- package/dist/adapter/types/shader-types.js +3 -1
- package/dist/adapter/types/texture-formats.d.ts +2 -2
- package/dist/adapter/types/texture-formats.d.ts.map +1 -1
- package/dist/adapter/types/texture-formats.js +3 -1
- package/dist/adapter/types/types.d.ts +4 -4
- package/dist/adapter/types/types.d.ts.map +1 -1
- package/dist/adapter/types/types.js +3 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/types/vertex-formats.js +3 -1
- package/dist/dist.dev.js +614 -406
- package/dist/index.cjs +344 -369
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +80 -76
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -5
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +30 -17
- package/dist/lib/compiler-log/compiler-message.d.ts.map +1 -1
- package/dist/lib/compiler-log/compiler-message.js +3 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts +1 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +1 -1
- package/dist/lib/compiler-log/format-compiler-log.js +69 -48
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +1 -1
- package/dist/lib/compiler-log/get-shader-info.js +23 -19
- package/dist/lib/luma.d.ts +3 -3
- package/dist/lib/luma.d.ts.map +1 -1
- package/dist/lib/luma.js +60 -51
- package/dist/lib/uniforms/uniform-block.d.ts +3 -4
- package/dist/lib/uniforms/uniform-block.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-block.js +52 -42
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts +2 -2
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-buffer-layout.js +86 -66
- package/dist/lib/uniforms/uniform-store.d.ts +6 -6
- package/dist/lib/uniforms/uniform-store.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-store.js +111 -75
- package/dist/lib/uniforms/uniform.d.ts +2 -2
- package/dist/lib/uniforms/uniform.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform.js +15 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -3
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +25 -22
- package/dist/utils/array-utils-flat.d.ts +1 -1
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +29 -28
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils/assert.js +8 -4
- package/dist/utils/cast.d.ts.map +1 -1
- package/dist/utils/cast.js +5 -2
- package/dist/utils/check-props.d.ts.map +1 -1
- package/dist/utils/check-props.js +30 -26
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +42 -32
- package/dist/utils/format-value.d.ts +1 -1
- package/dist/utils/format-value.d.ts.map +1 -1
- package/dist/utils/format-value.js +36 -39
- package/dist/utils/is-array.d.ts +1 -1
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +20 -6
- package/dist/utils/load-file.d.ts.map +1 -1
- package/dist/utils/load-file.js +63 -37
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/log.js +5 -4
- package/dist/utils/random.d.ts.map +1 -1
- package/dist/utils/random.js +13 -9
- package/dist/utils/request-animation-frame.d.ts.map +1 -1
- package/dist/utils/request-animation-frame.js +12 -3
- package/dist/utils/stats-manager.d.ts.map +1 -1
- package/dist/utils/stats-manager.js +16 -14
- package/dist/utils/stub-methods.d.ts.map +1 -1
- package/dist/utils/stub-methods.js +15 -12
- package/dist/utils/utils.d.ts +0 -6
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +21 -15
- package/dist.min.js +8 -23
- package/package.json +6 -6
- package/src/adapter/attribute-utils/get-attribute-from-layouts.ts +6 -5
- package/src/adapter/canvas-context.ts +8 -5
- package/src/adapter/device.ts +181 -127
- package/src/adapter/resources/buffer.ts +19 -6
- package/src/adapter/resources/command-buffer.ts +7 -5
- package/src/adapter/resources/command-encoder.ts +40 -29
- package/src/adapter/resources/compute-pass.ts +23 -9
- package/src/adapter/resources/compute-pipeline.ts +5 -2
- package/src/adapter/resources/external-texture.ts +8 -2
- package/src/adapter/resources/framebuffer.ts +115 -102
- package/src/adapter/resources/query-set.ts +41 -0
- package/src/adapter/resources/render-pass.ts +48 -54
- package/src/adapter/resources/render-pipeline.ts +22 -9
- package/src/adapter/resources/resource.ts +13 -10
- package/src/adapter/resources/sampler.ts +4 -3
- package/src/adapter/resources/shader.ts +19 -7
- package/src/adapter/resources/texture-view.ts +51 -0
- package/src/adapter/resources/texture.ts +28 -26
- package/src/adapter/resources/transform-feedback.ts +6 -3
- package/src/adapter/resources/vertex-array.ts +11 -3
- package/src/adapter/type-utils/decode-attribute-type.ts +24 -10
- package/src/adapter/type-utils/decode-data-type.ts +5 -1
- package/src/adapter/type-utils/decode-shader-types.ts +12 -9
- package/src/adapter/type-utils/decode-texture-format.ts +28 -12
- package/src/adapter/type-utils/decode-vertex-format.ts +4 -0
- package/src/adapter/type-utils/vertex-format-from-attribute.ts +4 -1
- package/src/adapter/type-utils/wgsl-utils.ts +6 -2
- package/src/adapter/types/accessor.ts +5 -2
- package/src/adapter/types/buffer-layout.ts +11 -8
- package/src/adapter/types/parameters.ts +98 -93
- package/src/adapter/types/shader-layout.ts +11 -2
- package/src/adapter/types/shader-types.ts +2 -1
- package/src/adapter/types/texture-formats.ts +130 -129
- package/src/adapter/types/types.ts +12 -6
- package/src/adapter/types/vertex-formats.ts +4 -5
- package/src/index.ts +30 -15
- package/src/init.ts +10 -4
- package/src/lib/compiler-log/compiler-message.ts +3 -2
- package/src/lib/compiler-log/format-compiler-log.ts +8 -3
- package/src/lib/compiler-log/get-shader-info.ts +2 -1
- package/src/lib/luma.ts +13 -8
- package/src/lib/uniforms/uniform-block.ts +7 -3
- package/src/lib/uniforms/uniform-buffer-layout.ts +16 -10
- package/src/lib/uniforms/uniform-store.ts +4 -1
- package/src/lib/uniforms/uniform.ts +12 -6
- package/src/types.ts +7 -3
- package/src/utils/array-equal.ts +2 -1
- package/src/utils/array-utils-flat.ts +9 -3
- package/src/utils/assert.ts +4 -0
- package/src/utils/cast.ts +4 -0
- package/src/utils/check-props.ts +9 -1
- package/src/utils/deep-equal.ts +4 -0
- package/src/utils/format-value.ts +9 -2
- package/src/utils/is-array.ts +4 -0
- package/src/utils/load-file.ts +5 -3
- package/src/utils/log.ts +4 -0
- package/src/utils/random.ts +4 -0
- package/src/utils/request-animation-frame.ts +4 -0
- package/src/utils/stats-manager.ts +6 -2
- package/src/utils/stub-methods.ts +10 -1
- package/src/utils/utils.ts +2 -10
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js.map +0 -1
- package/dist/adapter/canvas-context.js.map +0 -1
- package/dist/adapter/device.js.map +0 -1
- package/dist/adapter/resources/buffer.js.map +0 -1
- package/dist/adapter/resources/command-buffer.js.map +0 -1
- package/dist/adapter/resources/command-encoder.js.map +0 -1
- package/dist/adapter/resources/compute-pass.js.map +0 -1
- package/dist/adapter/resources/compute-pipeline.js.map +0 -1
- package/dist/adapter/resources/external-texture.js.map +0 -1
- package/dist/adapter/resources/framebuffer.js.map +0 -1
- package/dist/adapter/resources/render-pass.js.map +0 -1
- package/dist/adapter/resources/render-pipeline.js.map +0 -1
- package/dist/adapter/resources/resource.js.map +0 -1
- package/dist/adapter/resources/sampler.js.map +0 -1
- package/dist/adapter/resources/shader.js.map +0 -1
- package/dist/adapter/resources/texture.js.map +0 -1
- package/dist/adapter/resources/transform-feedback.js.map +0 -1
- package/dist/adapter/resources/vertex-array.js.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.js.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.js.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.js.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.js.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.js.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.js.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.js.map +0 -1
- package/dist/adapter/types/accessor.js.map +0 -1
- package/dist/adapter/types/buffer-layout.js.map +0 -1
- package/dist/adapter/types/parameters.js.map +0 -1
- package/dist/adapter/types/shader-layout.js.map +0 -1
- package/dist/adapter/types/shader-types.js.map +0 -1
- package/dist/adapter/types/texture-formats.js.map +0 -1
- package/dist/adapter/types/types.js.map +0 -1
- package/dist/adapter/types/vertex-formats.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/lib/compiler-log/compiler-message.js.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.js.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js.map +0 -1
- package/dist/lib/luma.js.map +0 -1
- package/dist/lib/uniforms/uniform-block.js.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.js.map +0 -1
- package/dist/lib/uniforms/uniform-store.js.map +0 -1
- package/dist/lib/uniforms/uniform.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/array-equal.js.map +0 -1
- package/dist/utils/array-utils-flat.js.map +0 -1
- package/dist/utils/assert.js.map +0 -1
- package/dist/utils/cast.js.map +0 -1
- package/dist/utils/check-props.js.map +0 -1
- package/dist/utils/deep-equal.js.map +0 -1
- package/dist/utils/format-value.js.map +0 -1
- package/dist/utils/is-array.js.map +0 -1
- package/dist/utils/load-file.js.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/random.js.map +0 -1
- package/dist/utils/request-animation-frame.js.map +0 -1
- package/dist/utils/stats-manager.js.map +0 -1
- package/dist/utils/stub-methods.js.map +0 -1
- package/dist/utils/utils.js.map +0 -1
|
@@ -1,21 +1,36 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {Resource, ResourceProps} from './resource';
|
|
2
6
|
import {ComputePipeline} from './compute-pipeline';
|
|
3
|
-
import {Buffer} from './buffer';
|
|
4
7
|
import type {Device} from '../device';
|
|
8
|
+
import {Buffer} from './buffer';
|
|
9
|
+
import {QuerySet} from './query-set';
|
|
5
10
|
|
|
6
|
-
export type ComputePassProps = ResourceProps & {
|
|
11
|
+
export type ComputePassProps = ResourceProps & {
|
|
12
|
+
/** QuerySet to write beging/end timestamps to */
|
|
13
|
+
timestampQuerySet?: QuerySet;
|
|
14
|
+
/** QuerySet index to write begin timestamp to. No timestamp is written if not provided. */
|
|
15
|
+
beginTimestampIndex?: number;
|
|
16
|
+
/** QuerySet index to write end timestamp to. No timestamp is written if not provided. */
|
|
17
|
+
endTimestampIndex?: number;
|
|
18
|
+
};
|
|
7
19
|
|
|
8
20
|
export abstract class ComputePass extends Resource<ComputePassProps> {
|
|
9
21
|
static override defaultProps: Required<ComputePassProps> = {
|
|
10
|
-
...Resource.defaultProps
|
|
11
|
-
|
|
22
|
+
...Resource.defaultProps,
|
|
23
|
+
timestampQuerySet: undefined,
|
|
24
|
+
beginTimestampIndex: undefined,
|
|
25
|
+
endTimestampIndex: undefined
|
|
26
|
+
};
|
|
12
27
|
|
|
13
28
|
override get [Symbol.toStringTag](): string {
|
|
14
29
|
return 'ComputePass';
|
|
15
30
|
}
|
|
16
31
|
|
|
17
32
|
constructor(device: Device, props: ComputePassProps) {
|
|
18
|
-
super(device, props,
|
|
33
|
+
super(device, props, ComputePass.defaultProps);
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
abstract override destroy(): void;
|
|
@@ -42,11 +57,10 @@ export abstract class ComputePass extends Resource<ComputePassProps> {
|
|
|
42
57
|
*/
|
|
43
58
|
abstract dispatchIndirect(indirectBuffer: Buffer, indirectOffset?: number): void;
|
|
44
59
|
|
|
60
|
+
/** Begins a labeled debug group containing subsequent commands */
|
|
45
61
|
abstract pushDebugGroup(groupLabel: string): void;
|
|
62
|
+
/** Ends the labeled debug group most recently started by pushDebugGroup() */
|
|
46
63
|
abstract popDebugGroup(): void;
|
|
64
|
+
/** Marks a point in a stream of commands with a label */
|
|
47
65
|
abstract insertDebugMarker(markerLabel: string): void;
|
|
48
|
-
|
|
49
|
-
// writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;
|
|
50
|
-
// beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;
|
|
51
|
-
// endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;
|
|
52
66
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
2
5
|
import {Resource, ResourceProps} from './resource';
|
|
3
6
|
import {BindingDeclaration} from '../types/shader-layout';
|
|
4
7
|
import type {Device} from '../device';
|
|
@@ -25,7 +28,7 @@ export abstract class ComputePipeline extends Resource<ComputePipelineProps> {
|
|
|
25
28
|
csEntryPoint: undefined,
|
|
26
29
|
csConstants: {},
|
|
27
30
|
shaderLayout: []
|
|
28
|
-
};
|
|
31
|
+
};
|
|
29
32
|
|
|
30
33
|
override get [Symbol.toStringTag](): string {
|
|
31
34
|
return 'ComputePipeline';
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import type {Device} from '../device';
|
|
2
6
|
import {Resource, ResourceProps} from './resource';
|
|
3
7
|
|
|
4
8
|
export type ExternalTextureProps = ResourceProps & {
|
|
5
9
|
source: HTMLVideoElement | null;
|
|
6
10
|
colorSpace?: 'srgb';
|
|
7
|
-
}
|
|
11
|
+
};
|
|
8
12
|
export abstract class ExternalTexture extends Resource<ExternalTextureProps> {
|
|
9
13
|
static override defaultProps: Required<ExternalTextureProps> = {
|
|
10
14
|
...Resource.defaultProps,
|
|
@@ -12,7 +16,9 @@ export abstract class ExternalTexture extends Resource<ExternalTextureProps> {
|
|
|
12
16
|
colorSpace: 'srgb'
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
override get [Symbol.toStringTag](): string {
|
|
19
|
+
override get [Symbol.toStringTag](): string {
|
|
20
|
+
return 'ExternalTexture';
|
|
21
|
+
}
|
|
16
22
|
|
|
17
23
|
constructor(device: Device, props: ExternalTextureProps) {
|
|
18
24
|
super(device, props, ExternalTexture.defaultProps);
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
ColorTextureFormat,
|
|
7
|
+
DepthStencilTextureFormat,
|
|
8
|
+
TextureFormat
|
|
9
|
+
} from '../types/texture-formats';
|
|
5
10
|
import type {Device} from '../device';
|
|
6
11
|
import {Resource, ResourceProps} from './resource';
|
|
7
12
|
import {Texture} from './texture';
|
|
13
|
+
import {TextureView} from './texture-view';
|
|
8
14
|
import {log} from '../../utils/log';
|
|
9
15
|
|
|
10
16
|
export type FramebufferProps = ResourceProps & {
|
|
11
17
|
width?: number;
|
|
12
18
|
height?: number;
|
|
13
|
-
colorAttachments?: (Texture | ColorTextureFormat)[];
|
|
14
|
-
depthStencilAttachment?: (Texture | DepthStencilTextureFormat) | null;
|
|
19
|
+
colorAttachments?: (TextureView | Texture | ColorTextureFormat)[];
|
|
20
|
+
depthStencilAttachment?: (TextureView | Texture | DepthStencilTextureFormat) | null;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
/**
|
|
@@ -25,7 +31,7 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
25
31
|
height: 1,
|
|
26
32
|
colorAttachments: [], // ['rgba8unorm-unsized'],
|
|
27
33
|
depthStencilAttachment: null // 'depth24plus-stencil8'
|
|
28
|
-
};
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
override get [Symbol.toStringTag](): string {
|
|
31
37
|
return 'Framebuffer';
|
|
@@ -36,9 +42,9 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
36
42
|
/** Height of all attachments in this framebuffer */
|
|
37
43
|
height: number;
|
|
38
44
|
/** Color attachments */
|
|
39
|
-
colorAttachments:
|
|
45
|
+
colorAttachments: TextureView[] = [];
|
|
40
46
|
/** Depth-stencil attachment, if provided */
|
|
41
|
-
depthStencilAttachment:
|
|
47
|
+
depthStencilAttachment: TextureView | null = null;
|
|
42
48
|
|
|
43
49
|
constructor(device: Device, props: FramebufferProps = {}) {
|
|
44
50
|
super(device, props, Framebuffer.defaultProps);
|
|
@@ -53,7 +59,7 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
53
59
|
* Resizes all attachments
|
|
54
60
|
* @note resize() destroys existing textures (if size has changed).
|
|
55
61
|
*/
|
|
56
|
-
resize(size: {width: number; height: number
|
|
62
|
+
resize(size: {width: number; height: number}): void;
|
|
57
63
|
resize(size: [width: number, height: number]): void;
|
|
58
64
|
resize(): void;
|
|
59
65
|
resize(size?: {width: number; height: number} | [width: number, height: number]): void {
|
|
@@ -70,75 +76,30 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
// /** Returns fully populated attachment object. */
|
|
74
|
-
// protected normalizeColorAttachment(
|
|
75
|
-
// attachment: Texture | ColorTextureFormat
|
|
76
|
-
// ): Required<ColorAttachment> {
|
|
77
|
-
|
|
78
|
-
// const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {
|
|
79
|
-
// texture: undefined!,
|
|
80
|
-
// format: undefined!,
|
|
81
|
-
// clearValue: [0.0, 0.0, 0.0, 0.0],
|
|
82
|
-
// loadOp: 'clear',
|
|
83
|
-
// storeOp: 'store'
|
|
84
|
-
// };
|
|
85
|
-
|
|
86
|
-
// if (attachment instanceof Texture) {
|
|
87
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};
|
|
88
|
-
// }
|
|
89
|
-
// if (typeof attachment === 'string') {
|
|
90
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};
|
|
91
|
-
// }
|
|
92
|
-
// return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// /** Wraps texture inside fully populated attachment object. */
|
|
96
|
-
// protected normalizeDepthStencilAttachment(
|
|
97
|
-
// attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat
|
|
98
|
-
// ): Required<DepthStencilAttachment> {
|
|
99
|
-
// const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {
|
|
100
|
-
// texture: undefined!,
|
|
101
|
-
// format: undefined!,
|
|
102
|
-
|
|
103
|
-
// depthClearValue: 1.0,
|
|
104
|
-
// depthLoadOp: 'clear',
|
|
105
|
-
// depthStoreOp: 'store',
|
|
106
|
-
// depthReadOnly: false,
|
|
107
|
-
|
|
108
|
-
// stencilClearValue: 0,
|
|
109
|
-
// stencilLoadOp: 'clear',
|
|
110
|
-
// stencilStoreOp: 'store',
|
|
111
|
-
// stencilReadOnly: false
|
|
112
|
-
// };
|
|
113
|
-
|
|
114
|
-
// if (typeof attachment === 'string') {
|
|
115
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};
|
|
116
|
-
// }
|
|
117
|
-
// // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer
|
|
118
|
-
// if (attachment.handle || attachment instanceof Texture) {
|
|
119
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};
|
|
120
|
-
// }
|
|
121
|
-
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};
|
|
122
|
-
// }
|
|
123
|
-
|
|
124
79
|
/** Auto creates any textures */
|
|
125
|
-
protected autoCreateAttachmentTextures(){
|
|
80
|
+
protected autoCreateAttachmentTextures(): void {
|
|
126
81
|
this.colorAttachments = this.props.colorAttachments.map(attachment => {
|
|
127
82
|
if (typeof attachment === 'string') {
|
|
128
83
|
const texture = this.createColorTexture(attachment);
|
|
129
84
|
this.attachResource(texture);
|
|
130
|
-
return texture;
|
|
85
|
+
return texture.view;
|
|
86
|
+
}
|
|
87
|
+
if (attachment instanceof Texture) {
|
|
88
|
+
return attachment.view;
|
|
131
89
|
}
|
|
132
90
|
return attachment;
|
|
133
91
|
});
|
|
134
92
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
93
|
+
const attachment = this.props.depthStencilAttachment;
|
|
94
|
+
if (attachment) {
|
|
95
|
+
if (typeof attachment === 'string') {
|
|
96
|
+
const texture = this.createDepthStencilTexture(attachment);
|
|
138
97
|
this.attachResource(texture);
|
|
139
|
-
this.depthStencilAttachment = texture;
|
|
98
|
+
this.depthStencilAttachment = texture.view;
|
|
99
|
+
} else if (attachment instanceof Texture) {
|
|
100
|
+
this.depthStencilAttachment = attachment.view;
|
|
140
101
|
} else {
|
|
141
|
-
this.depthStencilAttachment =
|
|
102
|
+
this.depthStencilAttachment = attachment;
|
|
142
103
|
}
|
|
143
104
|
}
|
|
144
105
|
}
|
|
@@ -150,7 +111,7 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
150
111
|
usage: Texture.RENDER_ATTACHMENT,
|
|
151
112
|
format,
|
|
152
113
|
width: this.width,
|
|
153
|
-
height: this.height
|
|
114
|
+
height: this.height
|
|
154
115
|
});
|
|
155
116
|
}
|
|
156
117
|
|
|
@@ -179,8 +140,8 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
179
140
|
height
|
|
180
141
|
});
|
|
181
142
|
this.destroyAttachedResource(this.colorAttachments[i]);
|
|
182
|
-
this.colorAttachments[i] = resizedTexture;
|
|
183
|
-
this.attachResource(resizedTexture);
|
|
143
|
+
this.colorAttachments[i] = resizedTexture.view;
|
|
144
|
+
this.attachResource(resizedTexture.view);
|
|
184
145
|
}
|
|
185
146
|
}
|
|
186
147
|
|
|
@@ -191,40 +152,92 @@ export abstract class Framebuffer extends Resource<FramebufferProps> {
|
|
|
191
152
|
height
|
|
192
153
|
});
|
|
193
154
|
this.destroyAttachedResource(this.depthStencilAttachment);
|
|
194
|
-
this.depthStencilAttachment = resizedTexture;
|
|
155
|
+
this.depthStencilAttachment = resizedTexture.view;
|
|
195
156
|
this.attachResource(resizedTexture);
|
|
196
157
|
}
|
|
197
158
|
}
|
|
198
|
-
|
|
199
|
-
/** Create a color attachment for WebGL *
|
|
200
|
-
protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {
|
|
201
|
-
return this.device._createTexture({
|
|
202
|
-
id: `${this.id}-color`,
|
|
203
|
-
data: null, // reserves texture memory, but texels are undefined
|
|
204
|
-
format,
|
|
205
|
-
// type: GL.UNSIGNED_BYTE,
|
|
206
|
-
width: this.width,
|
|
207
|
-
height: this.height,
|
|
208
|
-
// Note: Mipmapping can be disabled by texture resource when we resize the texture
|
|
209
|
-
// to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
|
|
210
|
-
// behavior we always disable mipmaps.
|
|
211
|
-
mipmaps: false,
|
|
212
|
-
// Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
|
|
213
|
-
// Use LINEAR so subpixel algos like fxaa work.
|
|
214
|
-
// Set WRAP modes that support NPOT textures too.
|
|
215
|
-
sampler: {
|
|
216
|
-
minFilter: 'linear',
|
|
217
|
-
magFilter: 'linear',
|
|
218
|
-
addressModeU: 'clamp-to-edge',
|
|
219
|
-
addressModeV: 'clamp-to-edge'
|
|
220
|
-
}
|
|
221
|
-
// parameters: {
|
|
222
|
-
// [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
|
|
223
|
-
// [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
224
|
-
// [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
225
|
-
// [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
|
|
226
|
-
// }
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
*/
|
|
230
159
|
}
|
|
160
|
+
|
|
161
|
+
// TODO - remove if not needed
|
|
162
|
+
|
|
163
|
+
// Create a color attachment for WebGL *
|
|
164
|
+
// protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {
|
|
165
|
+
// return this.device._createTexture({
|
|
166
|
+
// id: `${this.id}-color`,
|
|
167
|
+
// data: null, // reserves texture memory, but texels are undefined
|
|
168
|
+
// format,
|
|
169
|
+
// // type: GL.UNSIGNED_BYTE,
|
|
170
|
+
// width: this.width,
|
|
171
|
+
// height: this.height,
|
|
172
|
+
// // Note: Mipmapping can be disabled by texture resource when we resize the texture
|
|
173
|
+
// // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
|
|
174
|
+
// // behavior we always disable mipmaps.
|
|
175
|
+
// mipmaps: false,
|
|
176
|
+
// // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
|
|
177
|
+
// // Use LINEAR so subpixel algos like fxaa work.
|
|
178
|
+
// // Set WRAP modes that support NPOT textures too.
|
|
179
|
+
// sampler: {
|
|
180
|
+
// minFilter: 'linear',
|
|
181
|
+
// magFilter: 'linear',
|
|
182
|
+
// addressModeU: 'clamp-to-edge',
|
|
183
|
+
// addressModeV: 'clamp-to-edge'
|
|
184
|
+
// }
|
|
185
|
+
// // parameters: {
|
|
186
|
+
// // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
|
|
187
|
+
// // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
188
|
+
// // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
189
|
+
// // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
|
|
190
|
+
// // }
|
|
191
|
+
// });
|
|
192
|
+
// }
|
|
193
|
+
|
|
194
|
+
// /** Returns fully populated attachment object. */
|
|
195
|
+
// protected normalizeColorAttachment(
|
|
196
|
+
// attachment: Texture | ColorTextureFormat
|
|
197
|
+
// ): Required<ColorAttachment> {
|
|
198
|
+
|
|
199
|
+
// const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {
|
|
200
|
+
// texture: undefined!,
|
|
201
|
+
// format: undefined!,
|
|
202
|
+
// clearValue: [0.0, 0.0, 0.0, 0.0],
|
|
203
|
+
// loadOp: 'clear',
|
|
204
|
+
// storeOp: 'store'
|
|
205
|
+
// };
|
|
206
|
+
|
|
207
|
+
// if (attachment instanceof Texture) {
|
|
208
|
+
// return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};
|
|
209
|
+
// }
|
|
210
|
+
// if (typeof attachment === 'string') {
|
|
211
|
+
// return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};
|
|
212
|
+
// }
|
|
213
|
+
// return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};
|
|
214
|
+
// }
|
|
215
|
+
|
|
216
|
+
// /** Wraps texture inside fully populated attachment object. */
|
|
217
|
+
// protected normalizeDepthStencilAttachment(
|
|
218
|
+
// attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat
|
|
219
|
+
// ): Required<DepthStencilAttachment> {
|
|
220
|
+
// const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {
|
|
221
|
+
// texture: undefined!,
|
|
222
|
+
// format: undefined!,
|
|
223
|
+
|
|
224
|
+
// depthClearValue: 1.0,
|
|
225
|
+
// depthLoadOp: 'clear',
|
|
226
|
+
// depthStoreOp: 'store',
|
|
227
|
+
// depthReadOnly: false,
|
|
228
|
+
|
|
229
|
+
// stencilClearValue: 0,
|
|
230
|
+
// stencilLoadOp: 'clear',
|
|
231
|
+
// stencilStoreOp: 'store',
|
|
232
|
+
// stencilReadOnly: false
|
|
233
|
+
// };
|
|
234
|
+
|
|
235
|
+
// if (typeof attachment === 'string') {
|
|
236
|
+
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};
|
|
237
|
+
// }
|
|
238
|
+
// // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer
|
|
239
|
+
// if (attachment.handle || attachment instanceof Texture) {
|
|
240
|
+
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};
|
|
241
|
+
// }
|
|
242
|
+
// return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};
|
|
243
|
+
// }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {Device} from '../device';
|
|
6
|
+
import {Resource, ResourceProps} from './resource';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Properties for creating a QuerySet
|
|
10
|
+
* - 'timestamp' - query the GPU timestamp counter at the start and end of render passes
|
|
11
|
+
* timestamp queries are available if the 'timestamp-query' feature is present.
|
|
12
|
+
* - 'occlusion' - query the number of fragment samples that pass all per-fragment tests for a set of drawing commands
|
|
13
|
+
* including scissor, sample mask, alpha to coverage, stencil, and depth tests
|
|
14
|
+
*/
|
|
15
|
+
export type QuerySetProps = ResourceProps & {
|
|
16
|
+
/**
|
|
17
|
+
* The type of query set
|
|
18
|
+
* occlusion - query the number of fragment samples that pass all the per-fragment tests for a set of drawing commands, including scissor, sample mask, alpha to coverage, stencil, and depth tests
|
|
19
|
+
* timestamp - query the GPU timestamp counter at the start and end of render passes
|
|
20
|
+
*/
|
|
21
|
+
type: 'occlusion' | 'timestamp';
|
|
22
|
+
/** The number of queries managed by the query set */
|
|
23
|
+
count: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Immutable QuerySet object */
|
|
27
|
+
export abstract class QuerySet extends Resource<QuerySetProps> {
|
|
28
|
+
static override defaultProps: Required<QuerySetProps> = {
|
|
29
|
+
...Resource.defaultProps,
|
|
30
|
+
type: undefined,
|
|
31
|
+
count: undefined
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
get [Symbol.toStringTag](): string {
|
|
35
|
+
return 'QuerySet';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
constructor(device: Device, props: QuerySetProps) {
|
|
39
|
+
super(device, props, QuerySet.defaultProps);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {Device} from '../device';
|
|
6
|
+
import type {RenderPassParameters} from '../types/parameters';
|
|
4
7
|
// import {Binding} from '../types/shader-layout';
|
|
5
8
|
import {Resource, ResourceProps} from './resource';
|
|
6
|
-
// import {Buffer} from './buffer';
|
|
7
|
-
// import {RenderPipeline} from './render-pipeline';
|
|
8
|
-
// import {CommandEncoder} from './command-encoder';
|
|
9
9
|
import {Framebuffer} from './framebuffer';
|
|
10
10
|
import {NumberArray} from '../..';
|
|
11
|
+
import {QuerySet} from './query-set';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Properties for a RenderPass instance is a required parameter to all draw calls.
|
|
@@ -28,19 +29,27 @@ export type RenderPassProps = ResourceProps & {
|
|
|
28
29
|
/** Indicates that the stencil component is read only. */
|
|
29
30
|
stencilReadOnly?: boolean;
|
|
30
31
|
/** Whether to disable / discard the output of the rasterizer */
|
|
31
|
-
discard?: boolean;
|
|
32
|
+
discard?: boolean;
|
|
33
|
+
|
|
34
|
+
/** QuerySet to write begin/end timestamps to */
|
|
35
|
+
occlusionQuerySet?: QuerySet;
|
|
36
|
+
/** QuerySet to write begin/end timestamps to */
|
|
37
|
+
timestampQuerySet?: QuerySet;
|
|
38
|
+
/** QuerySet index to write begin timestamp to. No timestamp is written if not provided. */
|
|
39
|
+
beginTimestampIndex?: number;
|
|
40
|
+
/** QuerySet index to write end timestamp to. No timestamp is written if not provided. */
|
|
41
|
+
endTimestampIndex?: number;
|
|
32
42
|
};
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
45
|
* A RenderPass instance is a required parameter to all draw calls.
|
|
36
|
-
*
|
|
37
|
-
* It holds a combination of
|
|
46
|
+
*
|
|
47
|
+
* It holds a combination of
|
|
38
48
|
* - render targets (specified via a framebuffer)
|
|
39
49
|
* - clear colors, read/write, discard information for the framebuffer attachments
|
|
40
50
|
* - a couple of mutable parameters ()
|
|
41
51
|
*/
|
|
42
52
|
export abstract class RenderPass extends Resource<RenderPassProps> {
|
|
43
|
-
|
|
44
53
|
/** Default properties for RenderPass */
|
|
45
54
|
static override defaultProps: Required<RenderPassProps> = {
|
|
46
55
|
...Resource.defaultProps,
|
|
@@ -51,7 +60,12 @@ export abstract class RenderPass extends Resource<RenderPassProps> {
|
|
|
51
60
|
clearStencil: 0,
|
|
52
61
|
depthReadOnly: false,
|
|
53
62
|
stencilReadOnly: false,
|
|
54
|
-
discard: false
|
|
63
|
+
discard: false,
|
|
64
|
+
|
|
65
|
+
occlusionQuerySet: undefined,
|
|
66
|
+
timestampQuerySet: undefined,
|
|
67
|
+
beginTimestampIndex: undefined,
|
|
68
|
+
endTimestampIndex: undefined
|
|
55
69
|
};
|
|
56
70
|
|
|
57
71
|
override get [Symbol.toStringTag](): string {
|
|
@@ -65,53 +79,33 @@ export abstract class RenderPass extends Resource<RenderPassProps> {
|
|
|
65
79
|
/** Call when rendering is done in this pass. */
|
|
66
80
|
abstract end(): void;
|
|
67
81
|
|
|
68
|
-
/**
|
|
69
|
-
* A small set of parameters can be changed between every draw call
|
|
70
|
-
* (viewport, scissorRect, blendColor, stencilReference)
|
|
71
|
-
*/
|
|
82
|
+
/** A few parameters can be changed at any time (viewport, scissorRect, blendColor, stencilReference) */
|
|
72
83
|
abstract setParameters(parameters: RenderPassParameters): void;
|
|
73
84
|
|
|
74
|
-
abstract pushDebugGroup(groupLabel: string): void;
|
|
75
|
-
abstract popDebugGroup(): void;
|
|
76
|
-
abstract insertDebugMarker(markerLabel: string): void;
|
|
77
|
-
|
|
78
|
-
// writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;
|
|
79
|
-
|
|
80
|
-
// beginOcclusionQuery(queryIndex: number): void;
|
|
81
|
-
// endOcclusionQuery(): void;
|
|
82
|
-
|
|
83
85
|
// executeBundles(bundles: Iterable<GPURenderBundle>): void;
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
/** Being an occlusion query. Value will be stored in the occlusionQuerySet at the index. Occlusion queries cannot be nested. */
|
|
88
|
+
abstract beginOcclusionQuery(queryIndex: number): void;
|
|
89
|
+
/** End an occlusion query. Stores result in the index specified in beginOcclusionQuery. */
|
|
90
|
+
abstract endOcclusionQuery(): void;
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
offset?: number,
|
|
95
|
-
size?: number
|
|
96
|
-
): void {}
|
|
97
|
-
|
|
98
|
-
abstract setVertexBuffer(slot: number, buffer: Buffer, offset: number): void;
|
|
99
|
-
|
|
100
|
-
abstract setBindings(bindings: Record<string, Binding>): void;
|
|
101
|
-
|
|
102
|
-
abstract setParameters(parameters: RenderPassParameters);
|
|
103
|
-
|
|
104
|
-
draw(options: {
|
|
105
|
-
vertexCount?: number; // Either vertexCount or indexCount must be provided
|
|
106
|
-
indexCount?: number; // Activates indexed drawing (call setIndexBuffer())
|
|
107
|
-
instanceCount?: number; //
|
|
108
|
-
firstVertex?: number;
|
|
109
|
-
firstIndex?: number; // requires device.features.has('indirect-first-instance')?
|
|
110
|
-
firstInstance?: number;
|
|
111
|
-
baseVertex?: number;
|
|
112
|
-
}): void {}
|
|
92
|
+
/** Begins a labeled debug group containing subsequent commands */
|
|
93
|
+
abstract pushDebugGroup(groupLabel: string): void;
|
|
94
|
+
/** Ends the labeled debug group most recently started by pushDebugGroup() */
|
|
95
|
+
abstract popDebugGroup(): void;
|
|
96
|
+
/** Marks a point in a stream of commands with a label */
|
|
97
|
+
abstract insertDebugMarker(markerLabel: string): void;
|
|
113
98
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
// In WebGPU the following methods are on the renderpass instead of the renderpipeline
|
|
100
|
+
// luma.gl keeps them on the pipeline for now.
|
|
101
|
+
// TODO - Can we align WebGL implementation with WebGPU API?
|
|
102
|
+
|
|
103
|
+
// abstract setPipeline(pipeline: RenderPipeline): void {}
|
|
104
|
+
// abstract setIndexBuffer()
|
|
105
|
+
// abstract setVertexBuffer(slot: number, buffer: Buffer, offset: number): void;
|
|
106
|
+
// abstract setBindings(bindings: Record<string, Binding>): void;
|
|
107
|
+
// abstract setParameters(parameters: RenderPassParameters);
|
|
108
|
+
// abstract draw(options: {
|
|
109
|
+
// abstract drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
|
|
110
|
+
// abstract drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
|
|
117
111
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
2
5
|
import type {Device} from '../device';
|
|
3
6
|
import type {UniformValue} from '../types/types';
|
|
4
7
|
import type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters';
|
|
@@ -85,13 +88,17 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
|
|
|
85
88
|
return 'RenderPipeline';
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
hash: string = '';
|
|
89
91
|
abstract readonly vs: Shader;
|
|
90
92
|
abstract readonly fs: Shader | null;
|
|
93
|
+
|
|
91
94
|
/** The merged layout */
|
|
92
95
|
shaderLayout: ShaderLayout;
|
|
93
96
|
/** Buffer map describing buffer interleaving etc */
|
|
94
97
|
readonly bufferLayout: BufferLayout[];
|
|
98
|
+
/** The linking status of the pipeline. 'pending' if linking is asynchronous, and on production */
|
|
99
|
+
linkStatus: 'pending' | 'success' | 'error' = 'pending';
|
|
100
|
+
/** The hash of the pipeline */
|
|
101
|
+
hash: string = '';
|
|
95
102
|
|
|
96
103
|
constructor(device: Device, props: RenderPipelineProps) {
|
|
97
104
|
super(device, props, RenderPipeline.defaultProps);
|
|
@@ -101,12 +108,6 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
|
|
|
101
108
|
|
|
102
109
|
/** Set bindings (stored on pipeline and set before each call) */
|
|
103
110
|
abstract setBindings(bindings: Record<string, Binding>): void;
|
|
104
|
-
/** Uniforms
|
|
105
|
-
* @deprecated Only supported on WebGL devices.
|
|
106
|
-
* @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.
|
|
107
|
-
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
108
|
-
*/
|
|
109
|
-
abstract setUniforms(bindings: Record<string, UniformValue>): void;
|
|
110
111
|
|
|
111
112
|
/** Draw call */
|
|
112
113
|
abstract draw(options: {
|
|
@@ -127,7 +128,19 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
|
|
|
127
128
|
/** First instance to draw from */
|
|
128
129
|
firstInstance?: number;
|
|
129
130
|
baseVertex?: number;
|
|
130
|
-
/** Transform feedback. WebGL
|
|
131
|
+
/** Transform feedback. WebGL only. */
|
|
131
132
|
transformFeedback?: TransformFeedback;
|
|
132
133
|
}): void;
|
|
134
|
+
|
|
135
|
+
// DEPRECATED METHODS
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Uniforms
|
|
139
|
+
* @deprecated Use uniforms buffers
|
|
140
|
+
* @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.
|
|
141
|
+
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
142
|
+
*/
|
|
143
|
+
setUniformsWebGL(uniforms: Record<string, UniformValue>): void {
|
|
144
|
+
throw new Error('Use uniform blocks');
|
|
145
|
+
}
|
|
133
146
|
}
|