Commit ba5cc2fa by John Kessenich

GLSL: Fix #822: Improve information given for syntax errors.

Also, fixed one test file that didn't have its syntax error as the last line.
parent 0c6f9360
...@@ -184,10 +184,8 @@ void qlod() ...@@ -184,10 +184,8 @@ void qlod()
lod = textureQueryLod(sampRect, pf2); // ERROR lod = textureQueryLod(sampRect, pf2); // ERROR
} }
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member
uniform uint uu; uniform uint uu;
out int iout; out uint iout;
void bitwiseConv() void bitwiseConv()
{ {
...@@ -195,3 +193,5 @@ void bitwiseConv() ...@@ -195,3 +193,5 @@ void bitwiseConv()
iout += uu ^ i; iout += uu ^ i;
iout += i | uu; iout += i | uu;
} }
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member
...@@ -84,7 +84,7 @@ ERROR: 0:194: '.' : cannot apply to an array: method ...@@ -84,7 +84,7 @@ ERROR: 0:194: '.' : cannot apply to an array: method
ERROR: 0:194: 'a' : can't use function syntax on variable ERROR: 0:194: 'a' : can't use function syntax on variable
ERROR: 0:214: 'non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)' : not supported for this version or the enabled extensions ERROR: 0:214: 'non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)' : not supported for this version or the enabled extensions
ERROR: 0:3000: '#error' : line of this error should be 3000 ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:3002: '' : syntax error ERROR: 0:3002: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 77 compilation errors. No code generated. ERROR: 77 compilation errors. No code generated.
......
...@@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone ...@@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone
ERROR: 0:212: 'sampler2DRect' : Reserved word. ERROR: 0:212: 'sampler2DRect' : Reserved word.
ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion) ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion) ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion)
ERROR: 0:248: '' : syntax error ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 54 compilation errors. No code generated. ERROR: 54 compilation errors. No code generated.
......
...@@ -43,7 +43,7 @@ ERROR: 0:156: 'invariant' : can only apply to an output ...@@ -43,7 +43,7 @@ ERROR: 0:156: 'invariant' : can only apply to an output
ERROR: 0:157: 'invariant' : can only apply to an output ERROR: 0:157: 'invariant' : can only apply to an output
ERROR: 0:158: 'invariant' : can only apply to an output ERROR: 0:158: 'invariant' : can only apply to an output
ERROR: 0:160: 'imageBuffer' : Reserved word. ERROR: 0:160: 'imageBuffer' : Reserved word.
ERROR: 0:160: '' : syntax error ERROR: 0:160: '' : syntax error, unexpected IMAGEBUFFER, expecting COMMA or SEMICOLON
ERROR: 45 compilation errors. No code generated. ERROR: 45 compilation errors. No code generated.
......
...@@ -34,7 +34,7 @@ ERROR: 0:183: 'textureQueryLod' : no matching overloaded function found ...@@ -34,7 +34,7 @@ ERROR: 0:183: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:183: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float' ERROR: 0:183: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:184: 'textureQueryLod' : no matching overloaded function found ERROR: 0:184: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:184: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float' ERROR: 0:184: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:187: '' : syntax error ERROR: 0:197: '' : syntax error, unexpected PRECISE, expecting IDENTIFIER
ERROR: 35 compilation errors. No code generated. ERROR: 35 compilation errors. No code generated.
...@@ -469,6 +469,27 @@ ERROR: node is still EOpNull! ...@@ -469,6 +469,27 @@ ERROR: node is still EOpNull!
0:181 'pf3' ( temp 3-component vector of float) 0:181 'pf3' ( temp 3-component vector of float)
0:183 'lod' ( temp 2-component vector of float) 0:183 'lod' ( temp 2-component vector of float)
0:184 'lod' ( temp 2-component vector of float) 0:184 'lod' ( temp 2-component vector of float)
0:190 Function Definition: bitwiseConv( ( global void)
0:190 Function Parameters:
0:192 Sequence
0:192 move second child to first child ( temp uint)
0:192 'iout' ( out uint)
0:192 bitwise and ( temp uint)
0:192 'uu' ( uniform uint)
0:192 Convert int to uint ( temp uint)
0:192 'i' ( flat in int)
0:193 add second child into first child ( temp uint)
0:193 'iout' ( out uint)
0:193 exclusive-or ( temp uint)
0:193 'uu' ( uniform uint)
0:193 Convert int to uint ( temp uint)
0:193 'i' ( flat in int)
0:194 add second child into first child ( temp uint)
0:194 'iout' ( out uint)
0:194 inclusive-or ( temp uint)
0:194 Convert int to uint ( temp uint)
0:194 'i' ( flat in int)
0:194 'uu' ( uniform uint)
0:? Linker Objects 0:? Linker Objects
0:? 'c2D' ( smooth in 2-component vector of float) 0:? 'c2D' ( smooth in 2-component vector of float)
0:? 'i' ( flat in int) 0:? 'i' ( flat in int)
...@@ -512,6 +533,8 @@ ERROR: node is still EOpNull! ...@@ -512,6 +533,8 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow) 0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer) 0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect) 0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)
Linked fragment stage: Linked fragment stage:
...@@ -685,4 +708,6 @@ ERROR: node is still EOpNull! ...@@ -685,4 +708,6 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow) 0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer) 0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect) 0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)
...@@ -6,7 +6,7 @@ ERROR: 0:4: 'preprocessor evaluation' : bad expression ...@@ -6,7 +6,7 @@ ERROR: 0:4: 'preprocessor evaluation' : bad expression
ERROR: 0:4: '#if' : unexpected tokens following directive ERROR: 0:4: '#if' : unexpected tokens following directive
ERROR: 0:6: '€' : unexpected token ERROR: 0:6: '€' : unexpected token
ERROR: 0:7: 'string' : End of line in string ERROR: 0:7: 'string' : End of line in string
ERROR: 0:7: '' : syntax error ERROR: 0:7: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated. ERROR: 8 compilation errors. No code generated.
......
...@@ -4,7 +4,7 @@ ERROR: 0:2: '#if' : unexpected tokens following directive ...@@ -4,7 +4,7 @@ ERROR: 0:2: '#if' : unexpected tokens following directive
ERROR: 0:5: 'string' : End of line in string ERROR: 0:5: 'string' : End of line in string
ERROR: 0:5: 'macro expansion' : expected '(' following n ERROR: 0:5: 'macro expansion' : expected '(' following n
ERROR: 0:5: '""' : string literals not supported ERROR: 0:5: '""' : string literals not supported
ERROR: 0:5: '' : syntax error ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 6 compilation errors. No code generated. ERROR: 6 compilation errors. No code generated.
......
cppIndent.vert cppIndent.vert
ERROR: 0:61: 'macro expansion' : Too few args in Macro FUNC ERROR: 0:61: 'macro expansion' : Too few args in Macro FUNC
ERROR: 0:61: '' : syntax error ERROR: 0:61: '' : syntax error, unexpected COMMA
ERROR: 2 compilation errors. No code generated. ERROR: 2 compilation errors. No code generated.
......
...@@ -2,7 +2,7 @@ glspv.frag ...@@ -2,7 +2,7 @@ glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error ) ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100 ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 0:14: '' : syntax error ERROR: 0:14: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 4 compilation errors. No code generated. ERROR: 4 compilation errors. No code generated.
......
...@@ -7,7 +7,7 @@ ERROR: 0:9: 'packed' : not allowed when generating SPIR-V ...@@ -7,7 +7,7 @@ ERROR: 0:9: 'packed' : not allowed when generating SPIR-V
ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
ERROR: 0:20: '' : syntax error ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated. ERROR: 8 compilation errors. No code generated.
......
...@@ -19,7 +19,7 @@ ERROR: 0:112: '#if' : unexpected tokens following directive ...@@ -19,7 +19,7 @@ ERROR: 0:112: '#if' : unexpected tokens following directive
ERROR: 0:117: 'macro expansion' : End of line in macro substitution: FOOM ERROR: 0:117: 'macro expansion' : End of line in macro substitution: FOOM
ERROR: 0:118: 'preprocessor evaluation' : can't evaluate expression ERROR: 0:118: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:118: '#if' : unexpected tokens following directive ERROR: 0:118: '#if' : unexpected tokens following directive
ERROR: 0:150: '' : syntax error ERROR: 0:150: '' : syntax error, unexpected EQUAL
ERROR: 19 compilation errors. No code generated. ERROR: 19 compilation errors. No code generated.
......
syntaxError.frag syntaxError.frag
ERROR: 0:9: 'vec5' : undeclared identifier ERROR: 0:9: 'vec5' : undeclared identifier
ERROR: 0:9: '' : syntax error ERROR: 0:9: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 2 compilation errors. No code generated. ERROR: 2 compilation errors. No code generated.
......
...@@ -63,6 +63,8 @@ using namespace glslang; ...@@ -63,6 +63,8 @@ using namespace glslang;
%} %}
%define parse.error verbose
%union { %union {
struct { struct {
glslang::TSourceLoc loc; glslang::TSourceLoc loc;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment