Skip to content

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Mar 27, 2025

Closes: #28794

Description

Simplifies creation and layout and returns an error warning if the If statement is returning a value in an inline/non-layout function.

material.colorNode = Fn( ( [ uv ] ) => {

	If( uv.lessThan( 0.5 ), () => {

		return vec4( 1, 0, 0, 1 );

	} );

	return vec4( 0, 0, 1, 1 );

}, { uv: 'vec2', return: 'vec4' } )( uv()) );

@sunag sunag added this to the r175 milestone Mar 27, 2025
Copy link

github-actions bot commented Mar 27, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.08
78.29
336.08
78.29
+0 B
+0 B
WebGPU 531.16
147.59
532.29
147.91
+1.13 kB
+322 B
WebGPU Nodes 530.63
147.48
531.76
147.8
+1.13 kB
+323 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.15
112.18
465.15
112.18
+0 B
+0 B
WebGPU 602.86
163.57
604
163.91
+1.14 kB
+341 B
WebGPU Nodes 557.9
153.01
559.03
153.36
+1.14 kB
+352 B

@sunag
Copy link
Collaborator Author

sunag commented Mar 27, 2025

@Mugen87 Creating an automatic layout will involve more extensive work, so we can recommend creating a simplified layout in just one line.

@sunag sunag marked this pull request as ready for review March 27, 2025 15:46
@sunag sunag merged commit 96afe95 into mrdoob:dev Mar 27, 2025
12 checks passed
@sunag sunag deleted the dev-tslfn branch March 27, 2025 19:29
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: If statement produces WGSL error.
1 participant