Skip to content

Commit 82cbd32

Browse files
authored
WebGLBackend: Only invalidate framebuffers on supported devices. (#30606)
1 parent f37f997 commit 82cbd32

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/renderers/webgl-fallback/WebGLBackend.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ class WebGLBackend extends Backend {
186186
*/
187187
this._knownBindings = new WeakSet();
188188

189+
190+
/**
191+
* Whether the device supports framebuffers invalidation or not.
192+
*
193+
* @private
194+
* @type {boolean}
195+
*/
196+
this._supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
197+
189198
/**
190199
* The target framebuffer when rendering with
191200
* the WebXR device API.
@@ -564,12 +573,22 @@ class WebGLBackend extends Backend {
564573
const viewY = renderContext.height - height - y;
565574

566575
gl.blitFramebuffer( x, viewY, x + width, viewY + height, x, viewY, x + width, viewY + height, mask, gl.NEAREST );
567-
gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );
576+
577+
if ( this._supportsInvalidateFramebuffer === true ) {
578+
579+
gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );
580+
581+
}
568582

569583
} else {
570584

571585
gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
572-
gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );
586+
587+
if ( this._supportsInvalidateFramebuffer === true ) {
588+
589+
gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );
590+
591+
}
573592

574593
}
575594

0 commit comments

Comments
 (0)