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

explore alternative render techniques #116

Closed
1 of 5 tasks
cztomsik opened this issue Jul 20, 2019 · 6 comments
Closed
1 of 5 tasks

explore alternative render techniques #116

cztomsik opened this issue Jul 20, 2019 · 6 comments

Comments

@cztomsik
Copy link
Owner

cztomsik commented Jul 20, 2019

there are some issues with webrender, mostly the complexity which is implied by the fact that the whole thing was designed for a web browser, it has a lot of deps & doesn't support gles2/webgl

pathfinder might be an alternative (doesn't support gles2 but at least they're planning webgl version) however then we would need to deal with:

  • images (not sure how to mix paths with texture)
  • shadows (in correct order)
  • clip images in border-radius?
  • scrolling
  • hit testing

another very interesting approach is what makepad is doing but that has a bit easier task because of layout which is part of the rendering and I think it's also missing shadows, clipping (overflow: hidden), and similar things I really want to support

from the talk I've found, there's some shader library which might be useful (at least for inspiration)

maybe doing some simplified webrender might be possible too

relates to #110 #103

another lib (requires gl3) https://github.com/intel/fastuidraw

@cztomsik cztomsik changed the title explore pathfinder explore alternative renderer techniques Jul 21, 2019
@cztomsik cztomsik changed the title explore alternative renderer techniques explore alternative render techniques Jul 21, 2019
@cztomsik
Copy link
Owner Author

I'm going try something myself, here's a repo https://github.com/cztomsik/new-hope

@hmil
Copy link

hmil commented Aug 23, 2019

Hi @cztomsik ,

Awesome project you've got going here.

This issue stirred up my curiosity. I thought webrenderer provided a higher level API than, say skia or pathfinder, and performed a lot of work under the cover (culling, compositing, animating). I'm curious why would you want to go back to lower-level primitives and have to deal with all of this stuff yourself?
Being aware of the general requirements of UIs, but free from actual DOM or CSS implementations, webrenderer looked like the ideal candidate for a project like this.

Also, (sorry for drifting off-topic here) why were you using pango? Wasn't webrenderer supposed to handle text rendering?

I would highly appreciate if you could help shed light on the obscure arcanes of webrenderer, as I am myself a total noob in this domain.

Thanks.

@cztomsik
Copy link
Owner Author

Hey, thank you for your kind words and also for your interest :)

I've written about some of the reasons in a blog post but you're right webrender does a lot and I'm basically throwing away a lot of effort from people smarter (and definitely more experienced in that area) than me.

In short, I think it's not that hard and I think I can do it with less memory and CPU overhead (I want to use it on raspi 3 A+ and that is very, very slow and webrender does not support it anyway). I have no numbers but I really think webrender would be too slow there.

For example with webrender you need to build the whole scene every frame, then it is serialized & sent to a different thread just to be deserialized again and the frame can be rebuilt to a different structure(s) and only then it starts to actually prepare some data for GPU. All of this is killing raspi. I want to do it in a classic, stateful way so that if there's little change, it should do little work and to actually be as direct as possible.

I'm also not re-creating a browser here, it is intentionally going to miss some of the web legacy which webrender has to support in order to be useful for firefox and it's also kinda expected for a browser to have some overhead. Webrender is fast but they are not aiming for low-overhead, they are optimizing for the worst cases and performance cliffs.

About pango, all what webrender does is that is can rasterize glyphs to a glyph atlas using freetype (or pathfinder in future). All of the actual text layout is left to gecko and so I had to solve it somehow. At first, pango looked like a quick win but unfortunately, pango leading is not directly translatable to the line-height and so I had to compute glyph positions myself and then I've lost all of the international layouting and so I've just decided to drop it for now and replace it with something else in the future.

If you want to hear anything more about webrender (and I will be able to answer it), you can reach me in our discord channel or just tweet me.

@hmil
Copy link

hmil commented Aug 25, 2019

Thanks for your answer.

I read the blog post and I think it makes total sense when you say that relying on a large oss library you don't fully understand can add bugs, development time and make things harder. Especially if it's to realize a year later that this lib was doing exactly what you thought it was.
This definitely answered my question.

I still have a question regarding how you plan to handle text, but I'll take it to a different issue as it is not closely related to this issue.

@cztomsik
Copy link
Owner Author

relates to #119

@cztomsik
Copy link
Owner Author

still not 100% done but enough to close this

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

No branches or pull requests

2 participants