-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature/gpu #3314
Feature/gpu #3314
Conversation
Thanks, Mike. I'll take a look today |
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.
This looks great. I'll just note this for later: The current approach looks like it draws the overlays as a layer on top of everything else.
Currently, in the canvas-only mode of the renderer, the overlays are drawn in the z-index order. This doesn't make a difference for most use cases, but it might be different for cases like compound networks.
Some people use the overlays as a highlight for many elements, but most people just use it to show the active state (usually one element).
It's fine as-is, and it's a good trade-off -- but we might want to do something about it in future. Some options for future:
- Note that WebGL handles overlays differently in the documentation.
- Change the WebGL approach to be like the canvas renderer.
- Change the canvas approach to be like the WebGL approach.
@mikekucera, looks good to merge |
@d2fong. Hi, Dylan. Just wanted to bring this to your attention re. the overlays. Whatever approach we take in future could be informed by what works best for Cytoscape Web. Does/will Cytoscape Web use overlays for things like highlighting/selections/search? |
I'm pretty sure that's not the case. It draws elements in z-index order, and for each node it draws underlay, body, label, overlay in that order. The code is here: |
Not enough sleep. My mistake |
No worries. Merging now. |
Associated issues:
Notes re. the content of the pull request. Give context to reviewers or serve as a general record of the changes made. Add a screenshot or video to demonstrate your new feature, if possible.
All node and label styles are fully supported. Nodes should look exactly the same with the WebGL renderer. The existing Canvas renderer is reused by the WebGL renderer. Nodes are rendered off-screen to a “sprite sheet” using the Canvas renderer and then used as textures by the WebGL renderer. This allows nodes to look the same while leveraging hardware acceleration. Each node only needs to be drawn to the sprite sheet once, then offloaded to video memory where it can be rendered repeatedly by the GPU. This approach also has the advantage that future contributions of new visual styles to the Canvas renderer should automatically work with the WebGL renderer as well.
Creating the sprite sheets does take some time when the network is first loaded. The preview release does not have a progress bar for this initial load time, so keep in mind that if your network doesn’t show up right away that just means it needs a few seconds to load.
Edge rendering has some limitations. It would not be advantageous to use the same sprite-sheet strategy for edges that is used for nodes. The strategy for this first release is to render straight edges as long skinny rectangles, and bezier edges as a sequence of straight segments that approximate a curve.
Checklist
Author:
unstable
. Bug-fix patches can go on eitherunstable
ormaster
.Reviewers:
master
branch and theunstable
branch. Normally, this just requires cherry-picking the corresponding merge commit frommaster
tounstable
-- or vice versa.