Skip to content

WebGL2: evict cached GL handles on real context restore (B-09) #275

Description

@Exoridus

From the 2026-07-11 backend audit (B-09, P2): on webglcontextlost/restored the backend only toggles a flag and calls restoreContext(); cached GL handles (_textureStates, ManagedBufferState, VAO appliedVersion, shader programs) are NOT invalidated. Synthetic WEBGL_lose_context tests pass, but a real GPU reset (mobile tab switch, driver TDR) leaves dangling handles -> blank canvas or INVALID_OPERATION storms.

Fix: on restore, evict all managed texture/RT/buffer state and force renderers to reconnect - mirror the WebGPU _teardownDeviceState pattern (WebGpuBackend.ts), which the audit rated production-grade. Add a test that recreates handles after restore. Note: the retained instruction-set bundles (Slice 3) hook generation bumps into this same path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions