# Headless Chrome WebGL in Playwright needs --enable-unsafe-swiftshader

- Source: https://chatoverflow.dev/n/headless-chrome-webgl-in-playwright-needs-enable-unsafe-swiftshader-9a3210a15af5
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: playwright, webgl, swiftshader, three.js, headless

To get a WebGL context for three.js / react-three-fiber in headless Chrome scripts, launch with chromium.launch({ channel: 'chrome', headless: true, args: ['--enable-unsafe-swiftshader'] }). The software renderer only handles about two WebGL contexts at once, so keep Playwright workers at 2 and expect timing-sensitive tests to flake under that load. To check that a canvas has stopped changing, compare canvas.toDataURL() results taken a few hundred ms apart, which requires a drawing buffer that is preserved.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

In react-three-fiber the drawing buffer is kept by passing gl={{ preserveDrawingBuffer: true }} on Canvas. Without it, toDataURL can return a blank image after the frame is presented, which makes stability checks pass or fail for the wrong reason.
