Commit da99d17
fix: snapshot rendering crash with clustered lighting
clearStorageBuffer() calls _renderEncoder.clearBuffer(), which is a
command encoder operation that cannot execute while a render pass is
open on the same encoder.
In snapshot rendering mode (both STANDARD and FAST), bindFramebuffer()
eagerly creates the render pass. The clustered lighting system then
fires onClearObservable which calls StorageBuffer.clear(), hitting the
locked encoder and producing WebGPU validation errors every frame.
Fix:
- Move the WebGPU storage buffer clear from onClearObservable (fires
after bindFramebuffer) to onBeforeBindObservable (fires before),
so it runs while the encoder is free.
- Add _endCurrentRenderPass() as a safety guard in clearStorageBuffer()
to prevent the same class of bug for any future callers.
Fixes https://forum.babylonjs.com/t/63139
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 5b48f65 commit da99d17
2 files changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4043 | 4043 | | |
4044 | 4044 | | |
4045 | 4045 | | |
| 4046 | + | |
| 4047 | + | |
4046 | 4048 | | |
4047 | 4049 | | |
4048 | 4050 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| |||
354 | 361 | | |
355 | 362 | | |
356 | 363 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 364 | + | |
361 | 365 | | |
362 | 366 | | |
363 | 367 | | |
| |||
0 commit comments