Skip to content

Commit 162d363

Browse files
mvaligurskyMartin Valigursky
andauthored
Fix to restoring lost context on WebGL related to very recent backbuffer refactoring (#5643)
Co-authored-by: Martin Valigursky <[email protected]>
1 parent 42313e2 commit 162d363

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/platform/graphics/webgl/webgl-graphics-device.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ class WebglGraphicsDevice extends GraphicsDevice {
346346

347347
this._contextRestoredHandler = () => {
348348
Debug.log('pc.GraphicsDevice: WebGL context restored.');
349-
this.restoreContext();
350349
this.contextLost = false;
350+
this.restoreContext();
351351
this.fire('devicerestored');
352352
};
353353

@@ -1165,6 +1165,10 @@ class WebglGraphicsDevice extends GraphicsDevice {
11651165
* @ignore
11661166
*/
11671167
loseContext() {
1168+
1169+
// force the backbuffer to be recreated on restore
1170+
this.backBufferSize.set(-1, -1);
1171+
11681172
// release shaders
11691173
for (const shader of this.shaders) {
11701174
shader.loseContext();

0 commit comments

Comments
 (0)