WebGPURenderer: Fix rendering into mips.#31645
Conversation
| renderTargetData.width !== renderTarget.width || | ||
| renderTargetData.height !== renderTarget.height || | ||
| renderTargetData.activeMipmapLevel !== renderContext.activeMipmapLevel || | ||
| renderTargetData.activeCubeFace !== renderContext.activeCubeFace || |
There was a problem hiding this comment.
We don't want to reset the descriptor cache when the active mipmap level or cube face changes. The respective texture views should be cached so they are not created over and over again when changing the rendering settings.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| gl.framebufferTexture2D( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0 ); | ||
| const mipLevel = this.renderer._activeMipmapLevel; | ||
|
|
||
| gl.framebufferTexture2D( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, mipLevel ); |
There was a problem hiding this comment.
The changes to gl.framebufferTexture2D() and gl.framebufferTextureLayer() make sure the framebuffers for each mipmap are correctly coupled to the texture's mip levels.
| const { textures, activeCubeFace, activeMipmapLevel } = renderContext; | ||
|
|
||
| const values = [ activeCubeFace ]; | ||
| const values = [ activeCubeFace, activeMipmapLevel ]; |
There was a problem hiding this comment.
We must honor the active map level in the render context cache in the same way like the active cube face since we need separate framebuffers/view descriptors for each mip.
Related issue: -
Description
The PR makes sure rendering into a render target with active mipmap level works as expected.