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

Initial refactor to how bind groups can be used with non-persistent UBs #6341

Merged
merged 3 commits into from
May 7, 2024

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented May 7, 2024

  • related to the suggested design here: WebGPU: BindGroups aren't being reused #6315 (comment)
  • this is a first try at doing this, and applied to WebgpuClearRenderer only, but it works.
  • basically each dynamic buffer from which we bump allocate non-persistent uniform buffers has a cache of bind groups based on uniform buffer size (as this size is part of the bind group). And this means, all buffers using the same size can share a single bind group, and avoid their allocation each time the bump allocator switches to a different buffer
  • also did a small refactor to the way uniforms are set to the UB, allowing users to avoid using the scope in the middle and set values directly to the buffer.

The next PR will apply this to the mesh UB, which is a main reason for the allocations.

@mvaligursky mvaligursky self-assigned this May 7, 2024
@mvaligursky mvaligursky added performance Relating to load times or frame rate area: graphics Graphics related issue labels May 7, 2024
* A cache of bind groups for each uniform buffer size, which is used to avoid creating a new
* bind group for each uniform buffer.
*
* @type {Map<number, BindGroup>}
Copy link
Member

Choose a reason for hiding this comment

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

adding these to the code is so incredibly useful <3

@mvaligursky mvaligursky merged commit 95ddb6c into main May 7, 2024
7 checks passed
@mvaligursky mvaligursky deleted the mv-dynamic-bind-groups branch May 7, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue performance Relating to load times or frame rate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants