zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.9k stars 2.82k forks source link

Render to framebuffer #12332

Open turbolent opened 4 months ago

turbolent commented 4 months ago

Check for existing issues

Describe the feature

What would it take to implement a renderer for Zed/gpui to render to non-accelerated target, like a basic framebuffer?

This would allow porting Zed to other platforms and older systems.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

jansol commented 4 months ago

On Linux it is possible to use libdrm to render to the screen using Vulkan/EGL but without X11 or Wayland. You could use a software implementation of Vulkan to do this in order to get "non-accelerated" rendering. (of course it would be very slow though, so older systems won't gain much from that)

What platform/system did you have in mind, specifically? It may be possible to e.g. get it to work with blade's OpenGL ES 3.1 backend if Vulkan is not available.

turbolent commented 4 months ago

Thanks for the pointer!

I'm mostly interested in non-accelerated targets or older systems which have accelerated graphics, but only support old standards (OpenGL <1.3, no modern OpenGL/OpenGL ES/Vulkan/etc).

In particular, it would be nice to be able to build Zed/gpui for WebAssembly, so it could be ported to e.g. browsers, but also through that to many other operating systems, architectures, and older hardware, by using https://github.com/turbolent/w2c2.

jansol commented 4 months ago

A web version of Zed is on the far-future roadmap AFAIK. That one will require a whole new "platform" in GPUI with a custom renderer implementation (based on WebGL? Canvas? DOM? idk).

If you really wanted to add a pure software renderer implementation for use on systems without any sort of graphics support that's certainly possible. On macOS it's possible to choose between the metal and blade renderers in GPUI at build time. You could use the same method to build GPUI with a CPU / legacy OpenGL renderer.

dagbdagb commented 4 months ago

One could possibly patch GLFW to work on top of glfbdev. If the latter even exists in upstream mesa. Fair bit of work for non-accelerated rendering. Or zink on top of kms-vulkan. Equally theoretical, and would need plenty work.