You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using label() or toVar() to give variables a name, collisions can occur when the name is already reserved for internal entities like uniforms or varyings.
If you now redefine a variable on app level, a shader error occurs. In WGSL for example:
Error while parsing WGSL: :40:2 error: redefinition of 'cameraNear'
Solution
It would be nice if the node material could automatically detect such name collisions and modify the custom names e.g. with a suffix.
Alternatives
Leave it as it is and ask developers to pick unique names.
.label() is used for uniforms, the names should be detected in shader level. Any uniform generated from a unique node should have a unique name
toVar() is used for variables in shader. any variable in a Fn should be visible only in this Fn. Becasue all vars are defined on the top of main function, the name of any variable in a Fn should not collide with any other variables in any other Fns. So far, one situation I meet is
After shader building, the logic of the shader is totally different from what I want. The builder thinks all var1 is the same variable, the value of different var1 will be affected by others.
Description
When using
label()
ortoVar()
to give variables a name, collisions can occur when the name is already reserved for internal entities like uniforms or varyings.If you now redefine a variable on app level, a shader error occurs. In WGSL for example:
Solution
It would be nice if the node material could automatically detect such name collisions and modify the custom names e.g. with a suffix.
Alternatives
Leave it as it is and ask developers to pick unique names.
Additional context
#29810
The text was updated successfully, but these errors were encountered: