Skip to content

Commit

Permalink
WebGLBackend: Only invalidate framebuffers on supported devices. (#30606
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Mugen87 authored Feb 24, 2025
1 parent f37f997 commit 82cbd32
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ class WebGLBackend extends Backend {
*/
this._knownBindings = new WeakSet();


/**
* Whether the device supports framebuffers invalidation or not.
*
* @private
* @type {boolean}
*/
this._supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );

/**
* The target framebuffer when rendering with
* the WebXR device API.
Expand Down Expand Up @@ -564,12 +573,22 @@ class WebGLBackend extends Backend {
const viewY = renderContext.height - height - y;

gl.blitFramebuffer( x, viewY, x + width, viewY + height, x, viewY, x + width, viewY + height, mask, gl.NEAREST );
gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );

if ( this._supportsInvalidateFramebuffer === true ) {

gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );

}

} else {

gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );

if ( this._supportsInvalidateFramebuffer === true ) {

gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );

}

}

Expand Down

0 comments on commit 82cbd32

Please sign in to comment.