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
Describe the bug
When a variable is defined multiple times in a file the first definition seems to be used for type checking. This can be a problem if multiple shader stages are written in the same file.
To Reproduce
#if VERTEX_SHADER
#version330invec3 color;
outvec3 fragColor;
void main() {
fragColor = color;
}
#else#version330invec3 fragColor;
outvec4 color;
void main() {
color =vec4(fragColor, 1); // error: Incompatible types as operands of '=': 'vec3' and 'vec4'
}
#endif
Expected behavior
Ideally there would be no complaints from Intellij for the above code.
If multiple shader stages in the same file is not supported, then I could of course put in them in separate files instead, or use another name for the variable. It would be a reasonable workaround for now.
Versions
IDE: IntelliJ IDEA Community Edition 2023.1.3
Plugin: 1.24
Extra context
My real code uses #pragma shader vert instead of #if, but I found that both versions had the same problem.
The text was updated successfully, but these errors were encountered:
If multiple shader stages in the same file is not supported
The plugin does not care about shader stages, the problem is that the plugin always processes both branches of the #if. This is not trivial to fix (at least for me) because of the fairly complex interactions between the preprocessor and the lexer. Basically the code is parsed as if the #if-else was not there.
Describe the bug
When a variable is defined multiple times in a file the first definition seems to be used for type checking. This can be a problem if multiple shader stages are written in the same file.
To Reproduce
Expected behavior
Ideally there would be no complaints from Intellij for the above code.
If multiple shader stages in the same file is not supported, then I could of course put in them in separate files instead, or use another name for the variable. It would be a reasonable workaround for now.
Versions
Extra context
My real code uses
#pragma shader vert
instead of#if
, but I found that both versions had the same problem.The text was updated successfully, but these errors were encountered: