-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
WebGPURenderer: Fix rendering into mips. #31645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| renderTargetData.width !== renderTarget.width || | ||
| renderTargetData.height !== renderTarget.height || | ||
| renderTargetData.activeMipmapLevel !== renderContext.activeMipmapLevel || | ||
| renderTargetData.activeCubeFace !== renderContext.activeCubeFace || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.