Include ?: in the tests for flow control.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@29348 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-01-07 06:36:55 +00:00
parent 05a62bf528
commit 548ec2c12c
4 changed files with 63 additions and 9 deletions

View File

@ -51,7 +51,7 @@ void main()
barrier(); // ERROR
break;
}
a < 12 ? a : (barrier(), a); // ERROR
{
barrier();
}

View File

@ -223,6 +223,7 @@ ERROR: 0:39: '' : tessellation control barrier() cannot be placed within flow co
ERROR: 0:41: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:46: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:51: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:54: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:61: '' : tessellation control barrier() cannot be placed after a return from main()
ERROR: 0:64: 'vertices' : can only apply to 'out'
ERROR: 0:65: 'vertices' : cannot change previously set layout value
@ -232,7 +233,7 @@ ERROR: 0:74: 'in' : type must be an array: ina
ERROR: 0:76: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized
ERROR: 0:83: 'location' : overlapping use of location 4
ERROR: 0:87: 'location' : overlapping use of location 4
ERROR: 17 compilation errors. No code generated.
ERROR: 18 compilation errors. No code generated.
Shader version: 400
@ -366,6 +367,18 @@ ERROR: node is still EOpNull!
0:? Sequence
0:51 Barrier (void)
0:52 Branch: Break
0:54 Test condition and select (int)
0:54 Condition
0:54 Compare Less Than (bool)
0:54 'a' (int)
0:54 Constant:
0:54 12 (const int)
0:54 true case
0:54 'a' (int)
0:54 false case
0:54 Comma (int)
0:54 Barrier (void)
0:54 'a' (int)
0:56 Sequence
0:56 Barrier (void)
0:59 Branch: Return
@ -1100,6 +1113,18 @@ vertices = 4
0:? Sequence
0:51 Barrier (void)
0:52 Branch: Break
0:54 Test condition and select (int)
0:54 Condition
0:54 Compare Less Than (bool)
0:54 'a' (int)
0:54 Constant:
0:54 12 (const int)
0:54 true case
0:54 'a' (int)
0:54 false case
0:54 Comma (int)
0:54 Barrier (void)
0:54 'a' (int)
0:56 Sequence
0:56 Barrier (void)
0:59 Branch: Return

View File

@ -8,6 +8,7 @@ ERROR: 0:39: '' : tessellation control barrier() cannot be placed within flow co
ERROR: 0:41: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:46: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:51: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:54: '' : tessellation control barrier() cannot be placed within flow control
ERROR: 0:61: '' : tessellation control barrier() cannot be placed after a return from main()
ERROR: 0:64: 'vertices' : can only apply to 'out'
ERROR: 0:65: 'vertices' : cannot change previously set layout value
@ -17,7 +18,7 @@ ERROR: 0:74: 'in' : type must be an array: ina
ERROR: 0:76: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized
ERROR: 0:83: 'location' : overlapping use of location 4
ERROR: 0:87: 'location' : overlapping use of location 4
ERROR: 17 compilation errors. No code generated.
ERROR: 18 compilation errors. No code generated.
Shader version: 400
@ -151,6 +152,18 @@ ERROR: node is still EOpNull!
0:? Sequence
0:51 Barrier (void)
0:52 Branch: Break
0:54 Test condition and select (int)
0:54 Condition
0:54 Compare Less Than (bool)
0:54 'a' (int)
0:54 Constant:
0:54 12 (const int)
0:54 true case
0:54 'a' (int)
0:54 false case
0:54 Comma (int)
0:54 Barrier (void)
0:54 'a' (int)
0:56 Sequence
0:56 Barrier (void)
0:59 Branch: Return
@ -337,6 +350,18 @@ ERROR: node is still EOpNull!
0:? Sequence
0:51 Barrier (void)
0:52 Branch: Break
0:54 Test condition and select (int)
0:54 Condition
0:54 Compare Less Than (bool)
0:54 'a' (int)
0:54 Constant:
0:54 12 (const int)
0:54 true case
0:54 'a' (int)
0:54 false case
0:54 Comma (int)
0:54 Barrier (void)
0:54 'a' (int)
0:56 Sequence
0:56 Barrier (void)
0:59 Branch: Return

View File

@ -568,15 +568,19 @@ logical_or_expression
conditional_expression
: logical_or_expression { $$ = $1; }
| logical_or_expression QUESTION expression COLON assignment_expression {
| logical_or_expression QUESTION {
++parseContext.controlFlowNestingLevel;
}
expression COLON assignment_expression {
--parseContext.controlFlowNestingLevel;
parseContext.boolCheck($2.loc, $1);
parseContext.rValueErrorCheck($2.loc, "?", $1);
parseContext.rValueErrorCheck($4.loc, ":", $3);
parseContext.rValueErrorCheck($4.loc, ":", $5);
$$ = parseContext.intermediate.addSelection($1, $3, $5, $2.loc);
parseContext.rValueErrorCheck($5.loc, ":", $4);
parseContext.rValueErrorCheck($5.loc, ":", $6);
$$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
if ($$ == 0) {
parseContext.binaryOpError($2.loc, ":", $3->getCompleteString(), $5->getCompleteString());
$$ = $5;
parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
$$ = $6;
}
}
;