Fixes to scanning:
- do version checking for the line-continuation character - check for built-in names in #undef - bug fix for #elif after #else - do version checking for use of floating point suffixes (f, LF, etc.) git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24011 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -146,4 +146,7 @@ int foo203940(int a, float b, float a) // ERROR, a redefined
|
||||
return a;
|
||||
}
|
||||
|
||||
float f123 = 4.0f; // ERROR
|
||||
float f124 = 5e10F; // ERROR
|
||||
|
||||
uniform samplerExternalOES badExt; // syntax ERROR
|
||||
|
||||
@@ -36,7 +36,7 @@ void main()
|
||||
f += a;
|
||||
f = a - f;
|
||||
v3 *= iv3;
|
||||
v3 = iv3 / 2.0;
|
||||
v3 = iv3 / 2.0f;
|
||||
v3 = 3.0 * iv3;
|
||||
v3 = 2 * v3;
|
||||
v3 = v3 - 2;
|
||||
@@ -102,7 +102,7 @@ int foo(out float a) // ERROR
|
||||
|
||||
bool gen(vec3 v)
|
||||
{
|
||||
if (abs(v[0]) < 1e-4 && abs(v[1]) < 1e-4)
|
||||
if (abs(v[0]) < 1e-4F && abs(v[1]) < 1e-4)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ uniform ub {
|
||||
int a[]; // ERROR
|
||||
} ubInst[]; // ERROR
|
||||
void foo(int a[]); // ERROR
|
||||
float okayA[] = float[](3.0, 4.0); // Okay
|
||||
float okayA[] = float[](3.0f, 4.0F); // Okay
|
||||
|
||||
out vec3 newV;
|
||||
void newVFun()
|
||||
|
||||
@@ -57,8 +57,10 @@ ERROR: 0:137: 'bitwise not' : not supported for this version or the enabled exte
|
||||
ERROR: 0:138: 'bitwise inclusive or' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:139: 'bitwise and' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:144: 'a' : redefinition
|
||||
ERROR: 0:149: '' : syntax error
|
||||
ERROR: 53 compilation errors. No code generated.
|
||||
ERROR: 0:149: 'floating-point suffix' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:150: 'floating-point suffix' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:152: '' : syntax error
|
||||
ERROR: 55 compilation errors. No code generated.
|
||||
|
||||
ERROR: node is still EOpNull!
|
||||
0:3 Sequence
|
||||
@@ -245,6 +247,16 @@ ERROR: node is still EOpNull!
|
||||
0:146 Sequence
|
||||
0:146 Branch: Return with expression
|
||||
0:146 'a' (in mediump int)
|
||||
0:149 Sequence
|
||||
0:149 move second child to first child (mediump float)
|
||||
0:149 'f123' (mediump float)
|
||||
0:149 Constant:
|
||||
0:149 4.000000
|
||||
0:150 Sequence
|
||||
0:150 move second child to first child (mediump float)
|
||||
0:150 'f124' (mediump float)
|
||||
0:150 Constant:
|
||||
0:150 50000000000.000000
|
||||
0:? Linker Objects
|
||||
0:? 'a' (3-element array of mediump int)
|
||||
0:? 'uint' (mediump int)
|
||||
@@ -264,4 +276,6 @@ ERROR: node is still EOpNull!
|
||||
0:? 'sExt' (uniform lowp samplerExternalOES)
|
||||
0:? 'mediumExt' (uniform mediump samplerExternalOES)
|
||||
0:? 'highExt' (uniform highp samplerExternalOES)
|
||||
0:? 'f123' (mediump float)
|
||||
0:? 'f124' (mediump float)
|
||||
|
||||
|
||||
@@ -35,6 +35,24 @@
|
||||
0:86 'gl_Position' (gl_Position 4-component vector of float)
|
||||
0:86 Construct vec4 (4-component vector of float)
|
||||
0:86 'sum' (float)
|
||||
0:103 Sequence
|
||||
0:103 move second child to first child (int)
|
||||
0:103 'selected4' (int)
|
||||
0:103 Constant:
|
||||
0:103 4 (const int)
|
||||
0:115 Sequence
|
||||
0:115 move second child to first child (int)
|
||||
0:115 'selected2' (int)
|
||||
0:115 Constant:
|
||||
0:115 2 (const int)
|
||||
0:133 Sequence
|
||||
0:133 move second child to first child (int)
|
||||
0:133 'selected3' (int)
|
||||
0:133 Constant:
|
||||
0:133 3 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'sum' (float)
|
||||
0:? 'selected4' (int)
|
||||
0:? 'selected2' (int)
|
||||
0:? 'selected3' (int)
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ ERROR: 0:136: 'length' : no matching overloaded function found
|
||||
ERROR: 0:136: '=' : cannot convert from 'const float' to 'int'
|
||||
ERROR: 0:138: ''' : character literals not supported
|
||||
ERROR: 0:138: ''' : character literals not supported
|
||||
ERROR: 0:141: '#define' : reserved built-in name prefix: GL_
|
||||
ERROR: 0:142: '#define' : reserved built-in name prefix: GL_
|
||||
ERROR: 0:143: '#define' : names containing consecutive underscores are reserved
|
||||
ERROR: 0:144: '#define' : names containing consecutive underscores are reserved
|
||||
ERROR: 0:145: '#define' : names containing consecutive underscores are reserved
|
||||
ERROR: 0:141: '#define' : can't use with built-in names ("GL_" prefix)
|
||||
ERROR: 0:142: '#define' : can't use with built-in names ("GL_" prefix)
|
||||
ERROR: 0:143: '#define' : can't use with built-in names (containing consecutive underscores)
|
||||
ERROR: 0:144: '#define' : can't use with built-in names (containing consecutive underscores)
|
||||
ERROR: 0:145: '#define' : can't use with built-in names (containing consecutive underscores)
|
||||
ERROR: 0:148: '#else' : unexpected tokens following directive
|
||||
ERROR: 0:149: '#else' : #elif after #else
|
||||
ERROR: 0:155: '#else' : unexpected tokens following directive
|
||||
@@ -41,8 +41,10 @@ ERROR: 0:182: '#define' : Macro redefined; different number of arguments: m6
|
||||
ERROR: 0:185: '#define' : Macro redefined; different substitutions: m7
|
||||
ERROR: 0:192: '#define' : Macro redefined; different substitutions: m8
|
||||
ERROR: 0:196: '#define' : Macro redefined; different argument names: m9
|
||||
ERROR: 0:206: '' : missing #endif
|
||||
ERROR: 43 compilation errors. No code generated.
|
||||
ERROR: 0:204: '#undef' : can't use with built-in names (containing consecutive underscores)
|
||||
ERROR: 0:205: '#undef' : can't use with built-in names ("GL_" prefix)
|
||||
ERROR: 0:209: '' : missing #endif
|
||||
ERROR: 45 compilation errors. No code generated.
|
||||
|
||||
ERROR: node is still EOpNull!
|
||||
0:5 Sequence
|
||||
|
||||
21
Test/baseResults/lineContinuation100.vert.out
Normal file
21
Test/baseResults/lineContinuation100.vert.out
Normal file
@@ -0,0 +1,21 @@
|
||||
ERROR: 0:3: 'line continuation' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:6: '#error' : e1
|
||||
ERROR: 0:8: 'line continuation' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:11: '#error' : e2
|
||||
ERROR: 0:13: 'line continuation' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:14: 'line continuation' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:15: 'line continuation' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:18: '#error' : e3
|
||||
ERROR: 8 compilation errors. No code generated.
|
||||
|
||||
ERROR: node is still EOpNull!
|
||||
0:20 Function Definition: main( (void)
|
||||
0:20 Function Parameters:
|
||||
0:20 Sequence
|
||||
0:20 move second child to first child (highp 4-component vector of float)
|
||||
0:20 'gl_Position' (gl_Position highp 4-component vector of float)
|
||||
0:20 Construct vec4 (highp 4-component vector of float)
|
||||
0:20 'foo' (highp float)
|
||||
0:? Linker Objects
|
||||
0:? 'foo' (highp float)
|
||||
|
||||
@@ -2,7 +2,8 @@ ERROR: #version: versions before 150 do not allow a profile token
|
||||
ERROR: 0:38: 'attribute' : not supported in this stage: fragment
|
||||
ERROR: 0:40: 'sampler2DRect' : Reserved word.
|
||||
ERROR: 0:40: 'rectangle texture' : not supported for this version or the enabled extensions
|
||||
ERROR: 4 compilation errors. No code generated.
|
||||
ERROR: 0:44: 'floating-point suffix' : not supported for this version or the enabled extensions
|
||||
ERROR: 5 compilation errors. No code generated.
|
||||
|
||||
ERROR: node is still EOpNull!
|
||||
0:42 Function Definition: main( (void)
|
||||
|
||||
@@ -85,3 +85,52 @@ sum += 600000.0;
|
||||
// sum should be 987600301.0
|
||||
gl_Position = vec4(sum);
|
||||
}
|
||||
|
||||
#define A 1
|
||||
#define C 0
|
||||
#define E 0
|
||||
#define F 1
|
||||
#if A
|
||||
#if C
|
||||
#if E
|
||||
int selected4 = 1;
|
||||
#elif F
|
||||
int selected4 = 2;
|
||||
#else
|
||||
int selected4 = 3;
|
||||
#endif
|
||||
#endif
|
||||
int selected4 = 4;
|
||||
#endif
|
||||
|
||||
#define ZA 1
|
||||
#define ZC 1
|
||||
#define ZE 0
|
||||
#define ZF 1
|
||||
#if ZA
|
||||
#if ZC
|
||||
#if ZE
|
||||
int selected2 = 1;
|
||||
#elif ZF
|
||||
int selected2 = 2;
|
||||
#else
|
||||
int selected2 = 3;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define AZA 1
|
||||
#define AZC 1
|
||||
#define AZE 0
|
||||
#define AZF 0
|
||||
#if AZA
|
||||
#if AZC
|
||||
#if AZE
|
||||
int selected3 = 1;
|
||||
#elif AZF
|
||||
int selected3 = 2;
|
||||
#else
|
||||
int selected3 = 3;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -201,6 +201,9 @@ int n = n1;
|
||||
#define f1 .08e-2Lf
|
||||
double f = f1;
|
||||
|
||||
#undef __VERSION__
|
||||
#undef GL_ARB_texture_rectangle
|
||||
|
||||
#if 1
|
||||
#else
|
||||
// ERROR, missing #endif
|
||||
20
Test/lineContinuation100.vert
Normal file
20
Test/lineContinuation100.vert
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 100
|
||||
|
||||
// this file cont\
|
||||
ains no errors other than the #error which are there to see if line numbering for errors is correct
|
||||
|
||||
#error e1
|
||||
|
||||
float f\
|
||||
oo; // same as 'float foo;'
|
||||
|
||||
#error e2
|
||||
|
||||
#define MAIN void main() \
|
||||
{ \
|
||||
gl_Position = vec4(foo); \
|
||||
}
|
||||
|
||||
#error e3
|
||||
|
||||
MAIN
|
||||
@@ -26,7 +26,7 @@ void main()
|
||||
{
|
||||
lowp int sum = global_medium + global_high;
|
||||
|
||||
gl_FragColor = vec4(color, 1.0f);
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
|
||||
int level1_high;
|
||||
sum += level1_high;
|
||||
|
||||
@@ -37,5 +37,5 @@ varying vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(color, 1.0f);
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ tokenLength.vert
|
||||
420.vert
|
||||
420.geom
|
||||
430scope.vert
|
||||
lineContinuation100.vert
|
||||
lineContinuation.vert
|
||||
numeral.frag
|
||||
400.geom
|
||||
|
||||
Reference in New Issue
Block a user