-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add timestamp query support to compute boids #323
Conversation
@kainino0x Can you review? |
I had no issue with this design: https://jsgist.org/?src=8b8ad1e7e7cfd92b6275927b9d61de23 Which is effectively, you have an array of free queries and result buffers, when you start a frame you ask for a query/result buffer. If there are none free you allocate new ones. You then mapAsync.then() to get the result. After reading the result you add the query and result buffer back to the free list. You end up at most with 2-4 of these after a few frames and then no more allocations You might get the result later 1-3 frames later but you get no jank |
Thanks for sharing @greggman! Is the pattern you're recommending is the one we should promote or is it one among others? I'm genuinely asking as it's not clear to me ;) |
I've removed I humbly think having a list of free buffers is a bit too much for a sample. |
I don't know either, haha. I'd like to know too. I think having a list of buffers is trivial code.
|
I've addressed @kainino0x and @greggman feedback in latest patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but had a few nits which I resolved in the commit I'll push now:
- Number is hard to read because it flickers too fast, and it's too big (I changed it to µs)
- Some comments would help explain to readers
Thank you very much @kainino0x! It looks great |
This PR adds timestamp query support to the compute boids sample by showing render pass and compute pass durations.
I've tried several approaches before this attempt:
resultBuffer.mapAsync
to settle inframe()
but this makes UI janky as expected.