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

Batcher buffers merging optimization #7109

Merged
merged 4 commits into from
Nov 25, 2024

Conversation

Maksims
Copy link
Collaborator

@Maksims Maksims commented Nov 13, 2024

Batcher consists of multiple parts:

  1. Collecting information on batch groups.
  2. Figuring out individual batches based on mesh differences.
  3. Merging meshes buffers with additional transformation.

This PR focuses on the third case by decomposing some math functions that are called frequently, which results in significant performance gains in some of our tests.

In a scene with 749 batches, on test machine currently it takes:
~1658ms to apply position transformations and 612ms on normals transformations.

With this PR these numbers become:
~216ms to apply position transformations and 155ms on normals transformations.

In this specific case we have x7.7 time speed up on positions and x3.9 times speed up on normals.
We've tested multiple cases, and gains can vary from x1.5 to x10, depending on number of meshes per batch and how large these meshes are.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@mvaligursky mvaligursky added performance Relating to load times or frame rate area: graphics Graphics related issue labels Nov 13, 2024
Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

@mvaligursky mvaligursky merged commit bb268f9 into playcanvas:main_v1 Nov 25, 2024
8 checks passed
mvaligursky pushed a commit that referenced this pull request Nov 25, 2024
* batcher buffers merging optimization

* lint, and PR comments

* decompose matrix

* lint errors
@mvaligursky
Copy link
Contributor

cherry picked to engine v2 as well

@Maksims Maksims deleted the batcher-buffer-optimisation branch December 16, 2024 11:19
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