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

Fix tileset style recompilation edge cases #9223

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Nov 3, 2020

Fixed two cases where styles would be reapplied needlessly every frame

  • When the tileset has a style and tileset.preloadWhenHidden is true and tileset.show is false
  • When tileset.style is set to an identical style. This wasn't the original bug I was looking into but it was a slowdown waiting to be noticed.

There was some code in Cesium3DTileStyleEngine that only reset styleDirty during the render pass. This is bad because the render pass doesn't get called at all if tileset.preloadWhenHidden is true and tileset.show is false and so the style would forever be dirty, which causes shader recompilations to happen for each tile every frame.

The proper way to do pass-invariant updates is with postPassesUpdate. It ended up being a pretty simple fix.

For testing:

Both added unit tests will fail in master and pass in this branch.

I haven't yet tested this in the application code where this was first noticed, but maybe @IanLilleyT can take over that. Then we could also do a performance comparison.

CC @mramato @IanLilleyT

@cesium-concierge
Copy link

Thanks for the pull request @lilleyse!

  • ✔️ Signed CLA found.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

CHANGES.md Outdated Show resolved Hide resolved
@IanLilleyT
Copy link
Contributor

IanLilleyT commented Nov 3, 2020

I confirmed that the changes and tests work. It wasn't that the shader was being recompiled, it was from building the final shader string and querying the shader cache. Apparently this is a pretty heavy operation, as seen below.

Before:

Screenshot from 2020-11-03 15-14-20

After:

Screenshot from 2020-11-03 15-12-22

Thanks @lilleyse !

@IanLilleyT IanLilleyT merged commit ec320dd into master Nov 3, 2020
@IanLilleyT IanLilleyT deleted the fix-style-recompilation branch November 3, 2020 20:54
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.

4 participants