alacritty icon indicating copy to clipboard operation
alacritty copied to clipboard

Add a Vulkan Renderer

Open LizziAS opened this issue 8 years ago • 21 comments

https://forum.manjaro.org/t/alacritty-a-gpu-accelerated-terminal-emulator/15234

and as Tids says: Why not vulkan?

LizziAS avatar Jan 07 '17 14:01 LizziAS

I don't think there is any real reason to use Vulkan for this sort of application. It already runs at a very high frame rate that the extra work to get Vulkan working wouldn't really provide any real benefit.

CarwynNelson avatar Jan 07 '17 15:01 CarwynNelson

I'm hoping to have a Vulkan renderer at some point, but OpenGL made sense as an initial target since it's supported everywhere Alacritty cares about.

jwilm avatar Jan 08 '17 00:01 jwilm

I don't use a Mac myself but maybe MoltenVK can be used to support Vulkan on OS X?

atopia avatar May 31 '18 15:05 atopia

I think that what @CarwynNelson said is probably accurate, it's very possible that Vulkan would provide no benefit in performance while being a lot of work to get going and working everywhere.

However I'd love to be surprised by this, but I don't think there's any kind of priority on testing this out (which is why this has the "P - low" tag).

If there is a vulkan renderer in the future though it would be nice to use something like MoltenVK (or whatever is available when that happens).

chrisduerr avatar May 31 '18 15:05 chrisduerr

OpenGL is being deprecated on macOS.

Avi-D-coder avatar Jun 05 '18 04:06 Avi-D-coder

I've read the same thing @Avi-D-coder. For now that probably doesn't change much, because I don't expect MacOS to drop OpenGL in under a year. However it would probably still be a good idea to have a long-term plan on how to fix this.

chrisduerr avatar Jun 05 '18 14:06 chrisduerr

@jwilm

OpenGL made sense as an initial target since it's supported everywhere Alacritty cares about.

We'd love to use alacritty on Fuchsia, but we don't have support for OpenGL. If you can provide mentoring instructions, I'm sure there are folks at Google who would be interested in helping to add support!

cramertj avatar Jun 26 '18 21:06 cramertj

I can't speak for jwilm but I think any help would be greatly appreciated!

If it is desired to support multiple different render backends without having to implement everything over and over again it could also pay off to look into something like gfx-rs.

chrisduerr avatar Jun 26 '18 21:06 chrisduerr

Have you looked into these?

  • https://github.com/MaikKlein/ash
  • https://github.com/vulkano-rs/vulkano

luisdavim avatar Apr 06 '19 07:04 luisdavim

I've done some reading around gfx-rs and https://github.com/gfx-rs/wgpu seems very interesting and promising.

luisdavim avatar Apr 06 '19 07:04 luisdavim

I feel like changing Vulkan to OpenGL won't gain much for us, however using gfx-rs makes the most sense for us, if we want to support macOS via Metal or provide an option to pick OpenGL/Vulkan on Linux/Windows. So, while Vulkan is nice, I don't see any point in changing our rendering to anything other than gfx-rs.

kchibisov avatar Mar 17 '20 09:03 kchibisov

The biggest problem with both gfx-rs and wgpu is that both lack good OpenGL support. Which will likely always be our primary focus. So an API that doesn't properly support this is not very useful to us.

chrisduerr avatar Sep 21 '20 09:09 chrisduerr

The biggest problem with both gfx-rs and wgpu is that both lack good OpenGL support. Which will likely always be our primary focus. So an API that doesn't properly support this is not very useful to us.

Why does Alacritty need OpenGL support so badly? Wouldn't it be more performant (and modern) to use wgpu, since it abstracts away the 3 major graphics APIs (Vulkan, Metal, DirectX) anyway? It also provides first class Rust support, apparently.

ghost avatar Jan 10 '22 20:01 ghost

Why does Alacritty need OpenGL support so badly? Wouldn't it be more performant (and modern) to use wgpu, since it abstracts away the 3 major graphics APIs (Vulkan, Metal, DirectX) anyway? It also provides first class Rust support, apparently.

Alacritty was written with OpenGL before wgpu existed iirc.

kchibisov avatar Jan 10 '22 20:01 kchibisov

Why does Alacritty need OpenGL support so badly? Wouldn't it be more performant (and modern) to use wgpu, since it abstracts away the 3 major graphics APIs (Vulkan, Metal, DirectX) anyway?

Why do you think that abstractions would make things more performant? It's usually the opposite way around.

OpenGL is the best target because "newer" APIs are useless to Alacritty and OpenGL has much better compatibility with old hardware. Basically no reason not to use OpenGL really.

chrisduerr avatar Jan 10 '22 20:01 chrisduerr

i run neovim on tmux on alacritty and am wondering about 3d rendering within this setup -- i'd like to build or find some way to edit and view wireframe meshes/3d objects, rotate/zoom/interact with vim keys, as well as view audio signal spectrums, manipulate audio samples, etc without leaving the alacritty instance or relying on the host windowing system.

what do you folks think of this use case? is there a fluid way to perform these operations or is it something which has yet to be unearthed?

klebs6-x avatar Mar 19 '22 07:03 klebs6-x

what do you folks think of this use case? is there a fluid way to perform these operations or is it something which has yet to be unearthed?

It's completely inappropriate for a terminal emulator.

chrisduerr avatar Mar 19 '22 09:03 chrisduerr

it may be completely inappropriate for your terminal emulator, but not for mine

klebs6-x avatar Mar 19 '22 20:03 klebs6-x

Well, Alacritty is mine. :wink:

Of course I won't come after you if you decide to implement it yourself in your own fork. That's what forking is for after all.

chrisduerr avatar Mar 20 '22 02:03 chrisduerr

fair enough in all respects. it is a wonderful piece of software which is why i use it -- the fastest component out there by my count.

i read this thread about integrating vulkan, other gpu layers and considered that you folks may understand deeply what i might need to do to achieve this sort of function, even though it is not the common use case.

it is useful to me even though it is perhaps not useful to you

klebs6-x avatar Mar 20 '22 03:03 klebs6-x

Well, Alacritty is mine. 😉

Alacritty is also my terminal. Just saying.


Seriously though, just because we look at GPUs to render 2D graphics doesn't mean we have anything to do with 3D graphics. I think on principle, a terminal emulator is fundamentally a 2D tool for rendering a text based interface. Any discussion outside these bounds is sure to meet resistance. Just look at the fate of image rendering in the terminal for a good example.


@klebs6, perhaps look more into Rust GPU libraries instead of application projects.

nixpulvis avatar Mar 28 '22 16:03 nixpulvis

Closing because this is a non-goal. If someone ever bothers to write a Vulkan renderer feel free to send a patch, but currently we already have two different OpenGL renderers and that strikes a very good balance between GPU support and performance. Writing a Vulkan renderer would neither improve performance nor support much.

chrisduerr avatar Nov 23 '22 21:11 chrisduerr

FYI: cosmic-term is alacritty + vulkan.

sgon00 avatar Feb 05 '24 08:02 sgon00

They currently massively outperform alacritty on vtebench which makes it an interesting watch to see how this changes further into development

AethanFoot avatar Feb 27 '24 22:02 AethanFoot

They currently massively outperform alacritty on vtebench which makes it an interesting watch to see how this changes further into development

This means absolutely nothing. The things you should be comparing are render times, not vtebench. Vtebench only benchmarks the parser which is identical in both. In fact a significantly slower terminal would often perform better than a faster one, since it has to interrupt the parser less.

chrisduerr avatar Feb 28 '24 00:02 chrisduerr

They currently massively outperform alacritty on vtebench which makes it an interesting watch to see how this changes further into development

if one alacritty_terminal outperforms other alacritty_terminal it should at least provide a link to how it was setup, but cosmic term has rather slow render.

kchibisov avatar Feb 28 '24 05:02 kchibisov

I wasn't saying as the end all be all (although you seem to heavily rely on it) (and I tend to like my terminal to load as fast as possible anyway so I can immediately initiate commands) . It was more an interest to see how it may develop to see if vulkan shows worthy improvement opengl in terms of 2d rendering a terminal (which is why I didn't bother quoting numbers).

AethanFoot avatar Feb 28 '24 19:02 AethanFoot

alacritty renders like ~1000 frames(simple scenes) and ~400(complex scenes) per second with A750 and even achieves 60fps on low end arm boards where vulkan doesn't exist.

I'm not against using e.g. wgpu because OpenGL is wacky on macOS/Windows, but it's a different matter and I'd rather focus on OpenGL side of things for now.

kchibisov avatar Feb 28 '24 19:02 kchibisov