Live data from Hacker News

I learned Vulkan and wrote a small game engine with it

edw.is

171–180 of 268 posts

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

#171

Earlier quoted context omitted.

Yeah, somehow I think putting this one on multi-million dollar companies with budgets to work on graphics work for products they sell and make actual money off of is better than having some podunkian whose popular graphics library gets consumed by a bunch of people while they make $5 each from less than 1% of their users off Patreon and GitHub Sponsors.

Those multi-million dollar companies working on graphics libraries exist. Their names are Epic Games and Unity. Unfortunately, multi-million dollar companies want to make a profit, not give away their product for free.

Those aren't graphics libraries.

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

#172

Earlier quoted context omitted.

Even more confused now, lol. (edit: thanks for editing your post. the revised version clears it up!)

Vulkan, Direct3D, Metal and OpenGL are graphics APIs - the implementation comes with your GPU driver, and they're as close as you can reasonably get to writing code "directly for the GPU". When you call a Vulkan function you're directly calling driver code. 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 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.

I think that’s understating the relationship a bit. The wgpu API follows the WebGPU spec quite closely. It’s like saying “taffy isn’t flexbox”. You can make a technical argument that it’s not identical, and to be flexbox it must be in a browser, but anyone working with taffy will recognize that it’s implementing flexbox and will find that all their understands of flexbox apply to taffy.

Similarly, most of what I’m learning working with wgpu (outside of, maybe, threading), is directly transferable to WebGPU. And vice versa.

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

#173
post #52

Earlier 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.

Valve's efforts on playing Microsoft only games started ~10 years ago with Proton (which is more like an umbrella project for ~15 software components like Wine and DXVK). Today, proton is surprisingly good. Their bet paid off, and allowed them to make SteamDeck. Most if not all new games play fine out of the box, with 0 tinkering. Older games sometimes have issues.

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

#174

I tried learning Vulkan a little more than a year ago and I have no desire to ever touch it again. It really bothers me that we're deprecating OpenGL and replacing it with something that's ridiculously hard to do anything simple (e.g. doing a spinning cube takes several hundred lines of code). OpenGL was never "easy" but it was at least something a regular person could learn the basics of in a fairly short amount of…

It really bothers me that we're deprecating OpenGL and replacing it with something that's ridiculously hard to do anything simple OpenGL is only deprecated on MacOS, AFAIK, it will exist for many years to come. I'm sure Vulkan is better in some regards but is simply not feasible to expect someone to learn it quickly. Vulkan is often said to be more of a “GPU API” than a high level graphics API. With that in mind, the…

> OpenGL is only deprecated on MacOS, AFAIK, it will exist for many years to come.

It's abandondend by Khronos and GPU vendors, which is pretty much the same thing as deprecated unfortunately.

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

#175

Earlier quoted context omitted.

It really bothers me that we're deprecating OpenGL and replacing it with something that's ridiculously hard to do anything simple OpenGL is only deprecated on MacOS, AFAIK, it will exist for many years to come. I'm sure Vulkan is better in some regards but is simply not feasible to expect someone to learn it quickly. Vulkan is often said to be more of a “GPU API” than a high level graphics API. With that in mind, the…

Everything you said is fine, and I'm ok with OpenGL being killed/downplayed/deprecated. What I would have really preferred is Apple releasing Metal as a standard that anyone could use. Metal is a pretty nice API that's fairly fun and easy to use. I feel like if we need a "next gen" version of a graphics API, I would have had Vulkan for super low-level stuff, and Metal or DirectX for higher-level stuff.

WebGPU is mostly very similar to Metal (except for a couple of overly 'rigid' parts which are mostly inherited from Vulkan - most importantly the resource binding via BindGroups and all-in-one PSOs).

Also, Metal isn't generally a high-level API, it has low-level features which are pretty much like Vulkan or D3D12, you just don't need to use those low level features if not needed.

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

#176
post #87

Earlier quoted context omitted.

A middle ground is webgpu. It is much less verbose than Vulkan and is guaranteed to run anywhere, including the browser. At the same time, it has access to "modern" features like compute shaders which would not be available in webgl. It also doesn't have much legacy cruft leading to multiple ways of doing the same thing, unlike opengl. The main advantage is that it's new, so there are many fewer tutorials available f…

Not to downplay it or anything, but I'm curious why webgpu is receiving so much attention? There have been many low-level cross-platform graphics abstractions over the years. The bgfx [1] project had its first commit ~12 years ago and it's still going! It's much more mature than webgpu. I'm guessing being W3C backed is what's propelling it? [1] https://github.com/bkaradzic/bgfx

One remarkable feature of WebGPU is that it has no undefined behaviour, traditional 3D APIs are riddled with subtle UB. It also receives much better testing across all sorts of hardware and driver configs, just by being integrated with web browsers.

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

#177
post #130
post #87

Earlier quoted context omitted.

Not to downplay it or anything, but I'm curious why webgpu is receiving so much attention? There have been many low-level cross-platform graphics abstractions over the years. The bgfx [1] project had its first commit ~12 years ago and it's still going! It's much more mature than webgpu. I'm guessing being W3C backed is what's propelling it? [1] https://github.com/bkaradzic/bgfx

webgpu is a modern graphics API for modern GPUs to replace/complement these two APIs in the browser: WebGL (a very limited outdated subset of OpenGL) and Canvas (basically WinAPI drawing from 2000s) It's heavily influenced by Metal (based on original work by Apple and Mozilla). People are talking about it because it's on the web and it's finally something modern to work with.

> webgpu is a modern graphics API

TBF, WebGPU is at least a decade behind too. For instance it implements a Vulkan-style rigid render pipeline model which even Vulkan is moving away from because it turned out too rigid. So once WebGPU becomes mainstream it may very well be the most "awkward" 3D API.

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

#178

I tried learning Vulkan a little more than a year ago and I have no desire to ever touch it again. It really bothers me that we're deprecating OpenGL and replacing it with something that's ridiculously hard to do anything simple (e.g. doing a spinning cube takes several hundred lines of code). OpenGL was never "easy" but it was at least something a regular person could learn the basics of in a fairly short amount of…

If you want OpenGL use ANGLE

https://github.com/google/angle

several phones now ship ANGLE as their only OpenGL support on top of their Vulkan drivers.

If you want a modern-ish API that's relatively easy and portable use WebGPU via wgpu (rust) or dawn (c++).

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

#179
post #93

This minimalism is very effective. I took the opposite approach, and it has cause great pain. I've been writing a metaverse client in Rust. Right now, it's running on another screen, showing an avatar riding a tram through a large steampunk city. I let that run for 12 hours before shipping a new pre-release. This uses Vulkan, but it has WGPU and Rend3 on top. Rend3 offers a very clean API - you create meshes, 2d text…

> WGPU doesn't support multiple threads updating GPU memory without interference

WGPU uses WebGPU and AFAIK no browser so far supports "threads". https://gpuweb.github.io/gpuweb/explainer/#multithreading https://github.com/gpuweb/gpuweb/issues/354

And OpenGL never supported "threads", so anything using OpenGL can't either.

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

#180

Earlier quoted context omitted.

Those multi-million dollar companies working on graphics libraries exist. Their names are Epic Games and Unity. Unfortunately, multi-million dollar companies want to make a profit, not give away their product for free.

Those aren't graphics libraries.

Didn't Unity and Epic have people working directly on the Vulkan specification? I remember reading a comment (maybe here!), way back during Vulkan's original release, where someone was screaming about how Vulkan was a conspiracy to make us dependent on giant, multi million dollar game engines.

I don't know about any conspiring, but I've thought about that comment often, because the result appears the same: The barrier to in-house game engine development has been risen further.

Post reply on HN