-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix Entity Rendering with requestRenderMode=true #12630
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for the pull request, @Beilinson! ✅ We can confirm we have a CLA on file for you. |
I don't want to revert the change from #12429 as to me that does seem like a logical change (if the I originally didn't think it correct to add an additional flag, however upon further investigation I understood that the former logic prior to #12429 scheduled a render whenever TL;DR - returns the previous logic by adding a new flag instead of undoing the changes on the |
I'll point out that with this fix, requestRenderMode reverts to the previous behavior where renders are only requested after all datasources under the DataSourceDisplay finish asynchronous work. This can actually cause delays in rendering, if for exampling 1 datasource finishes after 2 frames, while another takes significantly more, a render will be requested only after the longer one finishes. I could alter this behavior if desired |
Thanks for working on this patch @Beilinson, much appreciated. We also noticed this regression breaking our app (that uses request render) when updating from 1.121 to 1.128, I think it snuck in with 1.126 as noted in the We have confirmed that your first commit 9d2fe69 fixes our issue (we patched it on top of 1.128), we have not yet tested your commit bd38955 In terms of the second commit, is that what causes the delays in rendering you mentioned above ? Let us know if there is something we can do to help out. |
Glad I could help @jasonmprop, The second commit is a more technically correct fix, from what I can see more or less the |
Theres actually an interesting alternative fix which can change how if (this._prevResult !== result) {
this._scene.requestRender();
} Then a frame render will be requested twice when the async work begins and when it finishes, which will allow for things like updating an entity property, or adding an entity to a scene to be rendered automatically (without manually calling While this is not consistent with the https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/ blog post by @ggetz, I think this is worth considering:
|
bcf933c
to
492537a
Compare
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.
Thanks for your patience here @Beilinson.
Then a frame render will be requested twice when the async work begins and when it finishes, which will allow for things like updating an entity property, or adding an entity to a scene to be rendered automatically (without manually calling requestRender()), while still keeping renders to a minimum when the scene is unchanging.
I like this idea! However, as I mentioned in my review comment, I'm concerned that allowing the billboard visualizer to go back to returning false
after return true
breaks some existing behavior.
Maybe we're conflating ready
and the return value of update
with too many things. Maybe visualizers should expose a separate property for tracking updates requiring a re-render?
@ggetz I have some concerns that the changes here (to fix #12543) will introduce excessive rendering when the system creates new Billboard entities very often. #11820 - This was the original bug report that was caused by some of the logic in the Billboard's _loadImage function. Essentially, it always requested a render when the Billboard's image loaded which would cause a render every time a new Billboard entity was created. I believe the best tradeoff here would be to have the Billboard load its image from the TextureAtlas synchronously if the image id is already in the TextureAtlas. Otherwise, the image should be loaded asynchronously and then a render should be requested immediately after the image is resolved. This allows users to reuse images in request render mode without introducing unnecessary render cycles while still fixing the problem with Label backgrounds failing to render after "missing" their target frame. I had identified a workaround to #11820 that essentially implemented this behavior by passing a "redraw" parameter to the completeImageLoad function that was defined in Billboard.js:
Would we be able to implement something similar with the new code structure? |
aedcfa9
to
29f8063
Compare
c39704f
to
17db07c
Compare
Hey @ggetz, I've updated the PR with a fix for #12138 and the issues described in #12543 related to billboard and label rendering with The issue stemmed from the difference between image urls/resources and client-side images (i.e, canvas).
The solution I think is actually optimal is to allow client-side images to be added synchronously to the image processing queue, allowing them to be processed at the end of the rendered frame without any additional renders. The entire process is still fully async as per the TextureAtlas promise refactor, as the internal Regarding @rropp5's comments, I added a flag Sandboxes tested (make sure to run the test twice to prevent slow tiles from causing the additional renders)
|
@ggetz An alternative solution I considered was moving the My reasoning stems from the fact that processing the texture atlas according to your explanations in #12495:
However in Is this a valid solution or have I misunderstood the PR above? |
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.
Thanks for the update here @Beilinson! I think this is getting much closer.
I have a few comments. Let me know what you think.
Description
Fixes the requestRenderMode issue which stems from #12429.
Issue number and link
Fixes #12543
Testing plan
Sandbox Example
The setTimeouts are so that the scene is definitely NOT requesting any render when updating the polyline material (all the tiles should already be loaded in).
With the above test the bug is easily reproducible, and is fixed with my branch.
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change- [ ] I have added or updated unit tests to ensure consistent code coverage