Commit 17b4eae
committed
Add native WebAssembly backend
This introduces a lightweight WASM backend without SDL dependency,
achieving 60% binary size reduction (891K→357K) compared to SDL-based
approach.
- Add backend/wasm.c: Native WASM backend using Canvas 2D API directly
* Direct Canvas rendering via EM_ASM (no SDL overhead)
* Browser-native image decoding (JPEG/PNG)
* Optimized for minimal runtime with MINIMAL_RUNTIME=1
* Framebuffer accessor functions for zero-copy updates
- Remove twin_dispatch() from API and implementation
* Eliminated unused function across all backends
* All backends now use twin_dispatch_once() consistently
- Make SDL backend native-only
* Removed Emscripten-specific code paths from backend/sdl.c
* SDL now exclusively for native development/testing
This tweaks the WASM backend to support file-based asset loading (TVG,
PNG, JPEG, GIF) through Emscripten's virtual filesystem, addressing
multiple runtime initialization and resource management issues.
- Replace --preload-file with --embed-file for simplified deployment
- Enable FILESYSTEM=1 to support fopen() in image loaders
- Remove MINIMAL_RUNTIME=1 (incompatible with filesystem)
- Implement lazy framebuffer caching in JavaScript1 parent 16193dc commit 17b4eae
File tree
11 files changed
+1017
-353
lines changed- assets/web
- backend
- configs
- include
- scripts
- src
11 files changed
+1017
-353
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 160 | | |
168 | 161 | | |
169 | 162 | | |
| |||
186 | 179 | | |
187 | 180 | | |
188 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
189 | 188 | | |
190 | 189 | | |
191 | 190 | | |
| |||
212 | 211 | | |
213 | 212 | | |
214 | 213 | | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
224 | | - | |
| 222 | + | |
225 | 223 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
229 | 240 | | |
230 | 241 | | |
| 242 | + | |
231 | 243 | | |
232 | 244 | | |
233 | 245 | | |
| |||
303 | 315 | | |
304 | 316 | | |
305 | 317 | | |
306 | | - | |
| 318 | + | |
| 319 | + | |
307 | 320 | | |
308 | 321 | | |
309 | 322 | | |
| |||
0 commit comments