-
Notifications
You must be signed in to change notification settings - Fork 121
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
Work in progress xilem prototype #1
Conversation
This is a snapshot of the current state of the xilem prototype built on new infrastructure: glazier for window creation, piet-gpu for drawing, and parley for text. As of this snapshot, only the text widget has been ported, and there are a number of rough edges. It should be considered a proof of concept. That said, it should be possible to build more from here.
I've chosen not to deny warnings in CI because we currently have warnings. Once #1 lands, we can enforce cleanliness of warnings
We don't deny warnings in CI because we currently have warnings. Once #1 lands, we can enforce cleanliness from warnings See also linebender/glazier@d0b9e19 as we only use windows at the moment
I guess this question is more for piet-gpu, but how are we going to manage the text rendering on different platforms? Like you'll probably need sub-pixel rendering for Windows, but not necessary for Macs. |
Thanks. I can see it's a discussion of the mechanisms of text rendering. My question is more user level, i.e. does text look the same or different across different OS, or Xilem will expose some API for you to choose. |
Hm. I suppose we can always expose a config to, say, enable font dilation on Windows or sub-pixel rendering on Mac, but generally I'd say it defaults to replicating the platform's native way of rendering fonts. |
Blurry text is tracked in linebender/glazier#26, it's a DPI scaling problem. Regarding glyph rendering, that is a question for piet-gpu, and a very interesting one. I just wrote linebender/vello#204 to capture my current thoughts. It's subject to discussion, and may well affect a decision of when and whether to depend on this stack. |
This is a mostly working button implementation, but the background (a gradient) isn't rendering yet. When it is, I'll likely merge the PR.
This adds the rendering of the gradient to the button widget. The "piet_scene_helpers" module is a bit hacky, we'll need to have some discussions about how to handle kurbo shape types more easily. But it should work for now.
Trying this on Linux with Gnome/Wayland. The edit: It was running on wayland but as an X client, if I try to run with "wayland" feature on glazier it panics:
|
Thanks for trying it! I haven't tested on anything but mac yet. The lack of mouse sensitivity sounds like a problem, we'll need to investigate it. I'm not sure what exactly is wrong with quitting, that appears to be a glazier issue (the code in xilem is adding the quit item to the menu). The panic on Wayland looks similar to this observation. Again I think the best place to fix this is glazier. |
Right, I also get no menu, so maybe that's related, but I see no logs in the console that could help: Edit: Running the glazier example I see that menus are not implemented yet, so that's not an issue with this PR.
|
Testing on Windows 10 with AMD Ryzen 3600 and GTX 1050ti, leads to the window not responding before I can take any actions. |
I've tested the glazier-shello example on Windows, but not the integration with piet-gpu. Unfortunately, I'm at the office right now without easy access to a Windows machine. I can take another look when I get home. |
I do repro the "render one frame then hang" behavior with Windows, and also note that it's the same with glazier-shello. This is very likely a glazier problem and I can probably track it down. Small update: https://github.com/dfrg/piet-gpu/tree/dshell/examples/shello had this working correctly on Windows (using the unpiet branch of druid-shell), and something broke along the way to the latter becoming glazier. It should be possible to track down either through looking at what changed, or debugging the current state. |
The Windows hang is fixed by linebender/vello#207. The reason the shello example worked is that the branch predated the robust memory work. So this was not in fact a glazier problem. |
On actual wayland (
With the |
Allow selecting the glazier backend on Linux
It wasn't my intention to get my PR merged into this one without Raph's consent, so in case that is unwanted, please just force-push away and I'll re-open / re-create my PR after this is done. |
No worries, it's all good. Very likely it'll be helpful for fixing and validating the panic on Wayland, which I intend to do later today. |
Should fix crashes on Wayland in particular. Also snap to newer deps, which should fix hang on Vulkan.
We should now be able to handle window events before the first paint. Also I snapped Cargo.lock to newer github versions. There's lots to do still (including some work on dpi that I'm seeing), but I'm wondering if this might now be "good enough" to merge, and future work on top of it. |
I have an eGPU ( Nvidia GTX 1080 ) I can connect to my laptop (Intel HD graphics) so I am able to test a couple of different configurations:
hope this helps. on windows it runs now for me! |
Thanks for the reports. We're going to switch to wgpu soonish, so it doesn't make sense to go too deep into compatibility issues just now, though it would make sense to fix obvious breakage. |
Ok, now the x11 backend works. It takes some time (~1 second) to get from window creation to the button appearing, but then both the button and closing the window work. With the Same behaviour with intel integrated and rtx3050 |
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.
Excited to land this!
New tracy image: ![image](https://github.com/user-attachments/assets/94e54c89-8159-4dd4-a521-4a7122f64375) New log tracing file: <details><summary>An overview of the new logs</summary> <p> ``` 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}: masonry::passes::update: RootWidget received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}: masonry::passes::update: SizedBox received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}:Flex{id=#3}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}:Flex{id=#3}:Prose{id=#1}: masonry::passes::update: Prose received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}:Flex{id=#3}:Label{id=#2}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}:Flex{id=#5}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#8}:SizedBox{id=#7}:Flex{id=#6}:Flex{id=#5}:VariableLabel{id=#4}: masonry::passes::update: VariableLabel received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#10}: masonry::passes::update: Button received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#10}:Label{id=#9}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#12}: masonry::passes::update: Button received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#12}:Label{id=#11}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#14}: masonry::passes::update: Button received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#14}:Label{id=#13}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#16}: masonry::passes::update: Button received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Flex{id=#17}:Button{id=#16}:Label{id=#15}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}: masonry::passes::update: Portal received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}: masonry::passes::update: SizedBox received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}:Flex{id=#20}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}:Flex{id=#20}:Prose{id=#18}: masonry::passes::update: Prose received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}:Flex{id=#20}:Label{id=#19}: masonry::passes::update: Label received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}:Flex{id=#22}: masonry::passes::update: Flex received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#24}:Flex{id=#23}:Flex{id=#22}:VariableLabel{id=#21}: masonry::passes::update: VariableLabel received Update::WidgetAdded 14:37:40.365Z TRACE update_new_widgets:RootWidget{id=#165}:Flex{id=#164}:Portal{id=#163}:Flex{id=#160}:SizedBox{id=#31}: masonry::passes::update: SizedBox received Update::WidgetAdded ``` </p> </details> This was originally an experiment into caching spans, but I determined that was non-viable due to the pass names.
This is a snapshot of the current state of the xilem prototype built on new infrastructure: glazier for window creation, piet-gpu for drawing, and parley for text.
As of this snapshot, only the text widget has been ported, and there are a number of rough edges. It should be considered a proof of concept. That said, it should be possible to build more from here.