5 ms·
Dawn, a WebGPU Implementation in C++
- fulafel 7y agoFor those of us who haven't been following C++, what year's language dialect / C++ standard version is this?
- sansnomme 7y agoMost likely Google's internal C++ coding standard.
- fulafel 7y agoRight, found at https://google.github.io/styleguide/cppguide.html https://google.github.io/styleguide/cppguide.html - it doesn't really answer the question though, very "it depends" there.
- edflsafoiewq 7y agoFrom CMakeLists.txt set(CMAKE_CXX_STANDARD "14")
- flohofwoe 7y agoDawn also offers a plain C API (IMHO that's much cleaner than the C++ API, but YMMV of course). https://github.com/webgpu-native/webgpu-headers/blob/master/webgpu.h https://github.com/webgpu-native/webgpu-headers/blob/master/...
- rough-sea 7y agoare there rust bindings?
- bschwindHN 7y agoRust has its own stuff going on: https://github.com/gfx-rs/wgpu-rs https://github.com/gfx-rs/wgpu-rs
- fulafel 7y agoThis doesn't mean that wgpu-rs will necessarily be the choice for all rust users of course.
- grovesNL 7y agowgpu-rs and Dawn have already started to implement a common "webgpu-native" header (https://github.com/webgpu-native/webgpu-headers/blob/master/webgpu.h https://github.com/webgpu-native/webgpu-headers/blob/master/...) which would allow native implementations to be swapped
- zozbot234 7y agoDiscussed @ https://news.ycombinator.com/item?id=22248702 https://news.ycombinator.com/item?id=22248702 fwiw.
- jiofih 7y agoSomeone write QuickJS bindings for this and we’ll have the new best game development platform!
- pjmlp 7y agoYou could just use nvk instead. https://github.com/maierfelix/nvk https://github.com/maierfelix/nvk
- rafaelvasco 7y agoVulkan is too low level for most people and use cases I guess. The idea is to reduce that boilerplate.
- pjmlp 7y agoAgreed, although being able to use JavaScript already allows for more developer friendly approach than the bare bones C API. Khronos doesn't seem interested into making Vulkan developer friendly, like Apple, Microsoft, Sony and Nintendo do with their APIs. So it is either "build your own engine while searching for math, image loading, fonts and mesh libraries" or getting something like Unity/Unreal/Godot, which then again turns Vulkan into just yet another API to choose from thanks to being API agnostic. The fact that WebGPU is being driven by browser engines, without Khronos contribution, is quite telling.
- Jasper_ 7y ago> The fact that WebGPU is being driven by browser engines, without Khronos contribution, is quite telling. Officially, on paper, this is because Apple started the WG inside the W3C, since they have an ongoing legal battle with Khronos that makes them reluctant to choose them to host the WebGPU group (it was originally started there, and Apple said they couldn't do that). But some contributors from other companies have also been contributors to Khronos specifications, including Vulkan. > Khronos doesn't seem interested into making Vulkan developer friendly, like Apple, Microsoft, Sony and Nintendo do with their APIs. The thing that makes Vulkan more finnicky than the other options, currently, is the fact that it has to ship on mobile. And lots of mobile Android GPU vendors are basically awful. If you cut that restriction out, you can use a subset of Vulkan that is way more like than the others.
- speps 7y agoI was curious what shader language would be used for WebGPU and couldn't find an answer. From [1] it seems to be undecided for now. [1] https://gpuweb.github.io/gpuweb/#typedefdef-gpushadercode https://gpuweb.github.io/gpuweb/#typedefdef-gpushadercode > Note: While the choice of shader language is undecided, GPUShaderModuleDescriptor will temporarily accept both text and binary input.
- flohofwoe 7y agoI think not specifying the shader language / byte-code makes at least sense for those native WebGPU implementation libraries (of course not for the WebGPU standard itself). For instance, currently Dawn comes with a lot of code to translate and validate SPIRV to the underlying shader languages or byte-codes. When using Dawn as a native library to get a friendlier cross-platform API over Metal, Vulkan and D3D12, it might make sense to do the shader translation offline, and feed Dawn directly with Metal and D3D12 shader bytecode. The strict validation isn't really needed in such a use case, the shader translation doesn't need to happen at run time, and the executable can be a lot slimmer. Ideally I'd like to see both in web backend, SPIRV as base, but also have a quasi-standard textual language (might be WHLSL, I don't care, but just don't offer WHLSL as the only way to get shaders into WebGPU). Both D3D12 and Metal allow to either feed shader bytecode to the API, or translate from shader source during run time.
- Jasper_ 7y agoDawn, used offline, will almost certainly accept SPIR-V. Even if the WebGPU WG chooses an alternate approach, Google plans to use this internally for other projects, and I expect SPIR-V will remain a supported shader ingestion format.
- deleted 7y ago[deleted]
- pjmlp 7y agoAnything that reduces Vulkan boilerplate is welcomed.
- rafaelvasco 7y agoWebGPU is the hot thing right now. This could be the start of a cross platform revolution; So exciting.
- azakai 7y agoYes! Part of the cross-platform story here is an Emscripten port of webgpu.h, https://github.com/emscripten-core/emscripten/pull/10218 https://github.com/emscripten-core/emscripten/pull/10218 So you can write an application and run it either natively (using Dawn or wgpu-native) or on the Web (as WebAssembly + JavaScript).
- Pete_D 7y agoGenuine question from someone looking at toying with graphics programming who had never heard of WebGPU before today: does this mean I should hold off on learning WebGL? How different are the two?
- pjmlp 7y agoIf you don't have any kind of experience, you are better off starting with WebGL. It is more beginner friendly and it is here now. You can either start from scratch: https://webglfundamentals.org/ https://webglfundamentals.org/ Or use one of the two most developer friendly frameworks. https://threejs.org/ https://threejs.org/ https://www.babylonjs.com/ https://www.babylonjs.com/ If you have zero experience in graphics, another approach is to learn about 3D software rendering in first place. https://www.davrous.com/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript/ https://www.davrous.com/2013/06/13/tutorial-series-learning-... Leave WebGPU for when you feel comfortable with 3D programming.
- Pete_D 7y agoThanks! I'd actually been looking for that software rendering article for a while as well and couldn't find it.