Skip to content

TSL: Avoid naming collision when using label() or toVar(). #29813

Closed
@Mugen87

Description

@Mugen87

Description

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.

Additional context

#29810

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions