WebGL Without a GPU
The article explores how WebGL rendering can be achieved without a physical GPU by using software-based implementations like SwiftShader or Google's Swiftshader, which use CPU to emulate GPU operations. It discusses the performance trade-offs, use cases for server-side rendering, and how tools like Puppeteer can leverage these setups for headless WebGL.
Background
- **WebGL** is a web standard that lets browsers render 3D and 2D graphics (e.g., games, visualizations) by talking directly to the computer's GPU (graphics card). Normally, without a GPU, WebGL simply won't work — or falls back to a slow, purely software-based renderer like Google's **SwiftShader**, a project that Google later stopped maintaining.
- This article describes how the team at **Microlink** (a service that turns websites into preview images/screenshots) got WebGL working inside their server-side **Chrome** instances running on generic cloud servers that lack a GPU. They did it by wrapping **LLVMpipe**, an open-source software GPU (a "software rasterizer") that uses the CPU to emulate a graphics card.
- The trick: they embedded LLVMpipe inside a custom **EGL** (the interface between OpenGL/WebGL and the display system) and compiled it to **WebAssembly**, letting it run inside Chrome's own sandbox. A side-effect of this approach was a **7x speedup** over the old SwiftShader-based fallback, making server-side rendering of WebGL content (e.g., rendering charts, maps, or 3D previews) much more practical.