diff --git a/Install/Windows/glslangValidator.exe b/Install/Windows/glslangValidator.exe index 35f1078b1c8914659dca919c700fbf723d35f123..e3cbb6d42a486e1c439e309a1b27796cb52f5c67 100644 Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ diff --git a/Test/baseResults/120.frag.out b/Test/baseResults/120.frag.out index bbcda69006f59588a8b7ec31896363895324eeea..777a0e92b45e70e24bc373af1b8cc2073cc42a26 100644 --- a/Test/baseResults/120.frag.out +++ b/Test/baseResults/120.frag.out @@ -292,4 +292,6 @@ ERROR: node is still EOpNull! 0:? 'm' (uniform 4X2 matrix of float) 0:? 'imageBuffer' (float) 0:? 'uimage2DRect' (float) +0:? 'a' (int) +0:? 'gl_TexCoord' (smooth in 6-element array of 4-component vector of float) diff --git a/Test/baseResults/120.vert.out b/Test/baseResults/120.vert.out index adabd12145eb5e73dc268d46e13fba4fe1f98f50..96a7fee25aa5498812fbe3461cf6d1c102f748db 100644 --- a/Test/baseResults/120.vert.out +++ b/Test/baseResults/120.vert.out @@ -23,12 +23,11 @@ ERROR: 0:37: 'arrays of arrays' : not supported with this profile: none ERROR: 0:38: 'arrays of arrays' : not supported with this profile: none ERROR: 0:38: 'constructor' : array constructor needs one argument per array element ERROR: 0:38: 'arrays of arrays' : not supported with this profile: none -ERROR: 0:43: 'uniform' : cannot initialize this type of qualifier ERROR: 0:47: 'arrays of arrays' : not supported with this profile: none ERROR: 0:48: 'arrays of arrays' : not supported with this profile: none ERROR: 0:49: 'arrays of arrays' : not supported with this profile: none ERROR: 0:50: 'arrays of arrays' : not supported with this profile: none -ERROR: 30 compilation errors. No code generated. +ERROR: 29 compilation errors. No code generated. ERROR: node is still EOpNull! 0:15 Function Definition: main( (void) @@ -71,6 +70,10 @@ ERROR: node is still EOpNull! 0:40 move second child to first child (float) 0:40 'gl_PointSize' (invariant gl_PointSize float) 0:40 3.800000 +0:43 Sequence +0:43 move second child to first child (float) +0:43 'initted' (uniform float) +0:43 3.400000 0:? Linker Objects 0:? 'i' (in 4-component vector of float) 0:? 'o' (smooth out 4-component vector of float) @@ -78,4 +81,6 @@ ERROR: node is still EOpNull! 0:? 'attv4' (in 4-component vector of float) 0:? 's2D' (uniform sampler2D) 0:? 'centTexCoord' (invariant smooth out 2-component vector of float) +0:? 'initted' (uniform float) +0:? 'concall' (const float) diff --git a/Test/baseResults/130.frag.out b/Test/baseResults/130.frag.out index 38fa1aac3dfe9df9567884cb64ed6cae7d363cab..b1eada0d34a7592d97f069d6768b87250d1fd71d 100644 --- a/Test/baseResults/130.frag.out +++ b/Test/baseResults/130.frag.out @@ -2,6 +2,9 @@ 0:16 Function Definition: main( (void) 0:16 Function Parameters: 0:? Linker Objects +0:? 'a' (3-component vector of float) +0:? 'b' (float) +0:? 'c' (int) 0:? 'i' (smooth in 4-component vector of float) 0:? 'o' (out 4-component vector of float) 0:? 'fflat' (flat in float) diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out index 9fc969b63b37ac22e4191b564e03069aaa230c09..7f15f9181a8f26016c4bd11e91f2eeaf82bb0a74 100644 --- a/Test/baseResults/300.frag.out +++ b/Test/baseResults/300.frag.out @@ -217,6 +217,7 @@ ERROR: node is still EOpNull! 0:? 'c1D' (smooth in lowp float) 0:? 'c2D' (smooth in lowp 2-component vector of float) 0:? 'c3D' (smooth in lowp 3-component vector of float) +0:? 'c4D' (smooth lowp 4-component vector of float) 0:? 'ic1D' (flat in mediump int) 0:? 'ic2D' (flat in mediump 2-component vector of int) 0:? 'ic3D' (flat in mediump 3-component vector of int) @@ -227,5 +228,6 @@ ERROR: node is still EOpNull! 0:? 's2' (smooth in structure) 0:? 'sc' (out lowp 3-component vector of float) 0:? 'sf' (out lowp float) +0:? 'arrayedSampler' (uniform 5-element array of lowp sampler2D) 0:? 'multiInst' (layout(shared ) uniform 2-element array of block) diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index 567be86549ff0a1223465a5388a963a8c3954481..1388f662e4d68427c7804571641c2c57fe0941c5 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -126,6 +126,7 @@ ERROR: node is still EOpNull! 0:? 'm44' (uniform highp 4X4 matrix of float) 0:? 'v3' (in highp 3-component vector of float) 0:? 'v2' (smooth out highp 2-component vector of float) +0:? 'bad' (in 10-element array of highp 4-component vector of float) 0:? 'badorder' (in highp 4-component vector of float) 0:? 'badorder2' (invariant smooth out highp 4-component vector of float) 0:? 'badorder4' (centroid in highp 4-component vector of float) @@ -134,8 +135,10 @@ ERROR: node is still EOpNull! 0:? 'rep2' (centroid smooth sample out highp 4-component vector of float) 0:? 'rep3' (in highp 4-component vector of float) 0:? 's' (smooth out structure) +0:? 'badsize' (unsized array of highp float) 0:? 'badsize2' (unsized array of highp float) 0:? 'ubInst' (layout(shared ) uniform unsized array of block) +0:? 'okayA' (2-element array of highp float) 0:? 'gl_VertexID' (gl_VertexId highp int) 0:? 'gl_InstanceID' (gl_InstanceId highp int) diff --git a/Test/baseResults/300layout.frag.out b/Test/baseResults/300layout.frag.out index 2610ad88140995491583195915579b2465485cc3..f2128e10f8c9a3bd834522992c400f6e1a1f39ef 100644 --- a/Test/baseResults/300layout.frag.out +++ b/Test/baseResults/300layout.frag.out @@ -21,4 +21,5 @@ ERROR: node is still EOpNull! 0:? 'color' (layout(location=2 ) smooth in mediump 4-component vector of float) 0:? 'c' (layout(location=1 ) out mediump 4-component vector of float) 0:? 'p' (layout(location=3 ) out mediump 4-component vector of float) +0:? 'q' (layout(location=4 ) out 2-element array of mediump 4-component vector of float) diff --git a/Test/baseResults/300layout.vert.out b/Test/baseResults/300layout.vert.out index 241d003c6742badadee300b97e620283c0898356..77f487da401278d576281e623091fbd971b387d0 100644 --- a/Test/baseResults/300layout.vert.out +++ b/Test/baseResults/300layout.vert.out @@ -49,12 +49,15 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'c' (layout(location=7 ) in highp 3-component vector of float) 0:? 'p' (layout(location=3 ) in highp 4-component vector of float) +0:? 'q' (layout(location=9 ) in 4-element array of highp 4-component vector of float) +0:? 'r' (layout(location=10 ) in 4-element array of structure) 0:? 'pos' (smooth out highp 4-component vector of float) 0:? 'color' (smooth out highp 3-component vector of float) 0:? 'badm4' (layout(column_major shared ) uniform highp 4X4 matrix of float) 0:? 'tblock' (layout(std140 ) uniform block) 0:? '__anon__0' (layout(shared ) uniform block) 0:? 'badout' (layout(location=10 ) smooth out highp 4-component vector of float) +0:? 'compute_only' (shared highp 4-component vector of float) 0:? 'gl_VertexID' (gl_VertexId highp int) 0:? 'gl_InstanceID' (gl_InstanceId highp int) diff --git a/Test/baseResults/300operations.frag.out b/Test/baseResults/300operations.frag.out index a679ca08a3ad6f7bcbb0d9bfc2d8a38e3a5ee18e..a40b7f79a842b728c202102a7d63bf6071582018 100644 --- a/Test/baseResults/300operations.frag.out +++ b/Test/baseResults/300operations.frag.out @@ -200,4 +200,5 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'instanceName' (layout(shared ) uniform block) 0:? 's' (structure) +0:? 'a' (5-element array of mediump float) diff --git a/Test/baseResults/400.frag.out b/Test/baseResults/400.frag.out index fe783037679541c1c4b5eb3f7fb8751ffd227025..df37e93ed3a93d3a254962f890d4d214a7b0967a 100644 --- a/Test/baseResults/400.frag.out +++ b/Test/baseResults/400.frag.out @@ -15,4 +15,5 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'c2D' (smooth in 2-component vector of float) 0:? 'i' (flat in int) +0:? 'arrayedSampler' (uniform 5-element array of sampler2D) diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out index af98606ca42d61332571843c00614ecdf6b917c7..4150d4ec555e769918d03eaea28ba211ce8a1957 100644 --- a/Test/baseResults/420.vert.out +++ b/Test/baseResults/420.vert.out @@ -37,6 +37,7 @@ ERROR: node is still EOpNull! 0:30 'v' (in 4-component vector of float) 0:? Linker Objects 0:? 'v2' (smooth out 2-component vector of float) +0:? 'bad' (in 10-element array of 4-component vector of float) 0:? 'badorder' (in 4-component vector of float) 0:? 'badorder2' (invariant smooth out 4-component vector of float) 0:? 'badorder4' (centroid in 4-component vector of float) diff --git a/Test/baseResults/array.frag.out b/Test/baseResults/array.frag.out index f12c264952a8d99e331ba76df99874237971ab68..fa745eb3680dd26f413ce434fdd10b732bd9a9d2 100644 --- a/Test/baseResults/array.frag.out +++ b/Test/baseResults/array.frag.out @@ -147,5 +147,8 @@ ERROR: node is still EOpNull! 0:58 1 (const int) 0:58 4 (const int) 0:? Linker Objects +0:? 'gu' (unsized array of float) +0:? 'g4' (4-element array of float) +0:? 'g5' (5-element array of float) 0:? 'a' (uniform int) diff --git a/Test/baseResults/array100.frag.out b/Test/baseResults/array100.frag.out index 4dd0235f1bb0a72cd3c589e8ea1ab2541821bf37..d3eb52954fbbc0754bb64aeae707f775e1f6cd07 100644 --- a/Test/baseResults/array100.frag.out +++ b/Test/baseResults/array100.frag.out @@ -99,5 +99,8 @@ ERROR: node is still EOpNull! 0:40 1.000000 0:40 1.000000 0:? Linker Objects +0:? 'gu' (unsized array of mediump float) +0:? 'g4' (4-element array of mediump float) +0:? 'g5' (5-element array of mediump float) 0:? 'a' (uniform mediump int) diff --git a/Test/baseResults/constErrors.frag.out b/Test/baseResults/constErrors.frag.out index abc1b67eafa972ccbebdad0436a0cf5c480e4f86..82913151c0aa7e823b7386d994667cff2ee2f3e8 100644 --- a/Test/baseResults/constErrors.frag.out +++ b/Test/baseResults/constErrors.frag.out @@ -15,5 +15,8 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'inVar' (smooth in 4-component vector of float) 0:? 'outVar' (out 4-component vector of float) +0:? 'constInt' (const int) 0:? 'uniformInt' (uniform int) +0:? 's' (structure) +0:? 's2' (structure) diff --git a/Test/baseResults/constFold.frag.out b/Test/baseResults/constFold.frag.out index fff747b7b1cfc5898ba0f5a3f59806fdff844a07..8d7b1203b86750eea3664c96062c9eb3e520f6c7 100644 --- a/Test/baseResults/constFold.frag.out +++ b/Test/baseResults/constFold.frag.out @@ -138,6 +138,14 @@ 0:81 0 (const int) 0:81 7.000000 0:? Linker Objects +0:? 'a' (const int) +0:? 'b' (const int) +0:? 'c' (const int) +0:? 'd' (const int) +0:? 'e' (const float) +0:? 'f' (const float) +0:? 'g' (const float) +0:? 'pytho' (const 2-component vector of float) 0:? 'inv' (smooth in 4-component vector of float) 0:? 'FragColor' (out 4-component vector of float) 0:? 'out2' (out 2-component vector of float) @@ -152,4 +160,5 @@ 0:? 'out11' (out 4-component vector of float) 0:? 'out12' (out 2-component vector of int) 0:? 'out13' (out 3-component vector of uint) +0:? 's' (const structure) diff --git a/Test/baseResults/cppComplexExpr.vert.out b/Test/baseResults/cppComplexExpr.vert.out index f6410bfc35d5fe51a88f0542b0e0c4db247784dc..6069fc0c2a20a281fd50df11b360425adb439280 100644 --- a/Test/baseResults/cppComplexExpr.vert.out +++ b/Test/baseResults/cppComplexExpr.vert.out @@ -21,4 +21,5 @@ WARNING: #version: statement missing; use #version on first line of shader 0:39 Construct vec4 (highp 4-component vector of float) 0:39 'sum' (highp float) 0:? Linker Objects +0:? 'sum' (highp float) diff --git a/Test/baseResults/cppIndent.vert.out b/Test/baseResults/cppIndent.vert.out index 0f9f66a92ca9b9225b53d9966041a0f255ae51ee..2ef0dcd6e759ba43d937ad4a248b86684b706457 100644 --- a/Test/baseResults/cppIndent.vert.out +++ b/Test/baseResults/cppIndent.vert.out @@ -26,4 +26,5 @@ 0:56 Construct vec4 (4-component vector of float) 0:56 'sum' (float) 0:? Linker Objects +0:? 'sum' (float) diff --git a/Test/baseResults/cppNest.vert.out b/Test/baseResults/cppNest.vert.out index 4574806c76ad56f941ed5ccc572df4ed24523ad7..38894d82a1f164aa34a5a32514d3796d89672e81 100644 --- a/Test/baseResults/cppNest.vert.out +++ b/Test/baseResults/cppNest.vert.out @@ -29,4 +29,5 @@ 0:86 Construct vec4 (4-component vector of float) 0:86 'sum' (float) 0:? Linker Objects +0:? 'sum' (float) diff --git a/Test/baseResults/cppSimple.vert.out b/Test/baseResults/cppSimple.vert.out index b98f560e73f53acd866a52a4f45e2761b6c118c7..76415b23c4856a1765dabb72678a98a5ed8967e6 100644 --- a/Test/baseResults/cppSimple.vert.out +++ b/Test/baseResults/cppSimple.vert.out @@ -71,5 +71,10 @@ ERROR: node is still EOpNull! 0:130 'twoPi' (float) 0:130 6.280000 0:? Linker Objects +0:? 'sum' (float) +0:? 'linenumber' (int) +0:? 'filenumber' (int) +0:? 'version' (int) +0:? 'twoPi' (float) 0:? 'tod' (float) diff --git a/Test/baseResults/dce.frag.out b/Test/baseResults/dce.frag.out index 7975f99e59af97b2faccea56625d526f54f475a9..d2d7ac54bc180757962949bf005685c3338381c0 100644 --- a/Test/baseResults/dce.frag.out +++ b/Test/baseResults/dce.frag.out @@ -114,4 +114,6 @@ 0:55 Pre-Increment (int) 0:55 'c' (int) 0:? Linker Objects +0:? 'flag' (const bool) +0:? 'c' (int) diff --git a/Test/baseResults/decls.frag.out b/Test/baseResults/decls.frag.out new file mode 100644 index 0000000000000000000000000000000000000000..ad0ac0a83bf8f8788fa829cdb44a94b7b24631bf --- /dev/null +++ b/Test/baseResults/decls.frag.out @@ -0,0 +1,151 @@ +ERROR: 0:19: 'vi4' : illegal use of type 'void' +ERROR: 0:20: 'vj' : illegal use of type 'void' +ERROR: 0:20: 'vk5' : illegal use of type 'void' +ERROR: 0:21: 'vm2' : illegal use of type 'void' +ERROR: 0:21: 'vm3' : illegal use of type 'void' +ERROR: 0:22: 'vn8' : illegal use of type 'void' +ERROR: 0:22: 'vp' : illegal use of type 'void' +ERROR: 0:24: 'gl_' : reserved built-in name +ERROR: 0:25: 'gl_' : reserved built-in name +ERROR: 0:25: 'gl_' : reserved built-in name +ERROR: 0:26: 'gl_' : reserved built-in name +ERROR: 0:26: 'gl_' : reserved built-in name +ERROR: 0:27: 'gl_' : reserved built-in name +ERROR: 0:27: 'gl_' : reserved built-in name +ERROR: 0:32: '' : boolean expression expected +ERROR: 0:33: 'gl_' : reserved built-in name +ERROR: 16 compilation errors. No code generated. + +ERROR: node is still EOpNull! +0:5 Sequence +0:5 move second child to first child (int) +0:5 'd1' (int) +0:5 1 (const int) +0:6 Sequence +0:6 move second child to first child (int) +0:6 'e2' (int) +0:6 2 (const int) +0:7 Sequence +0:7 move second child to first child (int) +0:7 'h3' (int) +0:7 3 (const int) +0:14 Sequence +0:14 move second child to first child (4-element array of int) +0:14 'ii4' (4-element array of int) +0:14 1 (const int) +0:14 2 (const int) +0:14 3 (const int) +0:14 4 (const int) +0:15 Sequence +0:15 move second child to first child (5-element array of int) +0:15 'ik5' (5-element array of int) +0:15 5 (const int) +0:15 6 (const int) +0:15 7 (const int) +0:15 8 (const int) +0:15 9 (const int) +0:16 Sequence +0:16 move second child to first child (2-element array of int) +0:16 'im2' (2-element array of int) +0:16 10 (const int) +0:16 11 (const int) +0:16 move second child to first child (3-element array of int) +0:16 'im3' (3-element array of int) +0:16 12 (const int) +0:16 13 (const int) +0:16 14 (const int) +0:17 Sequence +0:17 move second child to first child (4-element array of int) +0:17 'in8' (4-element array of int) +0:17 21 (const int) +0:17 22 (const int) +0:17 23 (const int) +0:17 24 (const int) +0:24 Sequence +0:24 move second child to first child (4-element array of int) +0:24 'gl_vi4' (4-element array of int) +0:24 1 (const int) +0:24 2 (const int) +0:24 3 (const int) +0:24 4 (const int) +0:25 Sequence +0:25 move second child to first child (5-element array of int) +0:25 'gl_vk5' (5-element array of int) +0:25 5 (const int) +0:25 6 (const int) +0:25 7 (const int) +0:25 8 (const int) +0:25 9 (const int) +0:26 Sequence +0:26 move second child to first child (2-element array of int) +0:26 'gl_vm2' (2-element array of int) +0:26 10 (const int) +0:26 11 (const int) +0:26 move second child to first child (3-element array of int) +0:26 'gl_vm3' (3-element array of int) +0:26 12 (const int) +0:26 13 (const int) +0:26 14 (const int) +0:27 Sequence +0:27 move second child to first child (4-element array of int) +0:27 'gl_vn8' (4-element array of int) +0:27 21 (const int) +0:27 22 (const int) +0:27 23 (const int) +0:27 24 (const int) +0:29 Function Definition: main( (void) +0:29 Function Parameters: +0:31 Sequence +0:31 Loop with condition tested first +0:31 Loop Condition +0:31 move second child to first child (bool) +0:31 'cond' (bool) +0:31 Compare Less Than (bool) +0:31 'b' (int) +0:31 'c' (int) +0:31 No loop body +0:32 Loop with condition tested first +0:32 Loop Condition +0:32 move second child to first child (int) +0:32 'icond' (int) +0:32 'b' (int) +0:32 No loop body +0:33 Loop with condition tested first +0:33 Loop Condition +0:33 move second child to first child (bool) +0:33 'gl_cond' (bool) +0:33 Compare Less Than (bool) +0:33 'b' (int) +0:33 'c' (int) +0:33 No loop body +0:? Linker Objects +0:? 'a' (int) +0:? 'b' (int) +0:? 'c' (int) +0:? 'd1' (int) +0:? 'e2' (int) +0:? 'f' (int) +0:? 'g' (int) +0:? 'h3' (int) +0:? 'i4' (4-element array of int) +0:? 'j' (int) +0:? 'k5' (5-element array of int) +0:? 'm6' (6-element array of int) +0:? 'm7' (7-element array of int) +0:? 'n8' (8-element array of int) +0:? 'p' (int) +0:? 'ii4' (4-element array of int) +0:? 'ij' (int) +0:? 'ik5' (5-element array of int) +0:? 'im2' (2-element array of int) +0:? 'im3' (3-element array of int) +0:? 'in8' (4-element array of int) +0:? 'ip' (int) +0:? 'gl_vi4' (4-element array of int) +0:? 'gl_vj' (int) +0:? 'gl_vk5' (5-element array of int) +0:? 'gl_vm2' (2-element array of int) +0:? 'gl_vm3' (3-element array of int) +0:? 'gl_vn8' (4-element array of int) +0:? 'gl_vp' (int) + diff --git a/Test/baseResults/deepRvalue.frag.out b/Test/baseResults/deepRvalue.frag.out index c7c5a7d962f05a31e809a21a9fb87dee2d5ae24c..1cda2df152d07b0d5bb0b6fd4c30b8daab7ca329 100644 --- a/Test/baseResults/deepRvalue.frag.out +++ b/Test/baseResults/deepRvalue.frag.out @@ -115,4 +115,8 @@ 0:35 'i' (float) 0:? Linker Objects 0:? 'sampler' (uniform sampler2D) +0:? 'v1' (4-component vector of float) +0:? 'v2' (4-component vector of float) +0:? 'v3' (4-component vector of float) +0:? 'v4' (4-component vector of float) diff --git a/Test/baseResults/functionCall.frag.out b/Test/baseResults/functionCall.frag.out index a16244504cba052d81f77fac66e5656fb0091fbd..3327c4cf6d914d9791ef39529abb89d543078f43 100644 --- a/Test/baseResults/functionCall.frag.out +++ b/Test/baseResults/functionCall.frag.out @@ -76,4 +76,5 @@ WARNING: 0:4: varying deprecated in version 130; may be removed in future releas 0:? 'bigColor' (uniform 4-component vector of float) 0:? 'BaseColor' (smooth in 4-component vector of float) 0:? 'd' (uniform float) +0:? 'h' (float) diff --git a/Test/baseResults/length.frag.out b/Test/baseResults/length.frag.out index 5deccaafa04a434ca1c1cbafdfa0b7fde6589110..4a354ae77c2618b7fc19e05c2ddd805b3222b79c 100644 --- a/Test/baseResults/length.frag.out +++ b/Test/baseResults/length.frag.out @@ -19,4 +19,6 @@ 0:17 30.000000 0:17 30.000000 0:? Linker Objects +0:? 'u' (uniform 3-element array of 4-component vector of float) +0:? 'v' (smooth in 2-element array of 2-component vector of float) diff --git a/Test/baseResults/link1.frag.out b/Test/baseResults/link1.frag.out index 5119acfc0c2f150ae35439d512aef3f8f83bd29e..47cfec21bb80afed41f57b90a4ecf47eddef80f1 100644 --- a/Test/baseResults/link1.frag.out +++ b/Test/baseResults/link1.frag.out @@ -33,8 +33,12 @@ link1.frag 0:? Linker Objects 0:? 'uv4' (uniform 4-component vector of float) 0:? 'glass' (uniform 3-component vector of float) +0:? 'ci' (const int) +0:? 'a' (4-component vector of float) 0:? 'iv3' (smooth in 3-component vector of float) 0:? 'cup' (smooth in 4-component vector of float) +0:? 'b' (4-component vector of float) +0:? 'c' (4-component vector of float) link2.frag @@ -66,8 +70,12 @@ link2.frag 0:? Linker Objects 0:? 'uv4' (uniform 4-component vector of float) 0:? 'glass' (uniform 2-component vector of float) +0:? 'ci' (const int) +0:? 'd' (4-component vector of float) 0:? 'iv3' (smooth in 3-component vector of float) 0:? 'cup' (flat in 4-component vector of float) +0:? 'e' (4-component vector of float) +0:? 'f' (4-component vector of float) link3.frag @@ -145,6 +153,13 @@ ERROR: Linking fragment stage: Precision qualifiers must match: 0:? Linker Objects 0:? 'uv4' (uniform 4-component vector of float) 0:? 'glass' (uniform 3-component vector of float) +0:? 'ci' (const int) +0:? 'a' (4-component vector of float) 0:? 'iv3' (smooth in 3-component vector of float) 0:? 'cup' (smooth in 4-component vector of float) +0:? 'b' (4-component vector of float) +0:? 'c' (4-component vector of float) +0:? 'd' (4-component vector of float) +0:? 'e' (4-component vector of float) +0:? 'f' (4-component vector of float) diff --git a/Test/baseResults/matrixError.vert.out b/Test/baseResults/matrixError.vert.out index 574ede5152ecaa723aca56abea06cde55e2de7e7..0f014cf893d40883b34456967e599178a8e2a3d6 100644 --- a/Test/baseResults/matrixError.vert.out +++ b/Test/baseResults/matrixError.vert.out @@ -30,4 +30,5 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'v3' (in 3-component vector of float) 0:? 'm32' (uniform 3X2 matrix of float) +0:? 'm24' (2X4 matrix of float) diff --git a/Test/baseResults/nonSquare.vert.out b/Test/baseResults/nonSquare.vert.out index 5ee5ea173690837b966a3b2ff7edc4e3e47435b7..631fa591c0a07790159767635fe75e951f7ed56f 100644 --- a/Test/baseResults/nonSquare.vert.out +++ b/Test/baseResults/nonSquare.vert.out @@ -59,4 +59,7 @@ 0:? 'v3' (in 3-component vector of float) 0:? 'v4' (in 4-component vector of float) 0:? 'm32' (uniform 3X2 matrix of float) +0:? 'cv2' (const 2-component vector of float) +0:? 'm24' (const 2X4 matrix of float) +0:? 'm42' (const 4X2 matrix of float) diff --git a/Test/baseResults/precision.frag.out b/Test/baseResults/precision.frag.out index 93f1cbabffb626f45245a8b012d5ed01fbb85fbe..38d1a20039e9260f641d6c87777aa49bcf636822 100644 --- a/Test/baseResults/precision.frag.out +++ b/Test/baseResults/precision.frag.out @@ -109,4 +109,5 @@ ERROR: node is still EOpNull! 0:? 'samplerHigh' (uniform highp sampler2D) 0:? 'uint' (mediump 4-component vector of float) 0:? 'global_high' (highp int) +0:? 'b2' (mediump 2-component vector of bool) diff --git a/Test/baseResults/specExamples.frag.out b/Test/baseResults/specExamples.frag.out index 9bba53098a81d3b6c1828666211a880494175a3e..c776306bdc2f3b36ea7845a2c3708f56b66e9695 100644 --- a/Test/baseResults/specExamples.frag.out +++ b/Test/baseResults/specExamples.frag.out @@ -3,7 +3,6 @@ ERROR: 0:20: '' : numeric literal too big ERROR: 0:21: '' : hexidecimal literal too big ERROR: 0:37: 'view' : redefinition ERROR: 0:68: 'lightPosition' : redefinition -ERROR: 0:69: 'uniform' : cannot initialize this type of qualifier ERROR: 0:71: 'Material' : only uniform interface blocks are supported ERROR: 0:79: 'Light' : only uniform interface blocks are supported ERROR: 0:83: 'ColoredTexture' : only uniform interface blocks are supported @@ -54,7 +53,7 @@ ERROR: 0:226: 'in' : only allowed at global scope ERROR: 0:227: 'in' : only allowed at global scope ERROR: 0:228: 'in' : only allowed at global scope ERROR: 0:232: 'out' : only allowed at global scope -ERROR: 56 compilation errors. No code generated. +ERROR: 55 compilation errors. No code generated. ERROR: node is still EOpNull! 0:5 Sequence @@ -109,6 +108,12 @@ ERROR: node is still EOpNull! 0:26 move second child to first child (double) 0:26 'fd' (double) 0:26 2.000000 +0:69 Sequence +0:69 move second child to first child (3-component vector of float) +0:69 'color' (uniform 3-component vector of float) +0:69 0.700000 +0:69 0.700000 +0:69 0.200000 0:127 Function Definition: foo(f1[5]; (5-element array of float) 0:127 Function Parameters: 0:127 '' (in 5-element array of float) @@ -196,8 +201,22 @@ ERROR: node is still EOpNull! 0:218 'c' (5-element array of float) 0:218 'a' (5-element array of float) 0:? Linker Objects +0:? 'a' (int) +0:? 'b' (int) +0:? 'c' (uint) +0:? 'd' (uint) +0:? 'e' (int) +0:? 'f' (uint) +0:? 'g' (int) +0:? 'h' (int) +0:? 'i' (int) +0:? 'j' (int) +0:? 'k' (int) +0:? 'l' (int) 0:? 'fa' (float) +0:? 'fb' (float) 0:? 'fc' (double) +0:? 'fd' (double) 0:? 'texcoord1' (2-component vector of float) 0:? 'texcoord2' (2-component vector of float) 0:? 'position' (3-component vector of float) @@ -212,14 +231,20 @@ ERROR: node is still EOpNull! 0:? 'highPrecisionMVP' (4X4 matrix of double) 0:? 'dm' (2X4 matrix of double) 0:? 'lightVar' (structure) +0:? 'frequencies' (3-element array of float) +0:? 'lightPosition' (uniform 4-element array of 4-component vector of float) +0:? 'lights' (2-element array of structure) +0:? 'numLights' (const int) 0:? 'normal' (smooth in 3-component vector of float) 0:? 'TexCoord' (centroid smooth in 2-component vector of float) 0:? 'Color' (invariant centroid smooth in 4-component vector of float) 0:? 'temperature' (noperspective in float) 0:? 'myColor' (flat in 3-component vector of float) 0:? 'myTexCoord' (centroid noperspective in 2-component vector of float) +0:? 'color' (uniform 3-component vector of float) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float) 0:? 'factor' (layout(location=3 ) out 4-component vector of float) +0:? 'colors' (layout(location=2 ) out 3-element array of 4-component vector of float) 0:? 'gl_FragDepth' (gl_FragDepth float) 0:? 'gl_Color' (smooth in 4-component vector of float) diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index f8b3a34ccf087d9e12f70429a51aeed28d5bbf7c..3b9733a194253a725775b85f16c89d1579f2e969 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -222,6 +222,8 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'transforms' (layout(shared ) uniform 4-element array of block) 0:? 'normal' (layout(location=3 ) in 4-component vector of float) +0:? 'colors' (layout(location=6 ) in 3-element array of 4-component vector of float) +0:? 's' (layout(location=3 ) structure) 0:? 'var1' (smooth out 4-component vector of float) 0:? 'var5' (smooth out 4-component vector of float) 0:? 'var7' (smooth out 4-component vector of float) @@ -244,6 +246,7 @@ ERROR: node is still EOpNull! 0:? 'd' (in 4-component vector of float) 0:? 'v' (smooth out 4-component vector of float) 0:? '__anon__2' (layout(shared ) uniform block) +0:? 'shv' (shared 4-component vector of float) 0:? 'img1' (uniform image2D) 0:? 'img2' (coherent uniform image2D) 0:? 'gl_VertexID' (gl_VertexId int) diff --git a/Test/baseResults/structure.frag.out b/Test/baseResults/structure.frag.out index a974662136d5cbfe20b907ed55a40839346c6bbc..9d0359475c1a54bcdc44b4f0d3d30973bb8f5aa8 100644 --- a/Test/baseResults/structure.frag.out +++ b/Test/baseResults/structure.frag.out @@ -59,4 +59,5 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas 0:? 'sampler' (uniform sampler2D) 0:? 'coord' (smooth in 2-component vector of float) 0:? 'foo' (uniform structure) +0:? 'foo2' (uniform 5-element array of structure) diff --git a/Test/baseResults/tokenLength.vert.out b/Test/baseResults/tokenLength.vert.out index 613a81c9c66f7584bffd02b7a07d6316ae902829..f371596df57df91332878d79815ff0ec901f21e5 100644 --- a/Test/baseResults/tokenLength.vert.out +++ b/Test/baseResults/tokenLength.vert.out @@ -77,7 +77,19 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'BCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789' (in highp float) 0:? 'ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789' (in highp float) +0:? 'E1' (highp int) +0:? 'E2' (highp int) +0:? 'B' (highp int) +0:? 'OE' (highp int) +0:? 'HE' (highp int) +0:? 'F' (highp float) +0:? 'G' (highp float) +0:? 'E3' (highp float) 0:? 'BCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789B' (highp float) +0:? 'superH' (highp int) +0:? 'superO' (highp int) +0:? 'superI' (highp int) +0:? 'superF' (highp float) 0:? 'gl_VertexID' (gl_VertexId highp int) 0:? 'gl_InstanceID' (gl_InstanceId highp int) diff --git a/Test/baseResults/uniformArray.frag.out b/Test/baseResults/uniformArray.frag.out index f734c29a5415c4aed4021f97363a7ffb6e68cdc7..f67d80dfd740b7c3db5a0587efcb4de815bfb1d5 100644 --- a/Test/baseResults/uniformArray.frag.out +++ b/Test/baseResults/uniformArray.frag.out @@ -33,4 +33,6 @@ 0:? Linker Objects 0:? 'texSampler2D' (uniform sampler2D) 0:? 'inColor' (uniform 3-component vector of float) +0:? 'color' (uniform 6-element array of 4-component vector of float) +0:? 'alpha' (uniform 16-element array of float) diff --git a/Test/baseResults/variableArrayIndex.frag.out b/Test/baseResults/variableArrayIndex.frag.out index aa20e6ad164b1699f0945bfb2e30d437fc61c886..a217c280d83de8902fd21fc556b96e16ecfd1c04 100644 --- a/Test/baseResults/variableArrayIndex.frag.out +++ b/Test/baseResults/variableArrayIndex.frag.out @@ -86,6 +86,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas 0:? 'sampler' (uniform sampler2D) 0:? 'coord' (smooth in 2-component vector of float) 0:? 'foo' (uniform structure) +0:? 'foo2' (uniform 5-element array of structure) 0:? 'foo3' (uniform structure) 0:? 'Count' (uniform int) diff --git a/Test/baseResults/varyingArray.frag.out b/Test/baseResults/varyingArray.frag.out index 2e0245b5ca0816da2e7d957ca2eebcaac38ae98e..57048da67e27b6dce0fbcb5652b48338fad305e8 100644 --- a/Test/baseResults/varyingArray.frag.out +++ b/Test/baseResults/varyingArray.frag.out @@ -46,4 +46,6 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas 0:? 'texSampler2D' (uniform sampler2D) 0:? 'color' (smooth in 4-component vector of float) 0:? 'alpha' (smooth in float) +0:? 'gl_TexCoord' (smooth in 6-element array of 4-component vector of float) +0:? 'foo' (smooth in 3-element array of 4-component vector of float) diff --git a/Test/baseResults/varyingArrayIndirect.frag.out b/Test/baseResults/varyingArrayIndirect.frag.out index 5db8488cda5d4a790de3467790fa33e2f50e0f46..8e60670dfc27a391a7fc767edc8c25ae095c489d 100644 --- a/Test/baseResults/varyingArrayIndirect.frag.out +++ b/Test/baseResults/varyingArrayIndirect.frag.out @@ -50,6 +50,8 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas 0:? 'texSampler2D' (uniform sampler2D) 0:? 'color' (smooth in 4-component vector of float) 0:? 'alpha' (smooth in float) +0:? 'gl_TexCoord' (smooth in 6-element array of 4-component vector of float) +0:? 'userIn' (smooth in 2-element array of 4-component vector of float) 0:? 'a' (uniform int) 0:? 'b' (uniform int) diff --git a/Test/baseResults/voidFunction.frag.out b/Test/baseResults/voidFunction.frag.out index 4070c71f22e10e4153a6ff2eaa1c4efb7e4f5cb2..3f8254a443bed08eec9e555dcb1c7ce2c25cb713 100644 --- a/Test/baseResults/voidFunction.frag.out +++ b/Test/baseResults/voidFunction.frag.out @@ -36,4 +36,5 @@ 0:? 'bigColor' (uniform 4-component vector of float) 0:? 'BaseColor' (smooth in 4-component vector of float) 0:? 'd' (uniform float) +0:? 'bar' (float) diff --git a/Test/decls.frag b/Test/decls.frag new file mode 100644 index 0000000000000000000000000000000000000000..e76d385724238099b1e72e4c6b115a33a9755db1 --- /dev/null +++ b/Test/decls.frag @@ -0,0 +1,34 @@ +#version 120 + +int a; +int b, c; +int d1 = 1; +int e2 = 2, f; +int g, h3 = 3; + +int i4[4]; +int j, k5[5]; +int m6[6], m7[7]; +int n8[8], p; + +int ii4[4] = int[](1, 2, 3, 4); +int ij, ik5[5] = int[](5, 6, 7, 8, 9); +int im2[2] = int[](10, 11), im3[3] = int[](12, 13, 14); +int in8[4] = int[](21, 22, 23, 24), ip; + +void vi4[4] = int[](1, 2, 3, 4); +void vj, vk5[5] = int[](5, 6, 7, 8, 9); +void vm2[2] = int[](10, 11), vm3[3] = int[](12, 13, 14); +void vn8[4] = int[](21, 22, 23, 24), vp; + +int gl_vi4[4] = int[](1, 2, 3, 4); +int gl_vj, gl_vk5[5] = int[](5, 6, 7, 8, 9); +int gl_vm2[2] = int[](10, 11), gl_vm3[3] = int[](12, 13, 14); +int gl_vn8[4] = int[](21, 22, 23, 24), gl_vp; + +void main() +{ + while (bool cond = b < c); + while (int icond = b); + while (bool gl_cond = b < c); +} diff --git a/Test/testlist b/Test/testlist index ef82695117e76df9b5ad49d68baf75ab1432d10c..24fd1e594f0796fe4b9b5f1eb4ad88467c039068 100644 --- a/Test/testlist +++ b/Test/testlist @@ -1,5 +1,6 @@ sample.frag sample.vert +decls.frag specExamples.frag specExamples.vert versionsClean.frag diff --git a/Todo.txt b/Todo.txt index 84784b27f7d95d3c69a22b026b37ff2c0ab9f0de..3fbabccec25f64f4c2eef1c39d13e5c54fac652a 100644 --- a/Todo.txt +++ b/Todo.txt @@ -4,6 +4,7 @@ Link Validation + provide input config file for setting limits - also consider spitting out measures of complexity + ensure no static references thrown away + - generate static use of object even if the only use is to access the length of its array Cross-stage linking - type consistency check of uniform and ins <-> outs, both variables and blocks, stage-specific arrayness matching - location/binding/index check @@ -20,7 +21,6 @@ Link Validation Intra-stage linking + exactly one main + type consistency check of uniforms, globals, ins, and outs - - still need to cover arrays and the combinations of this rule with redeclarations of built-ins - value checking of global const initializers - value checking of uniform initializers + location match diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index feee5b94a6fe96ee66c0222f78673b324e3903e9..c33e41bf50876118573f38e1d392f195d7e63f0d 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -588,6 +588,7 @@ public: arraySizes = NewPoolTArraySizes(); *arraySizes = *s; } + void setArraySizes(const TType& type) { setArraySizes(type.arraySizes); } void changeArraySize(int s) { arraySizes->sizes.front() = s; } void setMaxArraySize (int s) { arraySizes->maxArraySize = s; } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 20212c94bd4ceca13339c5f0ca1815399542f4bc..ebf6d142ec1ca45f3ed73d25256014bf3d262079 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -644,7 +644,8 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc loc) { TIntermAggregate* aggNode = growAggregate(left, right); - aggNode->setLoc(loc); + if (aggNode) + aggNode->setLoc(loc); return aggNode; } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index d41a31d450af3d97d469b9352ae6ac26ad574df5..c364c061bde28746371f79fa66653d77423a4439 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1325,13 +1325,13 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio return false; } -// This function checks to see if a void variable has been declared and raise an error message for such a case +// Checks to see if a void variable has been declared and raise an error message for such a case // // returns true in case of an error // -bool TParseContext::voidErrorCheck(TSourceLoc loc, const TString& identifier, const TPublicType& pubType) +bool TParseContext::voidErrorCheck(TSourceLoc loc, const TString& identifier, const TBasicType basicType) { - if (pubType.basicType == EbtVoid) { + if (basicType == EbtVoid) { error(loc, "illegal use of type 'void'", identifier.c_str(), ""); return true; } @@ -1646,12 +1646,12 @@ void TParseContext::arraySizeCheck(TSourceLoc loc, TIntermTyped* expr, int& size // // Returns true if there is an error. // -bool TParseContext::arrayQualifierError(TSourceLoc loc, const TPublicType& type) +bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualifier) { - if (type.qualifier.storage == EvqConst) + if (qualifier.storage == EvqConst) profileRequires(loc, ENoProfile, 120, "GL_3DL_array_objects", "const array"); - if (type.qualifier.storage == EvqVaryingIn && language == EShLangVertex) { + if (qualifier.storage == EvqVaryingIn && language == EShLangVertex) { requireProfile(loc, (EProfileMask)~EEsProfileMask, "vertex input arrays"); profileRequires(loc, ENoProfile, 150, 0, "vertex input arrays"); } @@ -1698,7 +1698,7 @@ void TParseContext::arrayDimCheck(TSourceLoc loc, const TType* type, TArraySizes // // size == 0 means no specified size. // -void TParseContext::arrayCheck(TSourceLoc loc, TString& identifier, const TPublicType& type, TVariable*& variable) +void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TType& type, TVariable*& variable, bool& newDeclaration) { // // Don't check for reserved word use until after we know it's not in the symbol table, @@ -1710,46 +1710,39 @@ void TParseContext::arrayCheck(TSourceLoc loc, TString& identifier, const TPubli // Redeclarations have to take place at the same scope; otherwise they are hiding declarations // - bool currentScope; - TSymbol* symbol = symbolTable.find(identifier, 0, ¤tScope); - if (symbol == 0 || ! currentScope) { - if (reservedErrorCheck(loc, identifier)) - return; - - variable = new TVariable(&identifier, TType(type)); - symbolTable.insert(*variable); - } else { - variable = symbol->getAsVariable(); - - if (! variable) { - error(loc, "array variable name expected", identifier.c_str(), ""); - return; - } + if (! variable) { + bool currentScope; + TSymbol* symbol = symbolTable.find(identifier, 0, ¤tScope); + if (symbol == 0 || ! currentScope) { + variable = new TVariable(&identifier, type); + symbolTable.insert(*variable); + newDeclaration = true; - if (! variable->getType().isArray()) { - error(loc, "redeclaring non-array as array", identifier.c_str(), ""); - return; - } - if (variable->getType().getArraySize() > 0) { - error(loc, "redeclaration of array with size", identifier.c_str(), ""); - return; - } - - if (! variable->getType().sameElementType(TType(type))) { - error(loc, "redeclaration of array with a different type", identifier.c_str(), ""); return; } + variable = symbol->getAsVariable(); + } - // For read-only built-ins, add a new variable for holding the declared array size of an implicitly-sized shared array. - if (variable->isReadOnly()) - variable = symbolTable.copyUp(variable); + if (! variable) { + error(loc, "array variable name expected", identifier.c_str(), ""); + return; + } - // TODO: desktop unsized arrays: include modified built-in arrays (gl_TexCoord) in the linker objects subtree + if (! variable->getType().isArray()) { + error(loc, "redeclaring non-array as array", identifier.c_str(), ""); + return; + } + if (variable->getType().getArraySize() > 0) { + error(loc, "redeclaration of array with size", identifier.c_str(), ""); + return; + } - variable->getWritableType().setArraySizes(type.arraySizes); - } - - voidErrorCheck(loc, identifier, type); + if (! variable->getType().sameElementType(type)) { + error(loc, "redeclaration of array with a different type", identifier.c_str(), ""); + return; + } + + variable->getWritableType().setArraySizes(type); } bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int size) @@ -1793,55 +1786,31 @@ bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int siz // // Enforce non-initializer type/qualifier rules. // -void TParseContext::nonInitConstCheck(TSourceLoc loc, TString& identifier, TPublicType& type) +void TParseContext::nonInitConstCheck(TSourceLoc loc, TString& identifier, TType& type) { // // Make the qualifier make sense. // - if (type.qualifier.storage == EvqConst) { - type.qualifier.storage = EvqTemporary; + if (type.getQualifier().storage == EvqConst) { + type.getQualifier().storage = EvqTemporary; error(loc, "variables with qualifier 'const' must be initialized", identifier.c_str(), ""); } } // -// Do semantic checking for a variable declaration that has no initializer, -// and update the symbol table. +// See if the identifier is a built-in symbol that can be redeclared, and if so, +// copy the symbol table's read-only built-in variable to the current +// global level, where it can be modified based on the passed in type. // -void TParseContext::nonInitCheck(TSourceLoc loc, TString& identifier, TPublicType& publicType) -{ - TType type(publicType); - - bool newDeclaration; // true if a new entry gets added to the symbol table - TVariable* variable = redeclare(loc, identifier, type, newDeclaration); - - if (! variable) { - reservedErrorCheck(loc, identifier); - variable = new TVariable(&identifier, type); - if (! symbolTable.insert(*variable)) - error(loc, "redefinition", variable->getName().c_str(), ""); - else - newDeclaration = true; - } - - if (newDeclaration) { - voidErrorCheck(loc, identifier, publicType); - - // see if it's a linker-level object to track - if (type.getQualifier().isUniform() || type.getQualifier().isPipeInput() || type.getQualifier().isPipeOutput() || type.getQualifier().storage == EvqGlobal) - intermediate.addSymbolLinkageNode(linkage, *variable); - } -} - +// Returns 0 if no redeclaration took place; meaning a normal declaration still +// needs to occur for it, not necessarily an error. +// +// Returns a redeclared and type-modified variable if a redeclarated occurred. // -// See if the identifier is a built-in symbol that can be redeclared, -// and if so, copy of the symbol table's read-only built-in to the current -// global level, so it can be modified. +// Will emit // -TVariable* TParseContext::redeclare(TSourceLoc loc, const TString& identifier, const TType& type, bool& newDeclaration) +TVariable* TParseContext::redeclareBuiltin(TSourceLoc loc, const TString& identifier, const TType& type, bool& newDeclaration) { - newDeclaration = false; // true if a new entry gets added to the symbol table - if (profile == EEsProfile || identifier.substr(0, 3) != TString("gl_") || symbolTable.atBuiltInLevel()) return 0; @@ -1864,24 +1833,28 @@ TVariable* TParseContext::redeclare(TSourceLoc loc, const TString& identifier, c bool builtIn; TSymbol* symbol = symbolTable.find(identifier, &builtIn); - // If the symbol was not found, this must be a version/profile/stage + // If the symbol was not found, this must be a version/profile/stage // that doesn't have it. if (! symbol) return 0; TVariable* variable = symbol->getAsVariable(); - // If it wasn't at a built-in level, then it's already been redeclared - if (! builtIn) - return variable; + // If it wasn't at a built-in level, then it's already been redeclared; + // that is, this is a redeclaration of a redeclaration, reuse that initial + // redeclaration. Otherwise, make the new one. + if (builtIn) { + // Copy the symbol up to make a writable version + newDeclaration = true; + variable = symbolTable.copyUp(variable); + } - // Otherwise, time to copy the symbol up to make a writable version - newDeclaration = true; - variable = symbolTable.copyUp(variable); + // Now, modify the type of the copy, as per the type of the current redeclaration. + // TODO: functionality: verify type change is allowed and make the change in type + return variable; } - error(loc, "cannot redeclare this built-in variable", identifier.c_str(), ""); return 0; } @@ -2013,44 +1986,102 @@ const TFunction* TParseContext::findFunction(TSourceLoc loc, TFunction* call, bo } // -// Handle all types of initializers from the grammar. +// Do everything necessary to handle a variable (non-block) declaration. +// Either redeclaring a variable, or making a new one, updating the symbol +// table, and all error checking. +// +// Returns a subtree node that computes an initializer, if needed. +// Returns 0 if there is no code to execute for initialization. // -bool TParseContext::executeInitializerError(TSourceLoc loc, TString& identifier, TPublicType& pType, - TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable) +TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier, TPublicType& publicType, TArraySizes* arraySizes, TIntermTyped* initializer) { - TType type(pType); + TType type(publicType); - if (variable == 0) { - if (reservedErrorCheck(loc, identifier)) - return true; + if (voidErrorCheck(loc, identifier, type.getBasicType())) + return 0; - if (voidErrorCheck(loc, identifier, pType)) - return true; + if (! initializer) + nonInitConstCheck(loc, identifier, type); - // - // add variable to symbol table - // - variable = new TVariable(&identifier, type); - if (! symbolTable.insert(*variable)) { - error(loc, "redefinition", variable->getName().c_str(), ""); - return true; - // don't delete variable, it's used by error recovery, and the pool - // pop will take care of the memory + // Check for redeclaration of built-ins and/or attempting to declare a reserved name + bool newDeclaration = false; // true if a new entry gets added to the symbol table + TVariable* variable = redeclareBuiltin(loc, identifier, type, newDeclaration); + if (! variable) + reservedErrorCheck(loc, identifier); + + // Declare the variable + if (arraySizes) { + // for ES, since size isn't coming from an initializer, it has to be explicitly declared now + if (profile == EEsProfile && ! initializer) + arraySizeRequiredCheck(loc, arraySizes->getSize()); + + arrayDimCheck(loc, &type, arraySizes); + if (! arrayQualifierError(loc, type.getQualifier())) { + type.setArraySizes(arraySizes); + declareArray(loc, identifier, type, variable, newDeclaration); } + + if (initializer) + profileRequires(loc, ENoProfile, 120, "GL_3DL_array_objects", "initializer"); + } else { + // non-array case + if (! variable) + variable = declareNonArray(loc, identifier, type, newDeclaration); } + // Deal with initializer + TIntermNode* initNode = 0; + if (variable && initializer) + initNode = executeInitializer(loc, identifier, type, initializer, variable); + + // see if it's a linker-level object to track + if (newDeclaration && symbolTable.atGlobalLevel()) + intermediate.addSymbolLinkageNode(linkage, *variable); + + return initNode; +} + +// +// Declare a non-array variable, the main point being there is no redeclaration +// for resizing allowed. +// +// Return the successfully declared variable. +// +TVariable* TParseContext::declareNonArray(TSourceLoc loc, TString& identifier, TType& type, bool& newDeclaration) +{ + // make a new variable + TVariable* variable = new TVariable(&identifier, type); + + // add variable to symbol table + if (! symbolTable.insert(*variable)) { + error(loc, "redefinition", variable->getName().c_str(), ""); + return 0; + } else { + newDeclaration = true; + return variable; + } +} + +// +// Handle all types of initializers from the grammar. +// +TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifier, TType& type, + TIntermTyped* initializer, TVariable* variable) +{ // - // identifier must be of type constant, a global, or a temporary + // Identifier must be of type constant, a global, or a temporary, and + // starting at version 120, desktop allows uniforms to have initializers. // TStorageQualifier qualifier = variable->getType().getQualifier().storage; - if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConst)) { + if (! (qualifier == EvqTemporary || qualifier == EvqGlobal || qualifier == EvqConst || + qualifier == EvqUniform && profile != EEsProfile && version >= 120)) { error(loc, " cannot initialize this type of qualifier ", variable->getType().getStorageQualifierString(), ""); - return true; + return 0; } // Fix arrayness if variable is unsized, getting size for initializer if (initializer->getType().isArray() && initializer->getType().getArraySize() > 0 && - type.isArray() && type.getArraySize() == 0) + type.isArray() && type.getArraySize() == 0) type.changeArraySize(initializer->getType().getArraySize()); // @@ -2060,13 +2091,13 @@ bool TParseContext::executeInitializerError(TSourceLoc loc, TString& identifier, if (qualifier != initializer->getType().getQualifier().storage) { error(loc, " assigning non-constant to", "=", "'%s'", variable->getType().getCompleteString().c_str()); variable->getWritableType().getQualifier().storage = EvqTemporary; - return true; + return 0; } if (type != initializer->getType()) { error(loc, " non-matching types for const initializer ", variable->getType().getStorageQualifierString(), ""); variable->getWritableType().getQualifier().storage = EvqTemporary; - return true; + return 0; } if (initializer->getAsConstantUnion()) { TConstUnion* unionArray = variable->getConstUnionPointer(); @@ -2083,26 +2114,25 @@ bool TParseContext::executeInitializerError(TSourceLoc loc, TString& identifier, variable->shareConstPointer(constArray); } else { error(loc, "expected variable", initializer->getAsSymbolNode()->getName().c_str(), ""); - return true; + return 0; } } else { error(loc, " cannot assign to", "=", "'%s'", variable->getType().getCompleteString().c_str()); variable->getWritableType().getQualifier().storage = EvqTemporary; - return true; + return 0; } } if (qualifier != EvqConst) { TIntermSymbol* intermSymbol = intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), loc); - intermNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); - if (intermNode == 0) { + TIntermNode* initNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); + if (! initNode) assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString()); - return true; - } - } else - intermNode = 0; - return false; + return initNode; + } + + return 0; } // This function is used to test for the correctness of the parameters passed to various constructor functions diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 2737553ca43bb78497319790e63b875c69ba9dd7..f40cd784e1a73275a9240af035b746f6480735ea 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -100,13 +100,12 @@ public: void globalCheck(TSourceLoc, bool global, const char* token); bool constructorError(TSourceLoc, TIntermNode*, TFunction&, TOperator, TType&); void arraySizeCheck(TSourceLoc, TIntermTyped* expr, int& size); - bool arrayQualifierError(TSourceLoc, const TPublicType&); + bool arrayQualifierError(TSourceLoc, const TQualifier&); void arraySizeRequiredCheck(TSourceLoc, int size); void arrayDimError(TSourceLoc); void arrayDimCheck(TSourceLoc, TArraySizes* sizes1, TArraySizes* sizes2); void arrayDimCheck(TSourceLoc, const TType*, TArraySizes*); - void arrayCheck(TSourceLoc, TString& identifier, const TPublicType&, TVariable*& variable); - bool voidErrorCheck(TSourceLoc, const TString&, const TPublicType&); + bool voidErrorCheck(TSourceLoc, const TString&, TBasicType); void boolCheck(TSourceLoc, const TIntermTyped*); void boolCheck(TSourceLoc, const TPublicType&); bool samplerErrorCheck(TSourceLoc, const TPublicType& pType, const char* reason); @@ -119,9 +118,7 @@ public: void precisionQualifierCheck(TSourceLoc, TPublicType&); void parameterSamplerCheck(TSourceLoc, TStorageQualifier qualifier, const TType& type); bool containsSampler(const TType& type); - void nonInitConstCheck(TSourceLoc, TString& identifier, TPublicType& type); - void nonInitCheck(TSourceLoc, TString& identifier, TPublicType& type); - TVariable* redeclare(TSourceLoc, const TString&, const TType&, bool& newDeclaration); + TVariable* redeclareBuiltin(TSourceLoc, const TString&, const TType&, bool& newDeclaration); void paramCheck(TSourceLoc, TStorageQualifier qualifier, TType* type); void nestedBlockCheck(TSourceLoc); void nestedStructCheck(TSourceLoc); @@ -131,8 +128,7 @@ public: void mergeLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src); const TFunction* findFunction(TSourceLoc, TFunction* pfnCall, bool *builtIn = 0); - bool executeInitializerError(TSourceLoc, TString& identifier, TPublicType& pType, - TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0); + TIntermNode* declareVariable(TSourceLoc, TString& identifier, TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); TIntermTyped* addConstructor(TIntermNode*, const TType&, TOperator, TFunction*, TSourceLoc); TIntermTyped* constructStruct(TIntermNode*, const TType&, int, TSourceLoc); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermNode*, TSourceLoc, bool subset); @@ -170,6 +166,11 @@ public: protected: const char* getPreamble(); TBehavior getExtensionBehavior(const char* behavior); + void nonInitConstCheck(TSourceLoc, TString& identifier, TType& type); + TVariable* TParseContext::declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration); + void declareArray(TSourceLoc, TString& identifier, const TType&, TVariable*&, bool& newDeclaration); + TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TType&, TIntermTyped* initializer, TVariable* variable); + public: // diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 73688db1ad4b06dd768b2d21408b7f87d4b75171..614bf419304b3466eec46ac21fbf0047ecdf8db4 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -972,61 +972,21 @@ init_declarator_list } | init_declarator_list COMMA IDENTIFIER { $$ = $1; - parseContext.nonInitConstCheck($3.loc, *$3.string, $$.type); - parseContext.nonInitCheck($3.loc, *$3.string, $$.type); + parseContext.declareVariable($3.loc, *$3.string, $1.type); } | init_declarator_list COMMA IDENTIFIER array_specifier { - parseContext.nonInitConstCheck($3.loc, *$3.string, $1.type); - if (parseContext.profile == EEsProfile) - parseContext.arraySizeRequiredCheck($4.loc, $4.arraySizes->getSize()); - parseContext.arrayDimCheck($3.loc, $1.type.arraySizes, $4.arraySizes); - $$ = $1; - - if (! parseContext.arrayQualifierError($4.loc, $1.type)) { - $1.type.arraySizes = $4.arraySizes; - TVariable* variable; - parseContext.arrayCheck($4.loc, *$3.string, $1.type, variable); - } + parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); } | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer { - $$ = $1; - - TVariable* variable = 0; - if (! parseContext.arrayQualifierError($4.loc, $1.type)) { - $1.type.arraySizes = $4.arraySizes; - parseContext.arrayCheck($4.loc, *$3.string, $1.type, variable); - } - parseContext.arrayDimCheck($3.loc, $1.type.arraySizes, $4.arraySizes); - - parseContext.profileRequires($5.loc, ENoProfile, 120, "GL_3DL_array_objects", "initializer"); - - TIntermNode* intermNode; - if (! parseContext.executeInitializerError($3.loc, *$3.string, $1.type, $6, intermNode, variable)) { - // - // build the intermediate representation - // - if (intermNode) - $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermNode, intermNode, $5.loc); - else - $$.intermAggregate = $1.intermAggregate; - } else - $$.intermAggregate = 0; + $$.type = $1.type; + TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); + $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermAggregate, initNode, $5.loc); } | init_declarator_list COMMA IDENTIFIER EQUAL initializer { - $$ = $1; - - TIntermNode* intermNode; - if (!parseContext.executeInitializerError($3.loc, *$3.string, $1.type, $5, intermNode)) { - // - // build the intermediate representation - // - if (intermNode) - $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermNode, intermNode, $4.loc); - else - $$.intermAggregate = $1.intermAggregate; - } else - $$.intermAggregate = 0; + $$.type = $1.type; + TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); + $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermAggregate, initNode, $4.loc); } ; @@ -1037,70 +997,26 @@ single_declaration parseContext.updateTypedDefaults($1.loc, $$.type.qualifier, 0); } | fully_specified_type IDENTIFIER { - $$.intermAggregate = 0; $$.type = $1; - - parseContext.nonInitConstCheck($2.loc, *$2.string, $$.type); - parseContext.nonInitCheck($2.loc, *$2.string, $$.type); - + $$.intermAggregate = 0; + parseContext.declareVariable($2.loc, *$2.string, $1); parseContext.updateTypedDefaults($2.loc, $$.type.qualifier, $2.string); } | fully_specified_type IDENTIFIER array_specifier { - $$.intermAggregate = 0; - parseContext.nonInitConstCheck($2.loc, *$2.string, $1); - if (parseContext.profile == EEsProfile) - parseContext.arraySizeRequiredCheck($3.loc, $3.arraySizes->getSize()); - parseContext.arrayDimCheck($2.loc, $1.arraySizes, $3.arraySizes); - $$.type = $1; - - if (! parseContext.arrayQualifierError($3.loc, $1)) { - $1.arraySizes = $3.arraySizes; - TVariable* variable; - parseContext.arrayCheck($3.loc, *$2.string, $1, variable); - } + $$.intermAggregate = 0; + parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); parseContext.updateTypedDefaults($2.loc, $$.type.qualifier, $2.string); } - | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { - parseContext.arrayDimCheck($3.loc, $1.arraySizes, $3.arraySizes); - - $$.intermAggregate = 0; + | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { $$.type = $1; - - TVariable* variable = 0; - if (! parseContext.arrayQualifierError($3.loc, $1)) { - $1.arraySizes = $3.arraySizes; - parseContext.arrayCheck($3.loc, *$2.string, $1, variable); - } - - parseContext.profileRequires($4.loc, ENoProfile, 120, "GL_3DL_array_objects", "initializer"); - - TIntermNode* intermNode; - if (!parseContext.executeInitializerError($2.loc, *$2.string, $1, $5, intermNode, variable)) { - // - // Build intermediate representation - // - if (intermNode) - $$.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, $4.loc); - else - $$.intermAggregate = 0; - } else - $$.intermAggregate = 0; + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); + $$.intermAggregate = parseContext.intermediate.growAggregate(0, initNode, $4.loc); } | fully_specified_type IDENTIFIER EQUAL initializer { $$.type = $1; - - TIntermNode* intermNode; - if (!parseContext.executeInitializerError($2.loc, *$2.string, $1, $4, intermNode)) { - // - // Build intermediate representation - // - if (intermNode) - $$.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, $3.loc); - else - $$.intermAggregate = 0; - } else - $$.intermAggregate = 0; + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); + $$.intermAggregate = parseContext.intermediate.growAggregate(0, initNode, $3.loc); } // Grammar Note: No 'enum', or 'typedef'. @@ -1128,7 +1044,7 @@ fully_specified_type parseContext.arraySizeRequiredCheck($2.loc, $2.arraySizes->getSize()); } - if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1)) + if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier)) $2.arraySizes = 0; parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); @@ -2121,7 +2037,7 @@ struct_declaration $$ = $2; - parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1); + parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); parseContext.precisionQualifierCheck($1.loc, $1); for (unsigned int i = 0; i < $$->size(); ++i) { @@ -2139,7 +2055,7 @@ struct_declaration $$ = $3; - parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2); + parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); parseContext.precisionQualifierCheck($2.loc, $2); @@ -2302,13 +2218,14 @@ condition parseContext.boolCheck($1->getLoc(), $1); } | fully_specified_type IDENTIFIER EQUAL initializer { - TIntermNode* intermNode; parseContext.boolCheck($2.loc, $1); - if (parseContext.executeInitializerError($2.loc, *$2.string, $1, $4, intermNode)) - $$ = 0; + TType type($1); + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); + if (initNode) + $$ = initNode->getAsTyped(); else - $$ = $4; + $$ = 0; } ;