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

Nodes: OperatorNode - Maintain Variable Types In Comparison #29194

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

cmhhelgeson
Copy link
Contributor

Description

Maintains the types of variables used in a comparison operation unless they are different, in which case they are converted to floats.

This prevents TSL code where the user explicitly defines a non-float comparison between two values from resolving to a float comparison.

TSL Code:

const uTest = uniform( uint( 1 ) )
// etc
If( uTest.equal( uint( 1 ) ), () => {

WGSL Output:

// uTest variable
nodeUniform1: u32 

// Current Code
if ( ( f32( object.nodeUniform1 ) == f32( 1u ) )

// Changed Code
if ( ( object.nodeUniform1 == 1u ) )

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
685.4 kB (169.7 kB) 685.4 kB (169.7 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
462 kB (111.4 kB) 462 kB (111.4 kB) +0 B

@Mugen87 Mugen87 added this to the r168 milestone Aug 21, 2024
@sunag sunag merged commit 710aa87 into mrdoob:dev Aug 21, 2024
12 checks passed
@cmhhelgeson cmhhelgeson deleted the operator_maintain_type branch September 6, 2024 04:26
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