Skip to content

TSL: Fix dispose() when using reflector(). #30933

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged

TSL: Fix dispose() when using reflector(). #30933

merged 1 commit into from
Apr 15, 2025

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Apr 15, 2025

Fixed #30929.

Description

The PR makes sure ReflectorNode.dispose() works as expected.

@@ -445,10 +443,16 @@ class Textures extends DataMap {
*/
_destroyTexture( texture ) {

this.backend.destroySampler( texture );
this.backend.destroyTexture( texture );
if ( this.has( texture ) === true ) {
Copy link
Collaborator Author

@Mugen87 Mugen87 Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to make sure the following does not break the dispose logic:

renderTarget.dispose();
renderTarget.texture.dispose();

Since calling dispose() on the render target disposes all of its textures, it's important to ensure dispose() directly called on a texture does not trigger redundant operations.

@Mugen87 Mugen87 added this to the r176 milestone Apr 15, 2025
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.49
78.38
336.49
78.38
+0 B
+0 B
WebGPU 544.68
150.82
544.84
150.85
+157 B
+28 B
WebGPU Nodes 544.03
150.66
544.19
150.69
+157 B
+28 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.58
112.26
465.58
112.26
+0 B
+0 B
WebGPU 618.38
167.07
618.4
167.08
+20 B
+4 B
WebGPU Nodes 573.25
156.44
573.27
156.45
+20 B
+2 B

@Mugen87 Mugen87 merged commit 173a496 into mrdoob:dev Apr 15, 2025
12 checks passed
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
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.

TSL: Can not dispose NodeMaterial correct
1 participant