Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Improve performances for trackTimestamp in WebGPU #28741

Merged

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Jun 25, 2024

Description

This PR fixes 2 performances issue in the trackTimestamp feature in the WebGPU Backend. It Reuses the buffer each frame and do not stack the query if one is already trying to get resolved.

By skipping timestamp queries when a previous one is still resolving, we may miss some frame data (visible as small spikes in the GPU monitor). However, this prevents potential stalls in the rendering pipeline caused by accumulating unresolved async operations.
This tradeoff ensures smoother overall performance, especially in complex scenes where the overhead of constant timestamp querying could significantly impact frame rates and so make meaningless the trackTimestamp feature.

It was especially noticeable on complex simulations with multiple compute shaders in the pipeline. For example:

Before PR:
Screenshot 2024-06-25 at 18 46 09

After PR:
Screenshot 2024-06-25 at 18 46 27

This contribution is funded by Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r166 milestone Jun 25, 2024
@RenaudRohlinger RenaudRohlinger merged commit 41c1832 into mrdoob:dev Jun 25, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant