|
|
@@ -544,7 +544,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const textureProperties = properties.get( texture );
|
|
|
|
|
|
- if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
|
+ if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
|
|
|
|
uploadTexture( textureProperties, texture, slot );
|
|
|
return;
|
|
|
@@ -559,7 +559,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const textureProperties = properties.get( texture );
|
|
|
|
|
|
- if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
|
+ if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
|
|
|
|
uploadTexture( textureProperties, texture, slot );
|
|
|
return;
|
|
|
@@ -2002,13 +2002,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const attachment = textures[ i ];
|
|
|
const attachmentProperties = properties.get( attachment );
|
|
|
|
|
|
- state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
|
- setTextureParameters( _gl.TEXTURE_2D, attachment );
|
|
|
- setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
|
|
|
+ let glTextureType = _gl.TEXTURE_2D;
|
|
|
+
|
|
|
+ if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
|
+
|
|
|
+ glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
|
+ setTextureParameters( glTextureType, attachment );
|
|
|
+ setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
|
|
|
|
- generateMipmap( _gl.TEXTURE_2D );
|
|
|
+ generateMipmap( glTextureType );
|
|
|
|
|
|
}
|
|
|
|