Skip to content

PassNode: Fix depthTexture creation when depthBuffer: false#33239

Merged
sunag merged 3 commits intomrdoob:devfrom
thelazylamaGit:PassNodeOptionalDepth
Apr 16, 2026
Merged

PassNode: Fix depthTexture creation when depthBuffer: false#33239
sunag merged 3 commits intomrdoob:devfrom
thelazylamaGit:PassNodeOptionalDepth

Conversation

@thelazylamaGit
Copy link
Copy Markdown
Contributor

With PassNode a depth texture was always being created even when explicitly setting { depthBuffer: false }.

Additonally, Textures.updateRenderTarget() also handled depth before checking whether it was actually enabled. Because of that, a depth texture could end up being created even with depth disabled.

This pr ensures that when creating a pass such as

pass(this.scene, this.camera, { depthBuffer: false }))

no depth texture is created.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 25, 2026

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 360.01
85.46
360.01
85.46
+0 B
+0 B
WebGPU 633.22
175.54
633.33
175.58
+113 B
+32 B
WebGPU Nodes 631.34
175.25
631.45
175.28
+113 B
+31 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 492.21
120.03
492.21
120.03
+0 B
+0 B
WebGPU 705.25
190.44
705.36
190.46
+113 B
+21 B
WebGPU Nodes 654.47
177.68
654.58
177.71
+113 B
+22 B

@sunag sunag added this to the r185 milestone Mar 27, 2026
@sunag sunag merged commit e7df696 into mrdoob:dev Apr 16, 2026
10 checks passed
@Mugen87
Copy link
Copy Markdown
Collaborator

Mugen87 commented Apr 17, 2026

This PR introduces breakage in the AO demo. The following WebGPU warning appears now in the browser console:

Copy origin ([Origin3D x:0, y:0, z:0]) and size ([Extent3D width:4400, height:1828, depthOrArrayLayers:1]) does not cover the entire subresource (origin: [x: 0, y: 0], size: [Extent3D width:1, height:1, depthOrArrayLayers:1]) of [Texture (unlabeled 1x1 px, TextureFormat::Depth24Plus)]. The entire subresource must be copied when the format (TextureFormat::Depth24Plus) is a depth/stencil format or the sample count (1) is > 1.
 - While validating destination [Texture (unlabeled 1x1 px, TextureFormat::Depth24Plus)].
 - While [Failed to format error message: "encoding %s.CopyTextureToTexture(%s, %s, %s)."].
 - While finishing [CommandEncoder "copyTextureToTexture_19_27"].

@thelazylamaGit
Copy link
Copy Markdown
Contributor Author

Yep I see the problem, the AO example uses TRAANode which creates a renderTarget with depthBuffer: false but then manually supplies its own DepthTexture

this._historyRenderTarget = new RenderTarget( 1, 1, { depthBuffer: false, type: HalfFloatType, depthTexture: new DepthTexture() } );

I'll work on a fix making sure to handle this case

@Mugen87
Copy link
Copy Markdown
Collaborator

Mugen87 commented Apr 17, 2026

Thank you!

BTW: I know it can feel off-putting if the own PR is reverted but I just want to say that I don't intend to be mean here^^. It's more about having a functional dev branch that does not irritate or hamper the work of other developers. I'm thankful for everyones understanding in that regard.

@thelazylamaGit
Copy link
Copy Markdown
Contributor Author

No worries, I understand. Just happy to contribute and glad the regression was caught so soon after being merged. New PR is up now which fixes the issue.

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.

3 participants