|
@@ -331,18 +331,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
function deallocateRenderTarget( renderTarget ) {
|
|
|
|
|
|
- const texture = renderTarget.texture;
|
|
|
-
|
|
|
const renderTargetProperties = properties.get( renderTarget );
|
|
|
- const textureProperties = properties.get( texture );
|
|
|
-
|
|
|
- if ( textureProperties.__webglTexture !== undefined ) {
|
|
|
-
|
|
|
- _gl.deleteTexture( textureProperties.__webglTexture );
|
|
|
-
|
|
|
- info.memory.textures --;
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
if ( renderTarget.depthTexture ) {
|
|
|
|
|
@@ -397,27 +386,24 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
|
|
|
-
|
|
|
- for ( let i = 0, il = texture.length; i < il; i ++ ) {
|
|
|
+ const textures = renderTarget.textures;
|
|
|
|
|
|
- const attachmentProperties = properties.get( texture[ i ] );
|
|
|
-
|
|
|
- if ( attachmentProperties.__webglTexture ) {
|
|
|
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
|
|
|
|
- _gl.deleteTexture( attachmentProperties.__webglTexture );
|
|
|
+ const attachmentProperties = properties.get( textures[ i ] );
|
|
|
|
|
|
- info.memory.textures --;
|
|
|
+ if ( attachmentProperties.__webglTexture ) {
|
|
|
|
|
|
- }
|
|
|
+ _gl.deleteTexture( attachmentProperties.__webglTexture );
|
|
|
|
|
|
- properties.remove( texture[ i ] );
|
|
|
+ info.memory.textures --;
|
|
|
|
|
|
}
|
|
|
|
|
|
+ properties.remove( textures[ i ] );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- properties.remove( texture );
|
|
|
properties.remove( renderTarget );
|
|
|
|
|
|
}
|
|
@@ -1546,7 +1532,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
|
|
|
+ const textures = renderTarget.textures;
|
|
|
|
|
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
|
|
|
@@ -1710,7 +1696,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
|
|
|
|
|
|
- if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
|
|
|
+ const textures = renderTarget.textures;
|
|
|
+
|
|
|
+ const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
|
+ const isMultipleRenderTargets = ( textures.length > 1 );
|
|
|
+ const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;
|
|
|
+
|
|
|
+ if ( ! isMultipleRenderTargets ) {
|
|
|
|
|
|
if ( textureProperties.__webglTexture === undefined ) {
|
|
|
|
|
@@ -1723,10 +1715,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
|
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
|
- const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;
|
|
|
-
|
|
|
// Setup framebuffer
|
|
|
|
|
|
if ( isCube ) {
|
|
@@ -1775,8 +1763,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( capabilities.drawBuffers ) {
|
|
|
|
|
|
- const textures = renderTarget.texture;
|
|
|
-
|
|
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
|
|
|
|
const attachmentProperties = properties.get( textures[ i ] );
|
|
@@ -1801,8 +1787,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
|
|
|
|
- const textures = isMultipleRenderTargets ? texture : [ texture ];
|
|
|
-
|
|
|
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
|
renderTargetProperties.__webglColorRenderbuffer = [];
|
|
|
|
|
@@ -1875,8 +1859,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
} else if ( isMultipleRenderTargets ) {
|
|
|
|
|
|
- const textures = renderTarget.texture;
|
|
|
-
|
|
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
|
|
|
|
const attachment = textures[ i ];
|
|
@@ -1955,7 +1937,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;
|
|
|
|
|
|
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
|
|
|
+ const textures = renderTarget.textures;
|
|
|
|
|
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
|
|
|
@@ -1980,14 +1962,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
|
|
|
|
- const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
|
|
|
+ const textures = renderTarget.textures;
|
|
|
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 = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
|
+ const isMultipleRenderTargets = ( textures.length > 1 );
|
|
|
|
|
|
// If MRT we need to remove FBO attachments
|
|
|
if ( isMultipleRenderTargets ) {
|