v0.7.0: SDL-free wasm worker backend (WebGPU + WebGL2) with on-demand assets

The engine now runs on a plain Web Worker (no SDL, no PROXY_TO_PTHREAD: in a pthread Emscripten proxies every filesystem syscall to the main browser thread, where synchronous XHR - and thus FS.createLazyFile - is forbidden). A page/worker pair transfers an OffscreenCanvas and forwards DOM input; assets load lazily from an embedded manifest, so entering a map fetches only that map and its tiles.

Presentation: ra3.webgpu (WebGPU via Emscripten's emdawnwebgpu port, WGSL shaders, the default on wasm) and ra3.wasmgl (WebGL2, GLSL ES). The legacy SDL ra3.webgl backend is removed.
This commit is contained in:
EnderTheCoder
2026-09-29 12:08:07 +08:00
parent 70d4beca4f
commit 889ce945f2
27 changed files with 2161 additions and 639 deletions
+11 -1
View File
@@ -1,6 +1,8 @@
# syntax=docker/dockerfile:1
# WebAssembly build environment (Emscripten), producing openra3.html/.js/.wasm.
# WebAssembly build environment (Emscripten), producing openra3.js/.wasm plus the
# `index.html` page and `openra3.worker.js` bootstrap. The engine runs on a plain
# Web Worker (WebGL2 and WebGPU backends), with lazy on-demand assets.
#
# The emsdk image ships CMake 3.28, whose experimental `import std` support is
# too old for the project, so an upstream CMake is layered on top.
@@ -37,6 +39,14 @@ RUN mkdir -p /opt/cmake \
| tar -xz -C /opt/cmake --strip-components=1
ENV PATH="/opt/cmake/bin:${PATH}"
# Pre-fetch the emdawnwebgpu port into the image. The WebGPU backend needs
# <webgpu/webgpu_cpp.h>, and CMake's module dependency scanner does not process
# `--use-port`, so a warm cache is required before the project is configured.
RUN . /emsdk/emsdk_env.sh \
&& printf '#include <webgpu/webgpu_cpp.h>\nint main(){}\n' > /tmp/wgpu_port.cpp \
&& em++ -c /tmp/wgpu_port.cpp -o /tmp/wgpu_port.o --use-port=emdawnwebgpu \
&& rm -f /tmp/wgpu_port.cpp /tmp/wgpu_port.o
WORKDIR /work
COPY . .