PerformanceHUD render error leaves renderer.autoClear latched false #1087

Closed
opened 2026-08-13 13:54:54 +00:00 by spikerj · 1 comment
Owner

While covering PerformanceHUD leftover (Wave 8 a5 tick 2, tests only) the overlay render() path was driven with a mocked WebGLRenderer.

What happens: render() saves autoClear / autoClearColor / autoClearDepth, forces them false so the HUD can overlay without wiping the 3D colour buffer, then restores them after renderer.render(...). The restore sits inside the same try. If clearDepth() or render() throws, the catch only console.errors — the three flags stay false.

User-visible: a single HUD render exception (lost context, disposed camera, etc.) stops the main scene from clearing. Subsequent frames composite on stale colour/depth.

Fix: restore the three flags in a finally, or restore them in the catch before returning.

Repro (jsdom, mocked renderer): render throws → renderer.autoClear === false after PerformanceHUD.render returns.

File: projects/spikersoft/src/app/_components/threejs-performance-monitor/performance-hud.ts

While covering `PerformanceHUD` leftover (Wave 8 a5 tick 2, tests only) the overlay `render()` path was driven with a mocked `WebGLRenderer`. **What happens:** `render()` saves `autoClear` / `autoClearColor` / `autoClearDepth`, forces them false so the HUD can overlay without wiping the 3D colour buffer, then restores them *after* `renderer.render(...)`. The restore sits inside the same `try`. If `clearDepth()` or `render()` throws, the `catch` only `console.error`s — the three flags stay `false`. **User-visible:** a single HUD render exception (lost context, disposed camera, etc.) stops the main scene from clearing. Subsequent frames composite on stale colour/depth. **Fix:** restore the three flags in a `finally`, or restore them in the `catch` before returning. **Repro (jsdom, mocked renderer):** `render` throws → `renderer.autoClear === false` after `PerformanceHUD.render` returns. File: `projects/spikersoft/src/app/_components/threejs-performance-monitor/performance-hud.ts`
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.