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: Add timestamp queries support in WebGPU #27597

Merged
merged 8 commits into from
Jan 21, 2024

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Jan 20, 2024

This PR add support for timestamp queries to monitor WebGPU performances. (Requires Chrome 121)

In my opinion this feature should be included OOTB in the Renderer, it will be really useful to compare WebGPU vs WebGL performances and is optional (disabled by default). I will add WebGL fallback via EXT_disjoint_timer_query_webgl2 in a second time.

The monitoring of performances can be enable with:
new WebGPURenderer( { trackTimestamp: true } );

Also improved the info system and honored all render calls to be async as they should (render() is async).
honor async render and move to renderer await functions

Live demo:
https://raw.githack.com/renaudrohlinger/three.js/timestamp-queries/examples/webgpu_compute_particles.html
Screenshot 2024-01-20 at 18 57 30

This contribution is funded by Utsubo

@sunag
Copy link
Collaborator

sunag commented Jan 20, 2024

I think we could standardize async functions like compileAsync and do the same in renderAsync() and computeAsync(), they last are just asynchronous because they need to wait for the device to initialize.

I think we can get users used to using the suffix at first even if renderAsync() returns the render() function for now, this would make it easier for us when we change.

/cc @Mugen87

@RenaudRohlinger
Copy link
Collaborator Author

Make sense.
Added the new Async syntax.

Everything is now computeAsync and renderAsync and there is now some getters that simply call the async methods. For example:

get render() {

return this.renderAsync;

}

/cc @sunag

@Mugen87 Mugen87 added this to the r161 milestone Jan 21, 2024
@@ -90,6 +90,8 @@ class Backend {

// utils

resolveTimeStampAsync( renderContext, type ) { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be Timestamp instead of TimeStamp for consistency? /ping @RenaudRohlinger

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! 👍

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.

5 participants