12 ms·
Point of WebGPU on Native
- davedx 7y ago> Besides, real Vulkan isn’t everywhere. More specifically, there are no drivers for Intel Haswell/Broadwell iGPUs on Windows, it’s forbidden on Windows UWP (including ARM), it’s below 50% on Android, and totally absent on macOS and iOS. Vulkan Portability aims to solve it, but it’s another fairly complex layer for your application, especially considering the shader translation logic of SPIRV-Cross, and it’s still a WIP. Wow. Has Vulkan failed as a standard then? I'm interested in this area but came away from the article feeling extremely confused about what the future of portable graphics programming looks like. I know despite the hopes for WebGPU there's NWIH I will invest time learning it while everything is so up in the air. OpenGL is great despite its warts, I've had a lot of fun programming with it over all the years.
- xt00 7y agoVulkan was not well supported in android until around android 9. In android 10 I believe it can run skia using vulkan (somehow). And broadly vulkan is still in the adoption curve — so seems too early to say vulkan is failing —it’s still quite new.
- pjmlp 7y agoVulkan started as optional API on Android and its support is so bad outside Google and Samsung flagship devices, that with Android 10 Google made it a required API with respective OEM acceptance tests. Yet, the numbers are so tiny that Google has yet to bother to list them on Android Dashboard, https://developer.android.com/about/dashboards https://developer.android.com/about/dashboards Last update was on May 1, 2020.
- flohofwoe 7y agoTBH (and IMHO of course) both OpenGL and Vulkan aren't all that great APIs to work with. OpenGL was a nice API up until early 2.x versions, after that the move away from the fixed-function-pipeline would have needed a clear cut instead of the gradual stacking of new features, and since then two or three other of such "clear cuts" would also have helped, similar to how each new D3D version was incompatible with the previous version (but still supported for a long time). Vulkan had a problem right from the start that it had to wrap an explicit low-level API over very different GPU architectures. And without the "wiggle room" of more abstract APIs this ended up in a complex API and high number of vendor-specific extensions in a very short time. As a result Vulkan was already bigger and more complex right from the start than OpenGL was after two decades.
- gnulinux 7y agoI'm personally pretty comfortable with OpenCL and "old" OpenGL (i.e. using immediate point API which is deprecated now, I didn't do any graphics coding for ~a decade). But I found Vulkan impenetrable. The boilerplate code was absolute insanity. I tried to find some libraries that'll implement the boilerplate for me, but couldn't find anything good enough. Maybe I didn't look hard enough, idk, but Vulkan didn't seem like something an OpenGL engineer could pick up in one afternoon.
- jfkebwjsbx 7y agoTo understand Vulkan, Metal or Direct3D 12, you first need to understand modern high-level APIs like OpenGL 4 or Direct3D 11. The fixed-function pipeline is nothing like the new way of doing things. Then you can move to low-level ones, if you really want to spend a few weeks on it! But if it is a hobby, I suggest you stay with a high-level one.
- DagAgren 7y agoOpenGL in 2020 is basically all warts, if you want it to actually be performant at all.
- vetinari 7y agoAZDO is pretty nice, if you are OK that your app won't run on some devices (which include all these running macOS).
- DagAgren 7y agoThat is the exact thing that is "all warts". It is bending the OpenGL API far beyond its breaking point to desperately try to get it to match what the GPU actually wants.
- deleted 7y ago[deleted]
- gmueckl 7y agoSadly, OpenGL is dead for a lot of use cases. The medium term future will certainly be competing abstraction layers over varying subsets of D3D, Metal, Vulkan, OpenGL and OpenGL ES. Libraries like bgfx and game engines lead the way. Direct programming against low level APIs is too complex for mere mortals who want to create an actual application without an army of devs just for porting their graphics rendering to different devices (e.g. Vulkan allows for tons of subtle and hard to handle variations in device behaviour and these happen in practice).
- greggman3 7y agoThere's no Vulkan on MacOS/iOS (though there may be some 3rd party library that will translate to Metal).
- kevingadd 7y agoWhile true this boils down to "Apple won't support anything it doesn't have control over", as demonstrated by them using veto power to pick WebGPU's shader language (a custom one) instead of using the shader IR literally everyone else wanted. It doesn't make a ton of sense to evaluate the success of APIs and standards this way because Apple has a long track record of refusing to implement stuff or deprecating it once they had an interest in promoting a proprietary alternative.
- deleted 7y ago[deleted]
- kvark 7y agoThat paints Apple in a wrong light. They agreed on the WebGPU Shading Language proposed by Google (!) (previously called "Tint"). This is something Google is interested in, as well.
- kevingadd 7y agoIt's literally in past WebGPU meeting minutes: Apple objected to SPIR-V due to disputes with Khronos. Tint is a compromise, it doesn't matter who proposed it. "MS: Apple is not comfortable working under Khronos IP framework, because of dispute between Apple Legal & Khronos which is private. Can’t talk about the substance of this dispute. Can’t make any statement for Apple to agree to Khronos IP framework. So we’re discussing, what if we don’t fork? We can’t say whether we’re (Apple) happy with that. NT: nobody is forced to come into Khronos’ IP framework." https://docs.google.com/document/d/1F6ns6I3zs-2JL_dT9hOkX_253vEtKxuUkTGvxpuv8Ac/edit https://docs.google.com/document/d/1F6ns6I3zs-2JL_dT9hOkX_25...
- kvark 7y ago
- pjmlp 7y agoGame consoles also don't support Khronos standards. Switch has Vulkan, but it has its own NVN, which is what middleware engines and most Switch titles actually take advantage of. Given that Unity has shared numbers that they are responsible for 50% of the Switch titles, and there is also other middleware, there aren't many titles left.
- jfkebwjsbx 7y agoVulkan is fine and major games are shipping with it, but you should never expect any 3D API to become standard. Hardware and software vendors will never agree on one, at least for 10 years. Vulkan is supported on macOS through MoltenVK, provided by Khronos.
- kvark 7y agoMoltenVK is not a Khronos product. It's a product of Brenwill Workshop that is one of the many member companies under Khronos. It moved the code under Khronos github. There is quite a few community / other companies contributions. But it's still just a library out there.
- jfkebwjsbx 7y agoIt is provided by Khronos in the sense that they control the repository and they provide it as a permissive, open, free license, which is the important bit for end users of Vulkan. Whoever develops it is not really important for managers deciding on technologies to use.
- fulafel 7y agoVulkan is very successful as standards go, most never get near the coverage. But from the early days it was clear that MS and Apple will bet on their own proprietary APIs so the current situation is not news.
- kllrnohj 7y ago> Wow. Has Vulkan failed as a standard then? I'm interested in this area but came away from the article feeling extremely confused about what the future of portable graphics programming looks like. Other than MacOS/iOS Vulkan's future looks just fine. Windows UWP has failed so incredibly hard that the Windows Store has begun allowing win32 app distribution, so what UWP supports is irrelevant. And Microsoft's game division has even given up on the Windows Store and releases their games on Steam now as well. So UWP is doubly irrelevant currently. Intel's Skylake & newer support Vulkan 1.1 (which are 4 years old now). Not supporting Haswell/Broadwell is annoying as those do support D3D12, but that's the only API gap in Intel's lineup, and that's obviously something that's on a clock to stop mattering at some point. After all, Intel's iGPU primarily matters on laptops, and laptops tend to have a shorter lifespan than desktops as things other than the CPU show their age a lot more quickly. The 50% on Android is also a thing that'll be solved with time. If Khronos doesn't do a new OpenGL ES, then eventually the driver priority on mobile will shift over to Vulkan as that's what benchmarks will begin prioritizing, and that's what sells hardware. Android's latency to supporting something new is incredibly long, but it does also keep moving forwards fairly reliably. So MacOS/iOS is currently the only real question mark on Vulkan's future. But then again, Apple seems to only want Metal on their platform, which doesn't work anywhere else, so no "standard" will matter. You'll be forced onto a compatibility layer of some kind to work on Apple - be it MoltenVK, bgfx/sokol-gfx, or WebGPU. The article dresses up WebGPU as being superior because it's backed by a standard, but that's nonsense. The quality of the implementation is the only thing that matters, and bgfx/sokol-gfx already have quite the head-start there. There's no particular reason to think a couple of people on Firefox are going to be "strictly superior" to the couple of people on bgfx/sokol-gfx. Maybe WebGPU will end up better, in which case great! But it's the same basic thing as what already exists today. It's very firmly in the "compatibility layer" camp here, despite the article trying desperately to dress it up as something else. There's no driver support for it, there's no influence on hardware road-maps, etc... So right now if you could only target a single driver API then Vulkan would cover more platforms than any other driver-native standard. Which is no small feat.
- pjmlp 7y agoAnother one that doesn't understand UWP is also the future of Windows APIs. Also as information the WIn32 sandbox model also only allows DirectX, and Microsoft way forward is to support OpenGL on top of DirectX. https://devblogs.microsoft.com/directx/in-the-works-opencl-and-opengl-mapping-layers-to-directx/ https://devblogs.microsoft.com/directx/in-the-works-opencl-a... Expect Vulkan to get a similar treatment, the OpenGL 1.1 ICD driver model won't exist forever. Vulkan on Android is still so meaningless that the dashboard, updated this month, still doesn't show Vulkan support. https://developer.android.com/about/dashboards https://developer.android.com/about/dashboards And then there are the game consoles.
- xt00 7y agoSounds promising — would be great to know the history on why the other people who tried to make the one graphics api to rule them all failed? Seems like that could be helpful in the whole “learning from the past thing”.
- jfkebwjsbx 7y agoBecause hardware vendors don't want one. Lock-in when you are leading your particular niche gives big profits, so companies go for it. That is why Microsoft, Sony, NVIDIA, Apple, Xilinx, etc. create their own platforms and APIs.
- AnIdiotOnTheNet 7y agoThis is somewhat disingenuous. The big advantage to breaking with standards to do your own thing is that you don't have to deal with committee politics or delays. You can iterate quickly on ideas you think are good and test them in the market right now.
- kllrnohj 7y ago> Because hardware vendors don't want one. Lock-in when you are leading your particular niche gives big profits, so companies go for it. Complete nonsense. All the hardware vendors except Apple support Vulkan and contributed towards it. NVIDIA hasn't created their own graphics API since... ever, actually. They have their own APIs, of course (cuda being an obvious one, but there's also NVAPI), but they don't do graphics. Because hardware vendors have no interest or motivation in making more drivers than they need to, because drivers are hard & expensive. So much so that driver quality is a better lock-in for them. Consoles use exclusives to drive lock-in, not APIs. Consoles have their own APIs, but historically that's always been a performance thing. They want to give game devs the rawest access they can, to make the best looking games they can. Maybe low-level APIs like Vulkan will end up changing that, maybe it won't, but it's not a "lock-in" thing. OS's use APIs to do lock-in, but they don't make hardware (Apple being the exception here, of course).
- pjmlp 7y ago
- flohofwoe 7y agoI'm really rooting for WebGPU as the "cross-platform 3D-API for the rest of us" (where "rest of us" is everybody who isn't a highly specialized rendering engineer in an AAA-game engine team). There's "one small thing" I'd like to see in WebGPU for the native use case: an optional compile-time configuration feature which allows to pass in "backend-native" shaders so that all the runtime-shader-translation code isn't necessary. Example size for compiling "Hello Triangle" on macOS before and after stripping, both using the Metal backend: - with sokol-gfx: 95 KB, 91 KB - with Google Dawn: 5.2 MB, 4.0 MB I bet that most of that 4 MB overhead is coming from the integrated shader validation and translation code. I haven't tested with wgpu-native, but I guess the size overhead will be similar. Since native applications don't need the strict shader validation of the web platform, this probably would also speed up pipeline creation a bit :) PS: clarification, the executable size for Dawn is also using sokol-gfx but using its new WebGPU backend and statically linked against Dawn (which in turn is using its own Metal backend), so not a 'Hello Triangle' built directly on top of the webgpu.h API. The size difference should be negligible though (at most a few Kbytes more).
- mouldysammich 7y ago> I'm really rooting for WebGPU as the "cross-platform 3D-API for the rest of us" (where "rest of us" is everybody who isn't a highly specialized rendering engineer in an AAA-game engine team). I'm feeling the same way, I'm interested in getting into doing a little graphics programming as a beginner, but the whole thing does feel impenetrable.
- blauditore 7y agoI don't think getting into OpenGL is actually that hard. There are wrapper libraries, e.g. for Java, and tons of tutorials. The hardest part for beginners is probably wrapping their head around the concept of the rendering pipeline, with it's various stages. Once this is settled, it becomes much clearer what the various shaders do and how they interact with each other. So I'd higly recommend spending some time to understand rendering pipelines first.
- 7y ago
- deleted 7y ago[deleted]
- valand 7y agoWeb and client-side WebAPI has security first in mind. The conception of WASM and WebGPU is pushing Web into wider audiences and influence, taking up what used to be OS' market. On the OS side, Google the capability-based OS Fuchsia. Someone in Google understands that user's consent over their computation resource (file/directory, network) is more important than ever. And then there's WASI where it will enable OS to directly host WASM while allowing controllable gates over computation resources. WASI might be an important endeavor in the future and I think WebGPU design should have WASI in mind. Those may have conflicts of space and market in the future, but all are moving into the same interest, the balance of user's consent over resources, security, and performance. It seems these standards are in good hands.
- jfkebwjsbx 7y agoCapability-based systems have been a thing for decades but never took off for lack of interest and complexity. What I am missing is not a Web replacing operating systems, but better operating systems!
- valand 7y agoNon-technical users are driven to rely more and more on the web app than direct-to-OS-apps due to how easy to build they are. > What I am missing is not a Web replacing operating systems, but better operating systems! But, that I cannot argue.
- saurik 7y agoIs there an easy way to get Dawn or wgpu attached to v8 or SpiderMonkey without having to involve the entire rest of a web browser? I see there are a number of language bindings for wgpu in the wgpu-native repository, but surprisingly not JavaScript. I found commits placing it in servo, but I don't see why the vast majority of the API surface should be reliant on a browser :(. As an analogy, I can use OpenGL without a GUI toolkit, and the only parts that are really connected to the GUI toolkit are a handful of presentation functions at the very top: the headers and libraries for OpenGL are abstract/common no matter what toolkit you are using. I want to use WebGPU in all the same contexts I use OpenGL: to do accelerated rendering operations, not merely to display graphics. I would thereby expect that I would have bindings for WebGL/WebGPU (with all of its safety/security transformations) at a lower level that can target a JavaScript engine API and then I can build whatever GUI I wanted at a higher layer. Where is the impedance mismatch in what I am thinking vs. how this always seems to be implemented?
- kangz 7y agoBrowsers are Javascript bindings to WebGPU :) But more seriously, there is a https://github.com/maierfelix/webgpu https://github.com/maierfelix/webgpu that implements node bindings for Felix's Dawn fork. The fork is close to upstream and Dawn is close to "webgpu.h" so it should be easy to repurpose.
- peteforde 7y agoMost of this is "head-adjacent" for me, but there's one point where I'm confident the author is not seeing the whole forest, and that is the comparison to Unity. I'm sympathetic that someone working so hard to make WebGPU amazing would perceive the value of Unity through the lens of not having to worry about arcane device compatibility concerns. However, that's just a tiny slice of the reasons driving Unity's runaway success train. After all, if this were true, everyone would just be using ThreeJS. And don't get me wrong - ThreeJS has a massive and well-deserved user base, but few see it as a serious platform. Unity is crushing it because they provide an almost VB6-like canvas to paint on; because they have the most outrageously comprehensive asset-store ecosystem I've seen for any platform period; and because they frequently support the cool new toys like ARKit the day that they are announced. Unity is hands-down my favourite way to introduce day-one noobs to programming. I can take someone who has never programmed before and lead them through creating a VR experience where they can fight a giant spider with a burning sword in about an hour. The idea to payoff pathway Unity offers someone who is deciding whether to pursue programming in real time is crazy.
- whywhywhywhy 7y agoWatching Unity progress is amazing how it is spanning out from being a game engine into a whole technology and art canvas. Pretty confident we'll be seeing Unity rendering effects in at least one Hollywood movie in the next 5 years.
- flohofwoe 7y agoThat is definitely (mostly) true, but integrated engines like Unity or UE4 also heavily nudge you in doing things their way and come with a non-trivial size overhead (e.g. it is complete overkill to use Unity for your next Tetris clone). And let's be honest, if you sit beginners in front of Unity they don't learn programming, instead they learn "Unity problem solving", e.g. "Unity trivia" which is hardly applicable to other contexts. In my opinion, Unity is the Photoshop for game creation, you work on a very high level, but it's also very convenient (if you actually follow the rules and workflows). But there are quite a few commercial games which use Unity only as a 'cross-platform wrapper', because their game client is more or less just a dumb input+rendering client, and the actual gameplay stuff all happens server-side. It would be awfully nice if Unity could be split into a couple of standalone products (however that probably won't happen because it doesn't make much commercial sense): - a low-level platform-abstraction library which contains all the driver-bug workarounds and behind-the-scene-fixes that have been accumulated over the years - a 'bring-your-own-engine' asset pipeline and editor - and finally, the actual Unity runtime engine, split into modules
- thinkloop 7y agoThis touches on apps vs. web a little. Fundamentally what's the difference between mobile apps and the web? Is one naturally faster? Smoother? More cross-platform? Better at sensors? Offline mode? Not at all, not fundamentally at least. They are both just code on a machine. Either of them can make their runtimes do whatever they like whenever they like. If the web dedicated all it's resources to performance they would be smooth as native - there is no physical law prohibiting that. And vice versa for cross-platform compatibility. The fundamental difference is philosophical. The web consortium starts with consensus and cross-platform compatibility as a core tenant, while native pumps out proprietary features. They both strive for the same point but approach from opposite ends of the spectrum. As time goes on they might converge on the same point - which philosophy will win?
- 1_player 7y agoFantastic blog, I've devoured its few articles describing the whole history of WebGPU from the WebMetal prototype in 2016 until where we are today. It definitely got me excited for this new piece of technology.
- FpUser 7y agoThe author states something like: Use XXX API and deal with bugs, incompatibilities, etc. etc. What makes him think that this new API will be free of any of things he mentions above? As far as I can see this whole high performance graphics area has always been a wasps nest of various vendors each trying to pull the blanket to their side. I doubt adding "Web" to it will make life any easier.
- kvark 7y agoAt some point, it comes down to the amount of momentum behind the API. In case of WebGPU, we have strong support from Intel and Apple, which are hardware vendors, as well as Google, who can influence mobile hardware vendors. We are making the specification and have resources to appropriately test it and develop the necessary workarounds. It's the quantity to quality transition that sometimes just needs to cross a certain threshold in order to succeed.
- FpUser 7y ago"It's the quantity to quality transition that sometimes just needs to cross a certain threshold in order to succeed." So until that happens it is still: Use XXX API and deal with bugs, incompatibilities, etc. etc. We are back to square one. I would really love it if we have some decent multiplatform high performance graphics API (with single shader language). I would also love said API to not require one possess PhD. However looking back the last 20 years does not inspire much optimism. Wish you luck anyways
- tengbretson 7y agoI wonder if we'll see any 2d UI frameworks built on this in an effort to get around the DOM entirely? Similar to what famo.us tried to do with 3D accelerated CSS.
- eschaton 7y agoA web page is for presenting structured text with embedded media, and optionally associated—and user-replaceable—style information. A web page does not need direct or even indirect access to your GPU, and it does not need to run a Turing-complete language.