@@ -544,7 +544,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
544544
545545 const textureProperties = properties . get ( texture ) ;
546546
547- if ( texture . version > 0 && textureProperties . __version !== texture . version ) {
547+ if ( texture . isRenderTargetTexture === false && texture . version > 0 && textureProperties . __version !== texture . version ) {
548548
549549 uploadTexture ( textureProperties , texture , slot ) ;
550550 return ;
@@ -559,7 +559,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
559559
560560 const textureProperties = properties . get ( texture ) ;
561561
562- if ( texture . version > 0 && textureProperties . __version !== texture . version ) {
562+ if ( texture . isRenderTargetTexture === false && texture . version > 0 && textureProperties . __version !== texture . version ) {
563563
564564 uploadTexture ( textureProperties , texture , slot ) ;
565565 return ;
@@ -2002,13 +2002,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
20022002 const attachment = textures [ i ] ;
20032003 const attachmentProperties = properties . get ( attachment ) ;
20042004
2005- state . bindTexture ( _gl . TEXTURE_2D , attachmentProperties . __webglTexture ) ;
2006- setTextureParameters ( _gl . TEXTURE_2D , attachment ) ;
2007- setupFrameBufferTexture ( renderTargetProperties . __webglFramebuffer , renderTarget , attachment , _gl . COLOR_ATTACHMENT0 + i , _gl . TEXTURE_2D , 0 ) ;
2005+ let glTextureType = _gl . TEXTURE_2D ;
2006+
2007+ if ( renderTarget . isWebGL3DRenderTarget || renderTarget . isWebGLArrayRenderTarget ) {
2008+
2009+ glTextureType = renderTarget . isWebGL3DRenderTarget ? _gl . TEXTURE_3D : _gl . TEXTURE_2D_ARRAY ;
2010+
2011+ }
2012+
2013+ state . bindTexture ( glTextureType , attachmentProperties . __webglTexture ) ;
2014+ setTextureParameters ( glTextureType , attachment ) ;
2015+ setupFrameBufferTexture ( renderTargetProperties . __webglFramebuffer , renderTarget , attachment , _gl . COLOR_ATTACHMENT0 + i , glTextureType , 0 ) ;
20082016
20092017 if ( textureNeedsGenerateMipmaps ( attachment ) ) {
20102018
2011- generateMipmap ( _gl . TEXTURE_2D ) ;
2019+ generateMipmap ( glTextureType ) ;
20122020
20132021 }
20142022
0 commit comments