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

Linux port via Blade #7343

Merged
merged 53 commits into from
Feb 7, 2024
Merged

Linux port via Blade #7343

merged 53 commits into from
Feb 7, 2024

Conversation

kvark
Copy link
Contributor

@kvark kvark commented Feb 3, 2024

Motivation

I ❤️ Zed! It's lightning fast and has great UX. I want it to run as well on all major platforms. I'm currently using Linux most actively.
Blade is a good candidate for providing GPU access: it supports Vulkan, Metal, and GLES/WebGL. Its abstraction is extremely thin, while having one of the nicest GPU APIs. Codebase is also tiny. Checkout the meetup recording from a year ago.
I believe these projects make a good match 🚀 !

Why this is a bad idea

If Zed team wants to use off-the-shelf components from Rust ecosystem, then Blade is certainly at disadvantage here, since it's not widely used. It would rely on Zed team adding necessary features in a branch, then maybe upstreaming some of them. That is to say, it's unclear if this can be avoided with more popular alternatives - being flexible with any local changes is a good ability.

Why it's not too bad

Blade uses WGSL shaders, similar to wgpu and arcana, but without the binding decorations. So this aspect of the product is nicely portable.

Progress

  • Platforms
    • X11 (via xcb)
      • input handling
      • get proper content size
    • Windows
    • Replace the existing Metal backend
  • Text System
    • shaping
    • glyph rasterization
  • Texture atlas
  • Rendering
    • basic primitives
    • path rendering
    • sprite rendering
  • media surfaces
  • CI

Current status

Zed starts up but crashes on text-system related checks.
zed-linux-1

Copy link

cla-bot bot commented Feb 3, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @kvark on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@kvark kvark marked this pull request as draft February 3, 2024 22:29
@kvark
Copy link
Contributor Author

kvark commented Feb 3, 2024

@cla-bot check

Copy link

cla-bot bot commented Feb 3, 2024

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 3, 2024
@williamdes
Copy link
Contributor

Thank you, after kvark@88dfb35 that installed the missing dependency.

I now have this crash:

trace

VUID-VkSwapchainCreateInfoKHR-imageExtent-01274(ERROR / SPEC): msgNum: 2094043421 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x5650fc2070c0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1920,1080), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1920,1024), minImageExtent = (1920,1024), maxImageExtent = (1920,1024). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-khr-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
    Objects: 1
        [0] 0x5650fc2070c0, type: 3, name: NULL
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: glyph not found for character 'm'" at crates/editor/src/element.rs:1907:18
   0: Zed::init_panic_hook::{closure#0}
             at crates/zed/src/main.rs:583:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
      std::panicking::rust_panic_with_hook

@kvark
Copy link
Contributor Author

kvark commented Feb 6, 2024

@williamdes yes, that's the big boss of the text system missing. Looks like the suggested path to it is implementing cosmic_text.

@williamdes
Copy link
Contributor

I do not know where 7509677 comes from but:

/cc @mikayla-maki
The packages in the commit do not exist on Debian 12

@h3mosphere
Copy link
Contributor

@aminya: Can you try the following branch: https://github.com/h3mosphere/zed/tree/resize-on-draw

I had the same issue, this is probably a performance killer until @kvark can work out a better solution. But it works for me.

After kvark#2, I also get a white screen for a second. This is the error I get then resulting in a crash:

@aminya
Copy link
Contributor

aminya commented Feb 6, 2024

I do not know where 7509677 comes from but:

/cc @mikayla-maki The packages in the commit do not exist on Debian 12

It reverted it in kvark#2. cause it also causes conflicts.
@mikayla-maki was this commit intended? If so, could you create pull requests instead of directly pushing?

@mikayla-maki
Copy link
Contributor

@aminya, sorry about that meant to push to a branch. Thanks for fixing things :)

@noverby
Copy link

noverby commented Feb 6, 2024

@bhavya3024 No, there is still missing essential functionality. E.g. font rendering.

aminya and others added 4 commits February 6, 2024 22:54
* fix: avoid panics in case of non-existing path for watching

* fix: copy the themes and plugins

* Revert "add a few more libraries to the linux script"

This reverts commit 7509677.

* fix: add vulkan validation layers to the system deps

* fix: fix the themes paths
@mikayla-maki mikayla-maki marked this pull request as ready for review February 7, 2024 19:53
@mikayla-maki mikayla-maki mentioned this pull request Feb 7, 2024
12 tasks
@mikayla-maki mikayla-maki changed the title [unofficial] Linux port via Blade [official] Linux port via Blade Feb 7, 2024
@mikayla-maki mikayla-maki merged commit 5ded865 into zed-industries:main Feb 7, 2024
5 checks passed
@mikayla-maki mikayla-maki changed the title [official] Linux port via Blade Linux port via Blade Feb 7, 2024
@kvark kvark deleted the blade branch February 10, 2024 23:36
@RustoMCSpit
Copy link

Zed team wants to use off-the-shelf components from Rust ecosystem, then Blade is certainly at disadvantage here, since it's not widely used. It would rely on Zed team adding necessary features in a branch, then maybe upstreaming some of them.

they could also just offer its developer a full-time, work-at-home job as theyre more proficient with linux and they could then gear blade into its direction rather than other way round. just throwing the idea out there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants