rendering stats
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useFrame, type RootState } from "@react-three/fiber";
|
||||
import { layerTimings } from "../layerTimings";
|
||||
import { recordLayerFrameTime } from "../layerTimings";
|
||||
|
||||
export function useLayerFrame(
|
||||
name: string,
|
||||
@@ -9,8 +9,6 @@ export function useLayerFrame(
|
||||
useFrame((state, delta) => {
|
||||
const start = performance.now();
|
||||
callback(state, delta);
|
||||
const entry = layerTimings[name] ??= { acc: 0, frames: 0 };
|
||||
entry.acc += performance.now() - start;
|
||||
entry.frames++;
|
||||
recordLayerFrameTime(name, performance.now() - start);
|
||||
}, priority);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user