webGPU

发布时间 2023-08-29 10:48:07作者: fndefbwefsowpvqfx

From angle (OpenGL ES 3.0) to Dawn (WebGPU -> Vulkan).

https://github.com/google/angle

https://github.com/gpuweb/gpuweb

https://developer.chrome.com/blog/webgpu-release/

2023

The Chrome team is thrilled to announce that WebGPU is now available by default in Chrome 113,
which is currently in the Beta channel. WebGPU is a new web graphics API that offers
significant benefits such as greatly reduced JavaScript workload for the same graphics and
more than three times improvements in machine learning model inferences.
This is possible due to more flexible GPU programming and access to advanced capabilities that WebGL does not provide.

This initial release of WebGPU is available on ChromeOS, macOS, and Windows.
Support for other platforms is coming later this year.

WebGPU is a new API for the web, which exposes modern hardware capabilities and
allows rendering and computation operations on a GPU, similar to Direct3D 12, Metal, and Vulkan.
Unlike the WebGL family of APIs, WebGPU offers access to more advanced GPU features and provides first-class support
for general computations on the GPU. The API is designed with the web platform in mind, featuring an idiomatic JavaScript API,
integration with promises, support for importing videos, and a polished developer experience with great error messages.

Dawn, a WebGPU implementation

Dawn (formerly NXT) is an open-source and cross-platform implementation of the work-in-progress WebGPU standard.
It exposes a C/C++ API that maps almost one-to-one to the WebGPU IDL and can be managed as part of a larger system such as a Web browser.

Dawn provides several WebGPU building blocks:

  • WebGPU C/C++ headers that applications and other building blocks use.
    • The main C header for the WebGPU API.
    • Definition of a structure of all function pointers for this specific Dawn version (called “proctable”).
    • A C++ wrapper for the C header.
  • A “native” implementation of WebGPU using platforms' GPU APIs:
    • D3D12 on Windows 10
    • Metal on OSX (and eventually iOS)
    • Vulkan on Windows, Linux (eventually ChromeOS, Android and Fuchsia too)
    • OpenGL as best effort where available
  • A client-server implementation of WebGPU for applications that are in a sandbox without access to native drivers
  • A Dawn proc-table backend implementation of WebGPU for applications what want to be able to switch at runtime between native or client-server mode.

Intermediate Graphics Library (IGL)

https://github.com/facebook/igl

Intermediate Graphics Library (IGL) is a cross-platform library that commands the GPU.
It encapsulates common GPU functionality with a low-level cross-platform interface.
IGL is designed to support multiple backends implemented on top of various graphics APIs (e.g. OpenGL, Metal and Vulkan) with a common interface.

There are a lot of good options for abstracting GPU API's;
each making different trade-offs. We designed IGL around the following priorities:

  • Low-level, forward-looking API. IGL embraces modern abstractions (command buffers, state containers, bindless, etc) and is designed to give more control than OpenGL's state machine API. As a result, IGL can have leaner backends for modern API's (e.g. Metal, Vulkan).
  • Minimal overhead for C++. IGL supports new or existing native rendering code without overhead of language interop or the need for other language runtimes.
  • Reach + scale in production. IGL has been globally battle-tested for broad device reliability (especially the long-tail of Android devices as well as Quest 2/3/Pro compatibility for OpenGL/Vulkan) and performance-tuned on our apps.