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 trying to use shader includes inside the body of the fragment() function, an error occurs when setting EMISSION after the include: Invalid include exit hint @@< without matching enter hint.
Edit: Seems this also happens setting ALPHA, ROUGHNESS, etc. Likely any built-in that can be set.
Steps to reproduce
Create a material.
Convert it to a shader material.
Copy the contents in the fragment() function into a new shader include.
Include the shader include inside the fragment() function.
Set EMISSION to something after the include. Note error. Setting before the include works fine.
Minimal reproduction project
(upload failed, will post in reply).
The text was updated successfully, but these errors were encountered:
jitspoe
changed the title
"Invalid include exit hint @@< without matching enter hint." error setting EMISSION after shader #include
"Invalid include exit hint @@< without matching enter hint." error setting built-ins after shader #include
Sep 1, 2023
Looks like the shader parser does some backtracking which breaks the include end marker as it is processed multiple times. Basically any assignment immediately after an #include inside a function body will cause this. Workaround is trivial, for example add a dummy variable declaration or re-order the statements as you noticed:
I ended up scrapping this method of including shaders mid function due to the errors and also I started running into a problem where every time I edited a shader, it would get stuck in a near-infinite loop of triggering shader recompiling causing the editor to freeze up for sometimes minutes at a time, making it basically impossible to edit shaders. I couldn't figure out how to repro it in a minimal case, though, and ended up just reverting everything in frustration. Should have saved the problematic shaders. Ah, well.
Decided to go with more of an uber shader with #define's instead.
Godot version
4.1.1.stable.official
System information
Windows 10, Vulkan forward +
Issue description
When trying to use shader includes inside the body of the fragment() function, an error occurs when setting EMISSION after the include:
Invalid include exit hint @@< without matching enter hint.
Edit: Seems this also happens setting ALPHA, ROUGHNESS, etc. Likely any built-in that can be set.
Steps to reproduce
Create a material.
Convert it to a shader material.
Copy the contents in the fragment() function into a new shader include.
Include the shader include inside the fragment() function.
Set EMISSION to something after the include. Note error. Setting before the include works fine.
Minimal reproduction project
(upload failed, will post in reply).
The text was updated successfully, but these errors were encountered: