software-mansion / software-mansion/TypeGPU
bug: FPSCounter does not display real FPS count
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
Currently, FPSCounter runs its own requestAnimationFrame loop. As a result, it effectively displays the screen's refresh rate.
I created a simple example that demonstrates the issue:
https://github.com/user-attachments/assets/adda6f64-7d72-4ba2-a543-11654abed80e
In this example:
- I dispatch a heavy compute pipeline
- I then dispatch a render pipeline that depends on the compute pipeline's resources, making dropped frames visible
- The example's RAF loop explicitly waits for the device to finish its work
We can observe that:
- The example's RAF timing closely matches the GPU frame time
- Our
FPSCounterstarts dropping because the GPU is under heavy load and the browser no longer can deliver frames at the full speed
I looked at how Three.js implements their fps counter. Their approach is not practical for us because they inject the inspector directly into the renderer (which we don't have).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the FPSCounter implementation and reproduce the linked example with its heavy compute and dependent render pipelines. Trace how the counter's requestAnimationFrame loop measures frames, then verify that the reported value reflects completed GPU work rather than only display refresh timing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100