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

Fix shader compilation for some node names with special characters #2916

Merged
merged 1 commit into from Aug 25, 2023

Conversation

MoritzBrueckner
Copy link
Collaborator

This PR fixes shader compilation for nodes or sockets with § or $ in their names and also fixes more cases where the shader compiler would output a warning because of consecutive underscores.

ERROR: [...]\compiled\Shaders\awning01_red__props_blend_mesh.frag.glsl:9: '$' : unexpected token

WARNING: [...]\compiled\Shaders\chimney005__props_blend_mesh.frag.glsl:38: 'VertexLitGeneric_GroupInput__bumpmap_texture__res' : identifiers containing consecutive underscores ("__") are reserved
WARNING: [...]\compiled\Shaders\chimney005__props_blend_mesh.frag.glsl:67: 'VertexLitGeneric_GroupInput__selfillummask_texturealpha__res' : identifiers containing consecutive underscores ("__") are reserved

There are more situations where Armory generates shader code with double underscores, but for some reason I couldn't reproduce a warning in the other cases I found... Nonetheless it may be a good idea to implement a function similar to utils.safestr() and utils.safesrc() but for shader identifiers, this way we could remove some of the (potentially redundant) double underscore correction code from other places and fix this whole class of errors once and for all. This function could also be used to ensure that generated variable names are unique (e.g. by appending consecutive numbers), I believe there are some cases where naming conflicts are possible...

@luboslenco luboslenco merged commit c3254b8 into armory3d:main Aug 25, 2023
@MoritzBrueckner MoritzBrueckner deleted the fix-shader-compilation branch August 26, 2023 21:44
@MoritzBrueckner MoritzBrueckner added the Release Notes: Fixes A pull request that fixes something. Used to generate release notes. label Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes: Fixes A pull request that fixes something. Used to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants