Live data from Hacker News

I learned Vulkan and wrote a small game engine with it

edw.is

51–60 of 268 posts

Re: I learned Vulkan and wrote a small game engine with it

#51
post #37

This 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…

the biggest part for me is the shader compiler. opengl has one built in, vulkan requires me to pull in yet another dependency i've heard that vulkan allows bindless textures now, so the descriptor nonsense is a bit less awful that it used to be vulkan is appealing, but there's a high initial cost that i don't want to pay

Vulkan is super appealing if you're in the industry and have the time and resources necessary to profit from its advantages. But if you're a single dev who wants to learn game engine design, you're going to have a bad time. Most people also don't get that game engine design is very far removed from actual game design. You can have a ton of fun learning math, physics and computer science when building an engine, but beware that you'll likely be mentally and physically exhausted long before you actually get to build a fun game.

Re: I learned Vulkan and wrote a small game engine with it

#52
post #14

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…

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.

Re: I learned Vulkan and wrote a small game engine with it

#53
post #37

This 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

#54
post #37

This 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…

I've heard the same thing about DirectX 12 vs DirectX 11. One book basically said that you will probably have worse performance in DirectX 12 vs DirectX 11 if you don't know what you're doing.

DirectX 12 only gets interesting when you want hardware raytracing support to make use of the new Nvidia cards on windows. Tbf that is pretty cool, which is why I actually dabbled with it a little. But it's not necessary for the vast, vast majority of graphics applications.

Re: I learned Vulkan and wrote a small game engine with it

#55
post #37

This 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?

There is the Zink project[1]. It is an OGL to Vulkan translation layer.

[1]https://docs.mesa3d.org/drivers/zink.html

Re: I learned Vulkan and wrote a small game engine with it

#58

Really nice article! I have some OpenGL familiarity and tried out Vulkan but bounced off of it due to all of the up-front complexity just getting something running. Might give it another shot now!

Thank you. The up-front complexity is still there and it might take quite a few days to see your first triangle. But I promise, everything will get much easier from that point. :)

The thing I'm most interested in doing when starting a new project is pretty much never to spend a few weeks and writing 10-20k LOC to get a triangle on the screen, I think I'll stick with OpenGL for the time being tbh

Re: I learned Vulkan and wrote a small game engine with it

#59
post #5

Earlier quoted context omitted.

It's not quite as bad as it used to be, various later additions to Vulkan like dynamic rendering have eliminated some of the complexity it originally had. Figuring out which subset you should be using is a challenge in itself though, especially since there's a lot of outdated introductory resources floating around which still promote the ultra-verbose Vulkan 1.0 way of doing things. If a tutorial tells you to use ren…

Do you have any recommendations for sources? I’ve used Vulkan Tutorial, which is a bit stale but I suppose still good for exposure. I’ve also used Vulkan Guide, before its latest overhaul. That one was educational. Not sure if I’ll be able to do their new guide, my laptop can’t run some of the more recent versions of Vulkan

Khronos overhauled their docs last year. I've found the "Vulkan Guide" easier to read than the spec.

https://docs.vulkan.org/guide/latest/index.html

Not to be confused with the tutorial you're referring to.

https://vkguide.dev

Re: I learned Vulkan and wrote a small game engine with it

#60
post #41

Earlier quoted context omitted.

There is a native API too, not just JS. You can link it into your game like any other library.

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.
Post reply on HN