GitXplorerGitXplorer
e

HelloWebGPU

public
5 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
923734902ddb69adc09d0444c60f1308aa205a92

Emscripten hello world

eemepetres committed 5 years ago
Verified
12223b51c5cf5f1e44ce7b8698c3ac7219c1a275

Initial commit

eemepetres committed 5 years ago

README

The README file for this repository.

HelloWebGPU

This a bare minimum test that shows how to draw a red triangle in a web browser using WebGPU and WebAssembly (Emscripten)

Triangle rendered on Chrome Canary

Tested with Chrome Canary 86.0 and Microsoft Edge Canary 85.0 with chrome://flags/#enable-unsafe-webgpu enabled, and with Firefox Nightly 80.0a1 with dom.webgpu.enabled and gfx.webrender.all enabled,

Requirements

The sample is built under linux/WSL, however it should work in Windows or Mac as well by translating the build script to each platform.

Build

build.sh [-d] [--emsdk PATH_TO_EMSDK]

  • -d to compile in debug mode
  • --emsdk to specify the Emscripten SDK path

By default, the build script tries to find the Emscripten SDK at $HOME/mono/sdks/builds/toolchains/emsdk. This is because this work is originally meant to serve as an external test of MONO + WebGPU + Emscripten integration.

To compile the shaders:

glslc -Os -mfmt=num -o - -c in.vert glslc -Os -mfmt=num -o - -c in.frag

Run

cd www
python server.py

Related work

The sample is partially based on WebGPU samples and hello-webgpu