Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Aug 14, 2025

Related issue: -

Description

The PR makes sure rendering into a render target with active mipmap level works as expected.

renderTargetData.width !== renderTarget.width ||
renderTargetData.height !== renderTarget.height ||
renderTargetData.activeMipmapLevel !== renderContext.activeMipmapLevel ||
renderTargetData.activeCubeFace !== renderContext.activeCubeFace ||
Copy link
Collaborator Author

@Mugen87 Mugen87 Aug 14, 2025

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.

@sunag sunag added this to the r180 milestone Aug 14, 2025
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.9
79.1
338.9
79.1
+0 B
+0 B
WebGPU 575.15
158.7
575.21
158.73
+62 B
+26 B
WebGPU Nodes 573.76
158.46
573.82
158.49
+62 B
+27 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 470.64
113.87
470.64
113.87
+0 B
+0 B
WebGPU 646.22
174.77
646.28
174.8
+62 B
+29 B
WebGPU Nodes 600.4
163.95
600.46
163.98
+62 B
+27 B

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 );
Copy link
Collaborator Author

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 ];
Copy link
Collaborator Author

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.

@Mugen87 Mugen87 merged commit 380bc38 into mrdoob:dev Aug 14, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants