Skip to content
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

WebGPURenderer: Fix clear for default framebuffer #30457

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Feb 5, 2025

Related issue: #30329 (comment)

Description

Fixes clear when rendering to default framebuffer as we don't need to forward the clearColorValue to any renderContext since it's directly accessible via color, depth, stencil.

This contribution is funded by Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r174 milestone Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.12
78.22
336.12
78.22
+0 B
+0 B
WebGPU 516.99
143.53
516.99
143.53
+0 B
+2 B
WebGPU Nodes 516.45
143.43
516.45
143.43
+0 B
+1 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.17
112.09
465.17
112.09
+0 B
+0 B
WebGPU 588.99
159.73
588.99
159.73
+0 B
+2 B
WebGPU Nodes 544.35
149.29
544.35
149.29
+0 B
+1 B

@sunag
Copy link
Collaborator

sunag commented Feb 5, 2025

Could we move this assignment to conditional above in renderTarget !== null? since renderContext is only assigned once

let renderContext = null;
if ( renderTarget !== null ) {
this._textures.updateRenderTarget( renderTarget );
const renderTargetData = this._textures.get( renderTarget );
renderContext = this._renderContexts.getForClear( renderTarget );
renderContext.textures = renderTargetData.textures;
renderContext.depthTexture = renderTargetData.depthTexture;
renderContext.width = renderTargetData.width;
renderContext.height = renderTargetData.height;
renderContext.renderTarget = renderTarget;
renderContext.depth = renderTarget.depthBuffer;
renderContext.stencil = renderTarget.stencilBuffer;
}
// #30329
if ( renderContext !== null ) {
renderContext.clearColorValue = this._clearColor;
}

@RenaudRohlinger
Copy link
Collaborator Author

Indeed

@Mugen87 Mugen87 merged commit a573413 into mrdoob:dev Feb 5, 2025
11 of 12 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.

3 participants