Skip to content

alpqr/emwgputest

Repository files navigation

Simple test apps for WebGPU with Emscripten.
Tested with Emscripten 3.1.51 and Chrome 120.0.6099.109.

cd 01_blue_triangle
mkdir build
emcmake cmake -B build .
cmake --build build
emrun --browser chrome blue_triangle.html

To debug as shown in https://developer.chrome.com/blog/wasm-debugging-2020/ add -DCMAKE_BUILD_TYPE=Debug when configuring.

01_blue_triangle

* Blue triangle with perspective projection.
* Handles canvas resizing.
* Depth/stencil set up as well although not really needed.
* Simple vertex and uniform buffer setup. (mappedAtCreation, writeBuffer)

02_rotating_triangle

* Now with vertex colors and rotating.
* Uniform buffer update handled via staging buffer ring.

03_simple_texture

* Draws a textured quad.
* The texture is loaded with EM_JS (fetch/ImageBitmap/copyExternalImageToTexture).

04_textures

* Two textures this time, one loaded with stb_image, the other with TinyEXR. Uses --preload-file.

05_imgui

* Basic Dear Imgui integration

06_localfile

* Local file upload/download

07_localfile2

* Sets a custom font for the gui
* Uses glm instead of HMM
* Combined with rotating_triangle

About

Some Emscripten WebGPU test apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published