Skip to content

WebGPURenderer: Improve performances for trackTimestamp in WebGPU#28741

Merged
RenaudRohlinger merged 2 commits intomrdoob:devfrom
RenaudRohlinger:utsubo/feat/timestamp-performances
Jun 25, 2024
Merged

WebGPURenderer: Improve performances for trackTimestamp in WebGPU#28741
RenaudRohlinger merged 2 commits intomrdoob:devfrom
RenaudRohlinger:utsubo/feat/timestamp-performances

Conversation

@RenaudRohlinger
Copy link
Copy Markdown
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
Comment thread examples/jsm/renderers/webgpu/WebGPUBackend.js Fixed
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.

2 participants