top | item 40288507

(no title)

tylerekahn | 1 year ago

I'm curious why Zed chose Blade over wgpu/wgpu-hal.

There's a bit of detail here: https://github.com/zed-industries/zed/issues/7015

But I'd be curious to read a longer writeup on the tradeoffs and how they came to their decision.

discuss

order

mikaylamaki|1 year ago

Partially because Kvark, who has a long history in graphics programming, was enthusiastic about it, and has similar values of simplicity and effectiveness to our own. Mainly because our renderer is simple enough that we would have preferred to use Vulkan APIs directly, rather than going through wgpu. Blade is a thinner abstraction than wgpu, it's a bit more ergonomic than wgpu-hal, and it already supports our long term platform goals (Linux, Windows, and the web though via WebGL). So far, it's been running flawlessly, and it's been everything else that's the hard part!

nasso_dev|1 year ago

wgpu (and webgpu more generally) is often presented as a very good choice for a cross platform low level graphics api. but it was designed around safety/security constraints to support the web, sometimes at the cost of performance (my understanding)

i heard somewhere this nice example: only big actors like AAA game engines would really benefit from the extra development effort it would take to use an even lower level api like vulkan/dx12 to squeeze the last 10% of performance that wgpu can't get you

so if i understand correctly, zed, just like a AAA game engine, wants to squeeze every last bit of performance from the gpu, and so wgpu is "too high level" for it? and blade is "like wgpu, but no design tradeoffs and lower level" so its a better fit? does that mean someday zed might reach for vulkan directly one day? im assuming dx12 is gonna be used on windows anyway?

i love kvark's work btw, we need more kvarks

Pannoniae|1 year ago

This is a pretty good answer: https://github.com/gfx-rs/wgpu/tree/trunk/wgpu-hal

The "design of WebGPU" is a problem. It's designed for the web to be secure and sandboxed so the API design reflects that. This is not a good thing on desktop.

adwn|1 year ago

> The "design of WebGPU" is a problem. It's designed for the web to be secure and sandboxed so the API design reflects that.

The page you linked clearly states that wgpu-hal's API is extremely unsafe and skips many checks in order to reduce overhead. So while "secure and sandboxed" explains why wgpu wasn't chosen, it doesn't explain why wgpu-hal wasn't chosen.

zie|1 year ago

I imagine having a great PR magically show up that used Blade had a lot to do with it.