Skip to content

Commit

Permalink
WebGLTextures: Fix mips gen for 3D render targets. (#22072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Jul 1, 2021
1 parent 8fb030c commit 9278548
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/renderers/webgl/WebGLTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

}

function generateMipmap( target, texture, width, height ) {
function generateMipmap( target, texture, width, height, depth = 1 ) {

_gl.generateMipmap( target );

const textureProperties = properties.get( texture );

textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) );
textureProperties.__maxMipLevel = Math.log2( Math.max( width, height, depth ) );

}

Expand Down Expand Up @@ -1230,11 +1230,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {

generateMipmap( _gl.TEXTURE_2D, texture, renderTarget.width, renderTarget.height );
generateMipmap( glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth );

}

state.bindTexture( _gl.TEXTURE_2D, null );
state.bindTexture( glTextureType, null );

}

Expand Down

0 comments on commit 9278548

Please # to comment.