Skip to content

Latest commit

 

History

History
67 lines (49 loc) · 1.74 KB

File metadata and controls

67 lines (49 loc) · 1.74 KB

WebGPU Sandbox

Experimenting with WebGPU as a cross-platform graphics API via wgpu-native

Build

This project can be built to run natively or in a web browser.

Native Build

Build via cmake

⚠️ Currently only tested with Clang and GCC. MSVC is not supported.

mkdir build
cmake -S . -B ./build -G <generator>
cmake --build ./build [--config <config>] [--target <target-name>]

Web Build

Download the Emscripten SDK and dot source the provided script to initialize the Emscripten toolchain

# Bash
EMSDK_DIR="absolute/path/of/emsdk/root"
. ./emsc-init.sh

# Powershell
$EMSDK_DIR="absolute/path/of/emsdk/root"
. ./emsc-init.ps1

Then build via emcmake

mkdir build
emcmake cmake -S . -B ./build -G <generator>
cmake --build ./build [--config <config>] [--target <target-name>]

Output can be served locally for testing e.g.

python -m http.server

⚠️ On Linux Chrome, WebGPU isn't enabled by default. To enable it, go to chrome://flags and set Unsafe WebGPU Support and Vulkan flags to Enabled.

Refs