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

Performance improvements #28

Merged
merged 6 commits into from
Aug 8, 2020
Merged

Performance improvements #28

merged 6 commits into from
Aug 8, 2020

Conversation

w0rm
Copy link
Collaborator

@w0rm w0rm commented Jun 26, 2020

Closes #23 and #26

This PR improves webgl performance by reducing the number of gl calls. For more information click here

  • the uniforms are diffed using === to avoid reuploading common scene parameters like camera matrix or lights
  • attribute locations are cached so that they don't have to be retrieved for every draw call
  • webgl rendering settings are diffed against the JavaScript snapshot

Most of this was done together with @ianmackenzie. He also set up a test scene using the soon-to-be-released elm-3d-scene package, that we used to benchmark the performance:

Screenshot 2020-06-26 at 21 53 38

@MartinSStewart, who had opened the original issue, provided the source code of his game. Here you can see that it got slightly better:

Screenshot 2020-06-25 at 21 45 06

Here you can see the absence of redundant calls:

Screenshot 2020-06-25 at 21 56 14

There were a lot of bugs, because of the stateful nature of webgl. In order to ensure that it works, I tested it using the following projects:

@w0rm w0rm merged commit f45f762 into master Aug 8, 2020
@w0rm w0rm deleted the performance-improvements branch August 8, 2020 23:02
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.

Redundant WebGL calls
1 participant