diff --git a/Test/baseResults/cppComplexExpr.vert.out b/Test/baseResults/cppComplexExpr.vert.out index a214cd85..28e67f01 100644 --- a/Test/baseResults/cppComplexExpr.vert.out +++ b/Test/baseResults/cppComplexExpr.vert.out @@ -1,5 +1,9 @@ WARNING: #version: statement missing; use #version on first line of shader -0:? Sequence +ERROR: 0:46: 'xyxwx' : illegal vector field selection +ERROR: 0:46: 'xyxwx' : illegal vector field selection +ERROR: 2 compilation errors. No code generated. + +ERROR: node is still EOpNull! 0:4 Sequence 0:4 move second child to first child (highp float) 0:4 'sum' (highp float) @@ -24,6 +28,41 @@ WARNING: #version: statement missing; use #version on first line of shader 0:39 'gl_Position' (gl_Position highp 4-component vector of float) 0:39 Construct vec4 (highp 4-component vector of float) 0:39 'sum' (highp float) +0:44 Function Definition: foo( (highp float) +0:44 Function Parameters: +0:46 Sequence +0:46 Branch: Return with expression +0:46 add (highp float) +0:46 add (highp float) +0:46 direct index (highp float) +0:46 'gl_Position' (gl_Position highp 4-component vector of float) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 3.000000 +0:46 add (highp float) +0:46 direct index (highp float) +0:46 'gl_Position' (gl_Position highp 4-component vector of float) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 3.000000 +0:47 Branch: Return with expression +0:47 add (highp float) +0:47 add (highp float) +0:47 direct index (highp float) +0:47 'gl_Position' (gl_Position highp 4-component vector of float) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 3.000000 +0:47 add (highp float) +0:47 direct index (highp float) +0:47 'gl_Position' (gl_Position highp 4-component vector of float) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 3.000000 0:? Linker Objects 0:? 'sum' (highp float) diff --git a/Test/cppComplexExpr.vert b/Test/cppComplexExpr.vert index 852eba4d..f14a78d3 100644 --- a/Test/cppComplexExpr.vert +++ b/Test/cppComplexExpr.vert @@ -38,3 +38,11 @@ void main() // sum should be 321.0 gl_Position = vec4(sum); } + +#define ADD(a, b) a + b + ((a) + ((b))); + +float foo() +{ + return ADD(gl_Position.xyxwx, 3.0) // ERROR, should be this line number + return ADD(gl_Position.y, 3.0) +} diff --git a/Todo.txt b/Todo.txt index 6c8cb692..540c0775 100644 --- a/Todo.txt +++ b/Todo.txt @@ -54,6 +54,7 @@ Shader Functionality to Implement/Finish + Handle multiple compilation units per stage + Allow initializers on uniform declarations - signature matching takes type conversions into account, ambiguity is an error + - all constructors to contain non-dereferenced arrays? GLSL 1.3 . flat is for both user and predeclared built-in in/out variables GLSL 1.3 (Non-ES) diff --git a/glslang/MachineIndependent/preprocessor/PpContext.h b/glslang/MachineIndependent/preprocessor/PpContext.h index 394e8b6e..16d137ee 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/glslang/MachineIndependent/preprocessor/PpContext.h @@ -84,6 +84,7 @@ namespace glslang { class TPpToken { public: + TPpToken() { loc.line = 0; loc.string = 0; name[0] = 0; } static const int maxTokenLength = 1024; TSourceLoc loc; diff --git a/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 7adca676..4074e316 100644 --- a/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -297,7 +297,7 @@ void TPpContext::RewindTokenStream(TokenStream *pTok) * */ -int TPpContext::ReadToken(TokenStream *pTok, TPpToken * yylvalpp) +int TPpContext::ReadToken(TokenStream *pTok, TPpToken *yylvalpp) { //TODO: PP: why is this different than byte_scan @@ -399,8 +399,6 @@ int TPpContext::scan_token(TPpContext* pp, TokenInputSrc *in, TPpToken * yylvalp { int token = pp->ReadToken(in->tokens, yylvalpp); int (*final)(TPpContext *); - yylvalpp->loc.string = pp->currentInput->name; - yylvalpp->loc.line = pp->currentInput->line; if (token == '\n') { in->base.line++; return token;