2 ms·
Btw, my WebAssembly emulators here (https://floooh.github.io/tiny8bit/ https://floooh.github.io/tiny8bit/) work quite well with a 60hz frame update even on mobi
by flohofwoe 8y ago
Btw, my WebAssembly emulators here (https://floooh.github.io/tiny8bit/ https://floooh.github.io/tiny8bit/) work quite well with a 60hz frame update even on mobile devices (some of them are still quite CPU hungry since they're doing a cycle-correct display emulation).
The WebAssembly version uses the following HTML5 features:
- requestAnimationFrame for frame scheduling
- WebGL for rendering (emulator code creates a linear RGBA8 framebuffer, which is copied into a double-buffered WebGL texture, which is then rendered as a fullscreen rectangle)
- WebAudio with ScriptProcessorNode and 2048-samples output buffer size to 'render' the audio (at 44.1 kHz), technically ScriptProcessorNode is deprecated, it works surprisingly well though
- everything is running in the browser thread
- everything is written in C, no dynamic memory allocation, except at startup
- djhworld 8y agoThanks for this. It's pleasing to hear there might be a better way! I shot myself in the foot a bit when I saw the web worker thing working (ish!) and carried on down that path, so didn't really explore the other means with requestAnimationFrame etc Will be definitely looking at it now though, it's good to know that everything can run on the browser thread!