KhronosGroup / KhronosGroup/glslang
glslang shouldn't report the error for defined Preprocessor directives
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
Hi,
Acoording to the glsl4.6 spec ,ch3.3 Preprocessor :
> #if, #ifdef, #ifndef, #else, #elif, and #endif are defined to operate as is standard for C++ preprocessors.
> Expressions following #if and #elif are further restricted to expressions operating on literal integer
> constants, plus identifiers consumed by the defined operator
So glslang shouldn't report the error for following shader for defined Preprocessor directives. but Glslang report error
> ERROR: 0:10: 'defined' : cannot use in preprocessor expression when expanded from macros
shader:
```
#version 300 es
precision mediump float;
in highp vec4 dEQP_Position;
out float out0;
void main()
{
#define AAA defined(BBB)
#if !AAA
out0 = 1.0;
#else
out0 = 0.0;
#endif
gl_Position = dEQP_Position;
}
```
thank you.
Contributor guide
Assessment
This issue has not been assessed yet.