Skip to content

Commit a8cc32b

Browse files
committed
WebGLTextures: Clean up.
1 parent 5f74ae5 commit a8cc32b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/renderers/webgl/WebGLTextures.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
137137

138138
}
139139

140-
function getInternalFormat( texture, glFormat, glType ) {
140+
function getInternalFormat( internalFormatName, glFormat, glType ) {
141141

142142
if ( isWebGL2 === false ) return glFormat;
143143

144-
var internalFormatName = texture.internalFormat; // User specified internal format.
145-
146144
if ( internalFormatName !== null ) {
147145

148146
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
@@ -437,7 +435,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
437435
supportsMips = isPowerOfTwo( image ) || isWebGL2,
438436
glFormat = utils.convert( texture.format ),
439437
glType = utils.convert( texture.type ),
440-
glInternalFormat = getInternalFormat( texture, glFormat, glType );
438+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType );
441439

442440
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
443441

@@ -659,7 +657,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
659657
var supportsMips = isPowerOfTwo( image ) || isWebGL2,
660658
glFormat = utils.convert( texture.format ),
661659
glType = utils.convert( texture.type ),
662-
glInternalFormat = getInternalFormat( texture, glFormat, glType );
660+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType );
663661

664662
setTextureParameters( textureType, texture, supportsMips );
665663

@@ -832,7 +830,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
832830

833831
var glFormat = utils.convert( renderTarget.texture.format );
834832
var glType = utils.convert( renderTarget.texture.type );
835-
var glInternalFormat = getInternalFormat( renderTarget.texture, glFormat, glType );
833+
var glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );
836834
state.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
837835
_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
838836
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( renderTarget.texture ).__webglTexture, 0 );
@@ -882,7 +880,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
882880

883881
var glFormat = utils.convert( renderTarget.texture.format );
884882
var glType = utils.convert( renderTarget.texture.type );
885-
var glInternalFormat = getInternalFormat( renderTarget.texture, glFormat, glType );
883+
var glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );
886884

887885
if ( isMultisample ) {
888886

@@ -1029,9 +1027,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
10291027
renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
10301028

10311029
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer );
1030+
10321031
var glFormat = utils.convert( renderTarget.texture.format );
10331032
var glType = utils.convert( renderTarget.texture.type );
1034-
var glInternalFormat = getInternalFormat( renderTarget.texture, glFormat, glType );
1033+
var glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );
10351034
var samples = getRenderTargetSamples( renderTarget );
10361035
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
10371036

0 commit comments

Comments
 (0)