Skip to content

WebGPURenderer: Improve support for output types#33299

Draft
sunag wants to merge 1 commit intomrdoob:devfrom
sunag:dev-rt-output-type
Draft

WebGPURenderer: Improve support for output types#33299
sunag wants to merge 1 commit intomrdoob:devfrom
sunag:dev-rt-output-type

Conversation

@sunag
Copy link
Copy Markdown
Collaborator

@sunag sunag commented Mar 31, 2026

Closes #33283

Description

Improve support for different types of format and output of the RenderTarget. Previously, they incorrectly defaulted to float integer types and mappings across the pipeline layout, causing WGSL and GLSL failures during parsing or sampling.

@github-actions
Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 360.06
85.47
360.06
85.47
+0 B
+0 B
WebGPU 633.13
175.68
633.49
175.82
+355 B
+134 B
WebGPU Nodes 631.25
175.39
631.61
175.52
+355 B
+133 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 492.3
120.06
492.3
120.06
+0 B
+0 B
WebGPU 705.19
190.56
705.55
190.66
+359 B
+91 B
WebGPU Nodes 654.41
177.83
654.77
177.96
+359 B
+130 B

@Mugen87
Copy link
Copy Markdown
Collaborator

Mugen87 commented Mar 31, 2026

webgpu_postprocessing_dof breaks with this PR. The blur near the camera is now gone and I see these errros in the console:

image

I've remembered this effect since it makes use of outputStruct() to write into two render target textures at the same time (meaning the shader has two outputs).

const outputNode = outputStruct( nearField, farField );

Since the render target has a RedFormat, I think you should be able to fix this by changing below line although I'm not sure that's the right fix:

to

return float( 0 ); 

@sunag
Copy link
Copy Markdown
Collaborator Author

sunag commented Mar 31, 2026

webgpu_postprocessing_dof breaks with this PR. The blur near the camera is now gone and I see these errros in the console

Thank you for checking, I was imagining that I would need to review this after removing the structure validation of the fragment, I will use this example to verify.

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: Add support for rendering to integer-format render targets

2 participants