What it does
It owns the WebGL2 context, the kernel's texture atlas, the scene's colour and depth textures, the sprite batches and presenting each frame. Sprites go up as instances with the same 22-float layout, the same run splitting and the same blend table as the WebGPU backend, so draw calls are added only where blend modes, deforms or textures change. Big pictures kept out of the atlas get textures of their own, uploaded once with mipmaps. Other packs (the UI, text, vectors, lighting, backdrops, post effects and the 3D stack) own their WebGL passes, and every pack reads the same scene data on either backend.
Two details keep the backends matched. An edge that lies exactly on a row of pixel centres falls on the same side as
it does on WebGPU, for every program compiled through the kernel, even though WebGL rasterises y-up and WebGPU y-down.
And shaders: the built-in ones have GLSL implementations, while custom backdrop, post and deform snippets, written
once in WGSL, go through the wgsl-glsl translator, which throws on anything it cannot translate rather than drawing
a silent black pass.
GPU particle simulation runs on WebGL2 transform feedback. Resources are released when the game is disposed and rebuilt after a lost context.
Features
- Same game, same calls — the worlds, the look columns and the game APIs work as they do on WebGPU.
- Batched sprites — one instance layout and run splitting shared with WebGPU, in sorted order.
- Big pictures — textures of their own with mipmaps, beside the shared atlas.
- Translated effect shaders — custom WGSL snippets become GLSL, and unsupported ones fail loudly.
- Matched rasterisation — edges on pixel centres fall the same way as on WebGPU.
- GPU particles — simulated with transform feedback.
- Screenshots — the
screenshotcommand works here too. - Diagnostics —
game.glreportsready,drawCalls,instancesandmissing, the custom drawers that have no WebGL2 path. - Context loss — resources rebuilt after the context is lost.
Good for
- Reaching older browsers — Safari and Firefox without WebGPU, through
render-auto, with no change to the game. - Testing the fallback — composing it alone, or
game.renderer.prefer('webgl2')underrender-auto, shows exactly what those players see. - WebGL2-only builds — a build that should never try WebGPU.
- Pack authors —
ctx.backend.webgl2gives a custom drawer the context, the atlas and the scene framebuffer, andgame.gl.missingsays when a drawer has no WebGL2 path.
Make it yours
There are no options: screen size, fit, background and pixel-art filtering come from the manifest's screen. The
choice is how you reach it. Nearly every game lets render-auto fall back to it on devices without WebGPU and never
names it. A build or test that should use WebGL2 alone composes render-webgl2 in place of render-webgpu. Packs that
draw for themselves add a drawGl beside their WebGPU drawer, and use GlDepthCopy for a pass that reads depth.
A quick look
A manifest that uses WebGL2 alone:
{ "packs": [{ "id": "render-webgl2" }, { "id": "world-topdown" }, { "id": "world-screen" }] }
Works with
render-auto— the renderer to compose; it carries this backend and picks it when WebGPU is missing.render-webgpu— the other backend; compose one or the other, never both.wgsl-glsl— translates custom effect snippets to GLSL for this backend.core-2d,core-3dandcore-vector— bringrender-auto, and with it this backend.
Good to know
- No screen recording; screenshots work.
- With
render-3d, one directional shadow map instead of cascades, and at most eight local lights. skymaxandwatermaxare not available.- The shared scene target is single-sampled, and a picture larger than the context's
MAX_TEXTURE_SIZEis reported once and not drawn. - Quality, precision and speed can differ from WebGPU, so check a game on a real GPU on both.





