Yea, wgpu is basically an adapting layer between the WebGPU API and opengl, vulkan, directx. So it's the same† API.
But WebGPU in the browser is also an adapting layer between those technologies, it's just the browser that does the adapting instead of the wgpu library. For Firefox, WebGPU is adapted to those underlying systems by wgpu: https://github.com/gpuweb/gpuweb/wiki/Implementation-Status
† There are some "native-only" extensions beyond the WebGPU spec that gpu provides, so it does go a little beyond WebGPU. But for the most part, it's very similar.
Wait... so if webgpu (the API) is to allow browsers to use the underlying graphics libs... but desktop apps can access those directly... why would they want to go through the browser abstraction API instead? Better dev ex and ergonomics?
> why would they want to go through the browser abstraction API instead? Better dev ex and ergonomics?
That and portability. The ergonomics are always up for debate, but I find it a much more modern and nicer interface than OpenGL which feels...quite dated. How it compares to something like Vulkan or Metal is up for debate.
But for portability if I write my code using directx, then I can only run it on systems with directx. If I write it for vulkan, I can only target systems with vulkan. If I write for metal, I can only target systems with metal.
However, if I use wgpu and the WebGPU API, I can target any system that has directx or vulkan or metal or OpenGL. I can also target wasm and compile my application for the web.
So, I can really easily write code that will run natively on linux, on osx, on windows and the web and will use the graphics library native to that platform.
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 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)
> 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.
That's fair, my comment did understate their relation quite a lot. They are very closely linked, to the point stuff has been added to the WebGPU spec pretty-much because "eh, it's already in wgpu".
But the "knowledge is transferable to WebGPU" is key. Even when you're compiling your wgpu code to WASM, you're not using WebGPU directly - for every API call, you're going through generated bindings on the Rust side and then generated bindings on the JS side where the actual call is made. The JS wrappers aren't trivial either - Rust structs need to be converted to the nested JS objects required by WebGPU spec, numeric enums need to be converted strings, etc.
Considering that WebGPU is supposed to be the low-level graphics API for the Web, DX12/VK/Metal equivalent, all this is at least worth a mention, and "wgpu == WebGPU" brushes over a all that, to the point where we're now casually throwing statements like "[WebGPU] is guaranteed to run anywhere, including the browser".
The amount that people go over the speed limit varies depending on the road conditions, what they think is safe, and what the speed limit is.
So, if a road feels "safe" at 60mph to people, and you put the speed limit as 20 the average traffic might be 40mph. If you put the speed limit as 40mph, it might go up to 55mph. If you put the speed limit as 60mph, it might go up to 65 mph.
But that natural tapering is what lets you find a stable value for a specific percentile threshold.
In all of that it’s worth pointing out 100 Americans were killed on the road today. 100 more will be killed tomorrow, and everyday.
I don’t feel like setting the speed limits at whatever people “think is safe” is a good idea, and the deaths confirm drivers are really, really bad at determining what is safe.
Sure, and I don't think anyone would accuse Texas of being a "vision 0" champion. I wasn't advocating for this as a method of setting speed limits, I was just explaining why this method doesn't lead to a runaway speed increases over time.
> But for the US, there's no question like that. It produces a lot lot more than it consumes anyway. There can't be a shortage.
It's a global commodity. The reason there likely won't be a shortage in the U.S. has little to do with our production volumes, and has more to do with the fact that we're rich enough to be able to afford the higher prices when many other countries will have to forgeo using oil.
But if we weren't a rich country and we couldn't afford to pay a higher price for oil than many other nations on earth, we would produce and export oil to people that can pay more.
Ireland during the famine produced enough food to feed every person. But much of it was exported to other places, that could afford to pay a higher dollar amount to survive.
The US is also sovereign and if things would become really bad the government would just ban exports.
Ireland wasn't sovereign and it turns out, as much as other countries act brotherly (not that the UK really did), nobody really cares about you like you care.
Depends what 'sovereign' implies. The will of the people? Or maybe the will of those that lobby government the hardest (e.g. oil companies)? If the latter, then export bans might not arrive anytime soon.
Sovereign doesn't mean any of those in this context. It means that the US can set its foreign and domestic policies as it pleases. How it decides those policies is another matter.
'Sovereign' here means that the US govt is able to impose export restrictions, not that the People's will or special interests' desires are relevant. Of course 'can' != 'will'.
For example, in the UK Parliament is sovereign, not the people. That's effectively how it is in representative democracies or republics where there is no fast representative recall mechanism.
The U.S. Constitution doesn't say that Congress is sovereign, but the effect is the same. For that matter, the U.S. President has a great deal of power.
Some countries rely on oil imports to produce agricultural products, and suddenly cutting them off the global market would kill hundreds of millions from hunger over the next year. Look at what happened in Cuba. Without china giving them old solar panels and used batteries, they would have revolted already. They still have a huge food insecurity issue for next year, especially if the huricane season gets bad.
Britain was barely democratic at the time of the famine. It’s silly to blame the current generation for something their ancestors did. Even if the people you are complaining about were alive then they were unlikely to have any influence over the situation.
Thing is, if there is a worldwide shortage, US wins.
To the benefit of those on the political left, an oil shortage shows itself almost exclusively in poor countries (because they actually don't have money to pay), and these tend to not have automotive industries of their own, thus have no reservations about switching to electric cars, which means that any oil consumption decline these days tends to be sticky - when the oil flow resumes, these people won't need it anymore. No one is going to get back to driving an ICE car once they tried electric, even if they initially did it under duress.
It’s a global commodity unless there are export restrictions. Russia maintains petrol/diesel prices way below world level thanks to export ban among other things. China did impose temporary export restrictions too. I would not be surprised if Trump will eventually impose export restrictions on refined products to maintain low domestic prices.
> I really tend to dislike when people outside e.g. the EU comment on our politics
We, uh… started a war that we’re trying to drag many European countries into, and we spent a good chunk of the last year threatening to invade a member of the EU. We’re on and off about trying to start a trade war with the EU.
At this point, you have absolutely every right to comment on our politics, pretty much however you want.
reply