From 66f9e451771885fd0b054d16ed264334acac4299 Mon Sep 17 00:00:00 2001 From: Alan Wolfe Date: Sat, 14 Feb 2026 13:37:35 -0800 Subject: [PATCH 1/3] update docs --- readme.md | 34 ++++++++++++++++------------------ thirteen.h | 4 ++-- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/readme.md b/readme.md index 6b5ff12..45fc56c 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,7 @@ Platforms Supported: * Win32/DX12 * MacOS/Metal * Linux/X11+OpenGL +* WASM/WepGPU ## Usage @@ -50,6 +51,19 @@ How to build examples: * **Mac**: For each example: clang++ main.cpp -framework Metal -framework Cocoa -std=c++11 -DTARGET_OS_OSX * **Linux**: For each example: g++ main.cpp -o Simple +**Web**: + +for each example: +```bash +emcc main.cpp -std=c++17 -I. \ + --use-port=emdawnwebgpu \ + -sASYNCIFY \ + -sALLOW_MEMORY_GROWTH=1 \ + -o simple.html +``` + +Then run a local web server and open `simple.html` in a WebGPU-enabled browser. + ### Simple A basic example showing the fundamentals of Thirteen. [View source code](Examples/Simple/main.cpp) @@ -65,22 +79,6 @@ A classic Minesweeper game implementation. [View source code](Examples/Minesweep ![Minesweeper Example](Minesweeper.png) -## Web (WASM + WebGPU) - -Thirteen now has an `__EMSCRIPTEN__` backend that uses WebGPU in the browser. - -### Build Simple example for web - -```bash -emcc Examples/Simple/main.cpp -std=c++17 -I. \ - --use-port=emdawnwebgpu \ - -sASYNCIFY \ - -sALLOW_MEMORY_GROWTH=1 \ - -o simple.html -``` - -Then run a local web server and open `simple.html` in a WebGPU-enabled browser. - ### Notes - The web backend expects a `` in the generated page. - `SetFullscreen()` is currently a no-op on web. @@ -251,6 +249,6 @@ bool clicked = Thirteen::GetMouseButton(0) && !Thirteen::GetMouseButtonLastFrame Alan Wolfe - API, examples and Win32/DX12 implementation -Francesco Carucci - MacOS/Metal implementation +Francesco Carucci - MacOS/Metal and WASM/WebGPU implementation -Nikita Lisitsa - Linux/X11+OpenGL +Nikita Lisitsa - Linux/X11+OpenGL implementation diff --git a/thirteen.h b/thirteen.h index 9d579e7..a630ee7 100644 --- a/thirteen.h +++ b/thirteen.h @@ -8,9 +8,9 @@ It is inspired by the simplicity of the Mode 13h days where you initialized the Alan Wolfe - API, examples and Win32/DX12 implementation -Francesco Carucci - MacOS/Metal implementation +Francesco Carucci - MacOS/Metal and WASM/WebGPU implementation -Nikita Lisitsa - Linux/X11+OpenGL +Nikita Lisitsa - Linux/X11+OpenGL implementation */ #pragma once From e45c9350d1e535130ad2ed930b1fef22844a383e Mon Sep 17 00:00:00 2001 From: Alan Wolfe Date: Sat, 14 Feb 2026 13:41:32 -0800 Subject: [PATCH 2/3] wasm test --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7769096..f468264 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,3 +74,33 @@ jobs: - name: Build successful run: echo "Build completed successfully for ${{ matrix.example }} on ${{ runner.os }} (${{ matrix.config }})" + + build-wasm: + name: Build ${{ matrix.example }} with Emscripten (${{ matrix.config }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + example: [Simple, Mandelbrot, Minesweeper] + config: [Debug, Release] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Emscripten + uses: mymindstorm/setup-emsdk@v14 + with: + version: latest + + - name: Build with Emscripten + run: | + emcc -std=c++17 ${{ matrix.config == 'Debug' && '-g -O0' || '-O2' }} \ + -I. \ + -sUSE_WEBGPU=1 \ + -sASYNCIFY \ + Examples/${{ matrix.example }}/main.cpp \ + -o ${{ matrix.example }}.html + + - name: Build successful + run: echo "Build completed successfully for ${{ matrix.example }} with Emscripten (${{ matrix.config }})" From 0a70b487c35c4d5bf33dfe60bf3bc73f8d455b32 Mon Sep 17 00:00:00 2001 From: Alan Wolfe Date: Sat, 14 Feb 2026 13:44:58 -0800 Subject: [PATCH 3/3] fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f468264..c4b5ca8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,7 +97,7 @@ jobs: run: | emcc -std=c++17 ${{ matrix.config == 'Debug' && '-g -O0' || '-O2' }} \ -I. \ - -sUSE_WEBGPU=1 \ + --use-port=emdawnwebgpu \ -sASYNCIFY \ Examples/${{ matrix.example }}/main.cpp \ -o ${{ matrix.example }}.html