rhodonite 0.22.0 → 0.22.1
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/README.md +4 -4
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +7 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +2 -0
- package/dist/esm/foundation/core/Config.d.ts +34 -0
- package/dist/esm/foundation/math/Transform3D.d.ts +26 -2
- package/dist/esm/foundation/system/Engine.d.ts +13 -2
- package/dist/esm/index.js +240 -154
- package/dist/esm/webgpu/WebGpuGpuTimer.d.ts +18 -7
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.d.ts +4 -1
- package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +7 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +2 -0
- package/dist/esmdev/foundation/core/Config.d.ts +34 -0
- package/dist/esmdev/foundation/math/Transform3D.d.ts +26 -2
- package/dist/esmdev/foundation/system/Engine.d.ts +13 -2
- package/dist/esmdev/index.js +265 -82
- package/dist/esmdev/webgpu/WebGpuGpuTimer.d.ts +18 -7
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Measures the GPU time of each frame with the `timestamp-query` feature.
|
|
3
3
|
*
|
|
4
|
-
* Every render pass begun between beginFrame() and endFrame() writes timestamps at its beginning and
|
|
5
|
-
* the frame's GPU time is the sum of the pass durations. The timestamps are resolved when the command
|
|
4
|
+
* Every render or compute pass begun between beginFrame() and endFrame() writes timestamps at its beginning and
|
|
5
|
+
* end; the frame's GPU time is the sum of the pass durations. The timestamps are resolved when the command
|
|
6
6
|
* encoder is submitted and read back asynchronously, so `lastGpuTimeMilliseconds` reports the latest
|
|
7
|
-
* frame whose results have arrived, not the current one.
|
|
7
|
+
* frame whose results have arrived, not the current one. The duration of each pass label is also published.
|
|
8
8
|
*
|
|
9
9
|
* Browsers may quantize timestamps (e.g. to 100µs) unless developer features are enabled.
|
|
10
10
|
*/
|
|
@@ -16,25 +16,36 @@ export declare class WebGpuGpuTimer {
|
|
|
16
16
|
private __readbackBufferCount;
|
|
17
17
|
/** Timestamps written by passes recorded into the current command encoder. */
|
|
18
18
|
private __timestampCount;
|
|
19
|
+
/** The labels of the passes recorded into the current command encoder, one per pass. */
|
|
20
|
+
private __encoderPassLabels;
|
|
19
21
|
/** The frame the timestamps of the current command encoder belong to. */
|
|
20
22
|
private __encoderFrame?;
|
|
21
23
|
private __currentFrame?;
|
|
22
24
|
private __readbacksToMap;
|
|
23
25
|
private __lastGpuTimeMilliseconds?;
|
|
26
|
+
private __lastPassGpuTimesMilliseconds?;
|
|
24
27
|
constructor(device: GPUDevice);
|
|
25
28
|
/** Whether the device supports timestamp queries. */
|
|
26
29
|
get isSupported(): boolean;
|
|
27
30
|
/** The GPU time of the latest measured frame in milliseconds, or undefined if none is available yet. */
|
|
28
31
|
get lastGpuTimeMilliseconds(): number | undefined;
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The GPU time of each pass of the latest measured frame in milliseconds, keyed by the pass label.
|
|
34
|
+
* Undefined until a complete frame is available.
|
|
35
|
+
*/
|
|
36
|
+
get lastPassGpuTimesMilliseconds(): ReadonlyMap<string, number> | undefined;
|
|
37
|
+
/** Starts measuring the render and compute passes begun from now on. */
|
|
30
38
|
beginFrame(): void;
|
|
31
39
|
/** Stops measuring. The frame's time is published once all of its timestamps have been read back. */
|
|
32
40
|
endFrame(): void;
|
|
33
41
|
/**
|
|
34
|
-
* Returns the timestamp writes to set on a render pass descriptor, or undefined when the
|
|
35
|
-
* measured (outside a frame, or when the query set is full).
|
|
42
|
+
* Returns the timestamp writes to set on a render or compute pass descriptor, or undefined when the
|
|
43
|
+
* pass is not measured (outside a frame, or when the query set is full).
|
|
44
|
+
*
|
|
45
|
+
* @param label - The label of the pass, used to report its duration in
|
|
46
|
+
* {@link WebGpuGpuTimer.lastPassGpuTimesMilliseconds}. Passes with the same label are summed.
|
|
36
47
|
*/
|
|
37
|
-
getTimestampWrites(): GPURenderPassTimestampWrites | undefined;
|
|
48
|
+
getTimestampWrites(label: string): GPURenderPassTimestampWrites | undefined;
|
|
38
49
|
/**
|
|
39
50
|
* Encodes the resolve of the timestamps written by the passes of `encoder`.
|
|
40
51
|
* Call this before finishing the encoder, and call afterSubmit() after submitting it.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LightClusterGpuBuildParams } from '../foundation/renderer/lightCluster/LightClusterSystem';
|
|
2
|
+
import type { WebGpuGpuTimer } from './WebGpuGpuTimer';
|
|
2
3
|
/**
|
|
3
4
|
* Builds the light cluster tables of Clustered Forward rendering with compute shaders.
|
|
4
5
|
* The tables are written into the storage buffer of the GPU instance data, where the CPU build would write them.
|
|
@@ -25,8 +26,10 @@ export declare class WebGpuLightClusterBuilder {
|
|
|
25
26
|
*
|
|
26
27
|
* @param storageBuffer - The storage buffer of the GPU instance data
|
|
27
28
|
* @param params - The views to build and their sorted light input
|
|
29
|
+
* @param gpuTimer - When set (and a frame is being measured), measures the build as the
|
|
30
|
+
* 'LightClusterBuild' pass
|
|
28
31
|
*/
|
|
29
|
-
build(storageBuffer: GPUBuffer, params: LightClusterGpuBuildParams): void;
|
|
32
|
+
build(storageBuffer: GPUBuffer, params: LightClusterGpuBuildParams, gpuTimer?: WebGpuGpuTimer): void;
|
|
30
33
|
/**
|
|
31
34
|
* Releases the GPU resources.
|
|
32
35
|
*/
|