I think vulkan is great, but its only purpose is to take full advantage of advanced GPU features. It also leads to better performance when using advanced GPU features compared to OpenGL. Generally, I feel OpenGL is the recommended route if you don't really aim for advanced rendering techniques. There are plenty 2D /lowpoly/ps1-graphics games right now, and those don't need to use vulkan. Vulkan is an example of how t…
Vulkan has advantages over OpenGL even if you don't care about visual fidelity. - No global state - You can select which GPU you want to use at runtime - OpenGL error handling is terrible - Validation layers!! - Cool official artwork - Fantastic documentation - You can upload data to the GPU asynchronously from a second thread in a sane way - Fancy GPU features - Mesh shaders, RTX
I learned Vulkan and wrote a small game engine with it
61–70 of 268 posts
Re: I learned Vulkan and wrote a small game engine with it
#62This might come off as a surprise to some people but getting good performance with Vulkan (compared to say OpenGL) isn't trivial because: the Vulkan driver is missing that ~20k loc of code that OpenGL driver does for you to set up the rendering pipelines, render targets etc. This is all code that already exists in the OpenGL driver and has been optimized for +20 years by the best people in the industry. So when you s…
Re: I learned Vulkan and wrote a small game engine with it
#63Earlier quoted context omitted.
I'm confused now. I thought by definition it's a browser API that allows them to make Vulkan/OpenGL/DirectX calls, like an abstraction layer. Am I wrong? Edit: wgpu is a reimplementation of the WebGPU api for use with desktop apps outside of browsers. See sibling thread by another poster for an explanation: https://news.ycombinator.com/item?id=40598416
wgpu isn’t a reimplementation of WebGPU, it’s Firefox’s WebGPU implementation. It also conveniently runs outside of a browser and is accessible with a Rust or C API. You can also do the same thing with Dawn, which is Chrome’s implementation of WebGPU.
Re: I learned Vulkan and wrote a small game engine with it
#64Earlier quoted context omitted.
That's just not true. https://wgpu.rs/ I'm literally writing native code running on linux with winit and wgpu right now.
Wait, is that the same as using WebGPU? It says outside of browsers it uses opengl and vulkan and directx.
wgpu is also not a graphics API, it's a library that abstracts the underlying graphics API.
Re: I learned Vulkan and wrote a small game engine with it
#65Earlier quoted context omitted.
Wait, is that the same as using WebGPU? It says outside of browsers it uses opengl and vulkan and directx.
wgpu is not WebGPU. One is a Web specification, the other is a Rust library. wgpu is also not a graphics API, it's a library that abstracts the underlying graphics API.
(edit: thanks for editing your post. the revised version clears it up!)
Re: I learned Vulkan and wrote a small game engine with it
#66This might come off as a surprise to some people but getting good performance with Vulkan (compared to say OpenGL) isn't trivial because: the Vulkan driver is missing that ~20k loc of code that OpenGL driver does for you to set up the rendering pipelines, render targets etc. This is all code that already exists in the OpenGL driver and has been optimized for +20 years by the best people in the industry. So when you s…
Could someone write an OpenGL to Vulkan layer as a library so that we can target Vulkan but at a higher level of abstraction? Then gradually we can replace that library with routines optimised for the use case?
Re: I learned Vulkan and wrote a small game engine with it
#67Lots of good advice in this article. One that stuck out to me: Don’t implement something unless you need it right now This is a constant battle I fight with more junior programmers, who maybe have a few years of experience, but who are still getting there. They are often obsessed with "best-practices" and whatever fancy new tool is trending, but they have trouble starting with the problem they need to solve and focus…
Re: I learned Vulkan and wrote a small game engine with it
#68I think vulkan is great, but its only purpose is to take full advantage of advanced GPU features. It also leads to better performance when using advanced GPU features compared to OpenGL. Generally, I feel OpenGL is the recommended route if you don't really aim for advanced rendering techniques. There are plenty 2D /lowpoly/ps1-graphics games right now, and those don't need to use vulkan. Vulkan is an example of how t…
Re: I learned Vulkan and wrote a small game engine with it
#69Earlier quoted context omitted.
Another good option is Direct3D 11. It’s IMO even easier to use than OpenGL but still allows to implement pretty good visuals, see GTA 5 or Baldur’s Gate 3.
Eh that's really only an option if you want to only ever target Microsoft platforms. Which is fine for some people, sure, but in a lot of situations, closing the door on Linux (Steam Deck), macOS, iOS, Android and the non-xbox consoles is a tough sell.
D3D11 gives you both desktop platforms that matter for games, everything else will require multiple backends anyway so if you only care about desktop it’s a fair choice.
Re: I learned Vulkan and wrote a small game engine with it
#70Earlier quoted context omitted.
wgpu is not WebGPU. One is a Web specification, the other is a Rust library. wgpu is also not a graphics API, it's a library that abstracts the underlying graphics API.
Even more confused now, lol. (edit: thanks for editing your post. the revised version clears it up!)
wgpu is a regular library that uses the native APIs above and abstracts them from you. I don't like calling it a graphics API because it implies it's the same as the vendor-provided APIs - it's a completely different beast.
WebGPU and WebGL are Web standards that the browser implements, and you program them via JS. Similarly to wgpu, they're implemented on top of the native graphics APIs.
The relationship between wgpu and WebGPU is that they're basically made by the same people, and in Firefox WebGPU is implemented on top of wgpu.
But saying "WebGPU runs everywhere" is plain wrong - it's a browser-exclusive API, and on top of that, at the point of writing this it doesn't even run on all browsers (71% support according to https://caniuse.com/webgpu)