Just a quick post to announce the Delphi-WebGPU repository.
What ?
Why ?
To take the words from webgpu-headers:
While WebGPU is a JavaScript API made for the Web, it is a good tradeoff of ergonomic, efficient and portable graphics API. Almost all of its concepts are not specific to the Web platform and the headers replicate them exactly, while adding capabilities to interact with native concepts (like windows).
WebGPU has as rather low-level design. It is similar to DX12, Vulkan or Metal, it supports not just vertex and fragment shaders (graphics) but also compute shaders. It was initially a fork of Metal, so there are lots of similarities, but it also forked significantly. It is higher level than Vulkan.
It comes with its own shader language, WGSL, which while Rust-like, looks a bit like a Pascal crossover with Cg to me. Meaning you have Pascal like declarations, but instead of a verbose word salad, you’re served a verbose operator soup 😉
Given that all modern GPU-related work revolves writing shaders, being able to reuse the shaders across all platforms (native and web) is a very strong point. And since it’s intended for use in a browser, you can expect it will eventually be battle-tested like no other API.
The headers in Delphi-WebGPU come in two flavors:
- WebGPU.pas is the almost direct translation of the webgpu.h C headers
- WebGPU.Interfaces.pas reformulates it with interfaces, so that the “Release” calls are automated.
Note that neither webgpu.h nor the headers are considered “stable”, there are still weekly breaking changes in webgpu.h, so a particular header version will only work with the corresponding DLL version.
Because of the above, focus of the headers right now is only on Dawn (Google’s implementation of WebGPU) on Windows 64bit.
Very interesting project, even if I don’t know anything about 3D drawing. 🙂
It is always a good idea to release such an Open Source repository soon, even if it not stable nor finalized: the more eyes, the better.
Thanks a lot for sharing!
@Arnaud Yes! And to be perfectly clear, it is really the webgpu.h header is not stable, in that it changes in various ways (sometimes just reordering enum values for aesthetic reasons), but the WebGPU implementation itself is very solid.