|
@@ -1831,6 +1831,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ const invalidationArrayRead = [];
|
|
|
+ const invalidationArrayDraw = [];
|
|
|
+
|
|
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
|
|
|
|
if ( renderTarget.samples > 0 ) {
|
|
@@ -1841,7 +1844,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const width = renderTarget.width;
|
|
|
const height = renderTarget.height;
|
|
|
let mask = _gl.COLOR_BUFFER_BIT;
|
|
|
- const invalidationArray = [];
|
|
|
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
|
const renderTargetProperties = properties.get( renderTarget );
|
|
|
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
@@ -1866,14 +1868,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
|
|
|
|
- invalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );
|
|
|
-
|
|
|
- if ( renderTarget.depthBuffer ) {
|
|
|
-
|
|
|
- invalidationArray.push( depthStyle );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;
|
|
|
|
|
|
if ( ignoreDepthValues === false ) {
|
|
@@ -1890,31 +1884,33 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
|
|
|
|
+ const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
|
+ _gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( ignoreDepthValues === true && supportsInvalidateFramebuffer ) {
|
|
|
+ _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
|
|
|
|
|
|
- _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
|
|
|
- _gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
|
+ if ( supportsInvalidateFramebuffer === true ) {
|
|
|
|
|
|
- }
|
|
|
+ invalidationArrayRead.length = 0;
|
|
|
+ invalidationArrayDraw.length = 0;
|
|
|
|
|
|
- if ( isMultipleRenderTargets ) {
|
|
|
+ invalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );
|
|
|
|
|
|
- const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
|
- _gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
|
+ if ( renderTarget.depthBuffer && ignoreDepthValues === true ) {
|
|
|
|
|
|
- }
|
|
|
+ invalidationArrayRead.push( depthStyle );
|
|
|
+ invalidationArrayDraw.push( depthStyle );
|
|
|
|
|
|
- _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
|
|
|
+ _gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );
|
|
|
|
|
|
- if ( supportsInvalidateFramebuffer ) {
|
|
|
+ }
|
|
|
|
|
|
- _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );
|
|
|
+ _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|