2023-04-20

WebGPU: a significant web technology

2023.4.20: news.cyb/dev.net/WebGPU/
introducing a significant web technology:

. this is a revision of WebGPU news from

François Beaufort, Corentin Wallez April 6, 2023

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

WebGPU is a new API for the web, 

which allows rendering and computation operations on a GPU

for high-performance 3D graphics 

and data-parallel computation on the web.

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, 

and integration with promises.

. coming soon: better access to shader cores

for even more machine learning optimizations,

and additional ergonomics in WGSL, 

the WebGPU Shading Language.

https://google.github.io/tour-of-wgsl/


Resources:

. the W3C specifications for WebGPU 

https://gpuweb.github.io/gpuweb/

and the WebGPU Shading Language.

https://gpuweb.github.io/gpuweb/wgsl/

Experiment with samples.

https://webgpu.github.io/webgpu-samples/

Look at the MDN documentation.

https://developer.mozilla.org/docs/Web/API/WebGPU_API

Read the official explainer 

https://gpuweb.github.io/gpuweb/explainer/

and best practices.

https://toji.dev/webgpu-best-practices/

WebGPU compared to WebGL;

https://surma.dev/things/webgpu/index.html

eg, simpler and better at General-Purpose GPU

(GPGPU) also known as GPU compute,

https://developer.chrome.com/articles/gpu-compute/

-- as opposed to WebGPU rendering

(canvas, texture, etc.).


Both the Dawn library for Chromium

https://dawn.googlesource.com/dawn

and the wgpu library for Firefox 

https://github.com/gfx-rs/wgpu

are available as standalone packages, 

and they offer great portability and ergonomic layers

that abstract OS GPU APIs. 


Using these libraries in native applications

also makes it easier to port to WASM

https://webassembly.org/

through Emscripten and Rust web-sys.

https://emscripten.org/

https://rustwasm.github.io/wasm-bindgen/web-sys/index.html

Emscripten is a complete compiler toolchain to

WebAssembly, using LLVM.


#Browser support

This initial release of WebGPU is available in Chrome 113

on ChromeOS devices with Vulkan support, 

Windows devices with Direct3D 12 support, 

and macOS. 


#Library support

Babylon.js has full WebGPU support already.

https://doc.babylonjs.com/setup/support/webGPU

PlayCanvas announced initial WebGPU support.

https://blog.playcanvas.com/initial-webgpu-support-lands-in-playcanvas-engine-1-62/

TensorFlow.js supports WebGPU-optimized versions of most operators.

https://www.npmjs.com/package/@tensorflow/tfjs-backend-webgpu

Three.js WebGPU support is underway, see examples.

https://threejs.org/examples/?q=webgpu#webgpu_particles


about Babylon.js:

https://doc.babylonjs.com/guidedLearning/bjsBook

https://doc.babylonjs.com/guidedLearning/offsite

https://doc.babylonjs.com/journey/learningTheDocs

Babylon.js is a fully featured game and rendering engine.


about PlayCanvas:

https://playcanvas.com/

. a web-first game engine:

collaboratively build html5 games and visualizations.

. PlayCanvas Editor is the most advanced 

WebGL authoring environment.


about Three.js:

https://threejs.org/manual/#en/fundamentals

. a 3D library that tries to make it as easy as possible

to get 3D content on a webpage.

. three.js often uses WebGL to draw 3D. 

WebGL is a very low-level system that only draws

points, lines, and triangles. 

. three.js comes offers higher level code like 

scenes, lights, shadows, materials, textures, 3d math.


about TensorFlow.js:

https://blog.tensorflow.org/2018/03/introducing-tensorflowjs-machine-learning-javascript.html

. an ecosystem of JavaScript tools for machine learning.


No comments:

Post a Comment