src/tests/compiler_tests/MalformedShader_test.cpp


Log

Author Commit Date CI Message
Qiankun Miao 7ebb97fc 2016-09-08T18:01:50 Use 64-bits compile options BUG=chromium:645071 Change-Id: I31825123bf4cb45fb37a93f538e8936487beb5ff Reviewed-on: https://chromium-review.googlesource.com/382712 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 70866b89 2016-07-22T15:27:42 Change grammar to support features from es31 The grammar has been changed so that ES31 grammar is followed more closely. The ES31 grammar is not fully supported, only functionality related to qualifier enumeration is added. The ParseContext is changed so that type qualifiers can be now joined together (i.e. like layout qualifiers). This will allow enumeration of multiple storage qualifiers (i.e. uniform readonly coherent) which is essential for support of ES31 features. Some of the error checks had to be moved closer to the root of the parse tree since some of the information about the expression might be missing. Unfortunately, as there is no explicit ordering imposed by the grammar, additional checks for proper order of qualifiers had to be added. I also included unit tests which test against malformed shaders. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests TEST=dEQP-GLES3.functional.shaders.*precision* TEST=dEQP-GLES3.functional.shaders.*function* TEST=dEQP-GLES2.functional.shaders.* Change-Id: Ib3653a1ed1bfced099a6b2cbf35a7cd480c9100d Reviewed-on: https://chromium-review.googlesource.com/362940 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 558b038c 2016-08-26T17:54:34 Don't accept sampler operands for unary operators Unary plus and minus used to be accepted with sampler operands. Increment/decrement operators also now generate a clearer error message if a sampler operand is supplied. TEST=angle_unittests BUG=angleproject:1480 Change-Id: I2c5165c4eaac7b023d96e46a177e36f6536b0125 Reviewed-on: https://chromium-review.googlesource.com/376319 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 244be01a 2016-08-18T15:26:02 Fix struct compound assignment being allowed in GLSL parsing The shader translator used to accept some invalid struct operations, like struct += struct and struct == struct with a different type. Fix this. BUG=angleproject:1476 TEST=angle_unittests Change-Id: Ia2303fc1f740da4d78242e094ee6004b07364973 Reviewed-on: https://chromium-review.googlesource.com/372718 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev b088360f 2016-08-04T17:48:58 Add compute shader special variables Support is added for the compute shader special variables given in OpenGL GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables. Unit tests are added for legal and illegal usage of the special variables. BUG=angleproject:1442 TEST=angle_unittests Change-Id: Idb25811c15c4044c55c611c0e73ef26eb5b3e9d7 Reviewed-on: https://chromium-review.googlesource.com/366661 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 802abe01 2016-08-04T17:48:32 Add compute shader compilation support in the glsl compiler Support is added for compute shader compilation. There is a small extension to the parser so that 'local_size_x = ', 'local_size_y = ' and 'local_size_z = ' are supported as layout qualifiers. A few shader compilation tests are added and one which checks the AST whether the layout qualifiers are properly parsed. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I67283797d1cf13fa4ac47faa2a6e66d93a2db867 Reviewed-on: https://chromium-review.googlesource.com/362300 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev e93d24ef 2016-07-28T12:06:05 Add es3.1 shader constants The patch adds all shader built-in constants. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I81cae479d6506a8faa2dce023d5fcc2c1291d521 Reviewed-on: https://chromium-review.googlesource.com/364460 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 461e3af8 2016-07-21T18:15:34 preprocessor: Fix negative shift with bad ids. Fix this by producing an error on undefined or negative shifts. BUG=629518 Change-Id: Idfca5ed3fc8e557f6178408f3426a5ef2ce7cf14 Reviewed-on: https://chromium-review.googlesource.com/362020 Reviewed-by: Antoine Labour <piman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 90892fbd 2016-07-14T14:44:51 Refine swizzle/indexing constant folding code Fix constant folding of subscripting non-square matrices. Previously constant folding would offset the pointer into the matrix in multiples of the number of columns, when it should offset the pointer in multiples of the number of rows. Also change the MalformedShaderTest so that it only succeeds if vector swizzle is being checked correctly. Previously compilation would fail in the test either way because the shader code contained a call to an undefined function. Also refactor indexing checks and constant folding so that constant folding is done entirely separately from out-of-range checks. Bogus comments are removed from the constant folding functions. BUG=angleproject:1444 TEST=angle_unittests, angle_end2end_tests Change-Id: I7073b38f759e9b3635ee05947df4f6d8e23a39d5 Reviewed-on: https://chromium-review.googlesource.com/360112 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill c2128ff5 2016-07-04T10:26:17 translator: Fix two bugs that trigger ASSERTs. The first bug was a result of constant-folding a vector swizzle that was out-of-bounds. The second bug was a result of using a semicolon in a preprocessor define. BUG=angleproject:1425 Change-Id: Id6643b1f3e3b13cc021bd721ef2572487fe3c8d3 Reviewed-on: https://chromium-review.googlesource.com/357864 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho dcf12c70 2016-06-28T15:03:06 Fix validating non-square matrix compound multiplication The validation previously checked that two matrices in compound multiplication are the exact same size, which isn't correct for non-square matrices introduced in ESSL 3.00. Instead, check that the matrix multiplication is valid and that the resulting value has the same number of columns as the lvalue. The number of rows in the result is taken from the lvalue so it doesn't need to be checked. BUG=angleproject:1431 TEST=angle_unittests Change-Id: I6f32b7dc037d72c3c5cfdfffcda5d996e8450283 Reviewed-on: https://chromium-review.googlesource.com/356411 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c4a96d67 2015-07-23T17:37:39 Names of built-in functions cannot be redeclared as functions With ESSL 3.00, names of built-in functions cannot be redeclared as functions, and therefore an error needs to be generated if a built-in function is overloaded. This is fixed by inserting unmangled built-ins into a special set in the symbol table and checking if function declarations match any of the built-ins in the set. The regular symbol table structures can't be used for storing the unmangled names because that interferes with name hashing in OutputGLSL. Credit goes to Arun Patole, apatole@nvidia.com for initially investigating this issue and developing the first version of the patch. BUG=angleproject:1066 TEST=angle_unittests, dEQP-GLES3.functional.shaders.functions.invalid.overload_builtin_function* (2 tests started passing with this change) Change-Id: I28c8325f5a3a8f4a97226b0dfdbb9762724fa609 Reviewed-on: https://chromium-review.googlesource.com/328994 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 5f80d016 2016-01-11T11:16:01 Disallow invariant(all) pragma in ESSL 3.00 fragment shaders ESSL 3.00.4 section 4.6.1 says that using #pragma STDGL invariant(all) in a fragment shader is an error, so make it an error. This spec language is not found in ESSL 1.00, and it's been removed in ESSL 3.10. BUG=angleproject:1276 TEST=angle_unittests Change-Id: I2022f35475f867304b55dfb142f8568f6df28830 Reviewed-on: https://chromium-review.googlesource.com/321240 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Olli Etuaho 8d8b108a 2016-01-04T16:44:57 Disallow local function prototypes Function prototypes should not be allowed inside other functions according to ESSL 3.00.4 section 4.2.4. BUG=angleproject:1068 TEST=angle_unittests, dEQP-GLES*.functional.shaders.functions.invalid.local_function_proto* Change-Id: I54160da4d49b92a6cd7cbee020e67733963d4e10 Reviewed-on: https://chromium-review.googlesource.com/320091 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5d653186 2016-01-04T14:43:28 Disallow multiple function prototypes in ESSL 1.00 The same function can't be declared twice in ESSL 1.00. In ESSL 3.00 this is allowed. A function prototype following the definition of that function is not interpreted as redeclaration, and the shader compiler continues to allow this. BUG=angleproject:1067 TEST=angle_unittests, dEQP-GLES2.functional.shaders.functions.invalid.double_declare* Change-Id: I6d2ddafd456d378d92839600f19069ad1cd19aff Reviewed-on: https://chromium-review.googlesource.com/320082 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 66641c61 2016-01-04T15:31:15 Fix typo in shader test The only error in the test should be the non-integer index. gl_FragColor should be used correctly. BUG=angleproject:1254 TEST=angle_unittests Change-Id: I0b7a36be5485661cc03bf2c476aaacae5d3b6e76 Reviewed-on: https://chromium-review.googlesource.com/320280 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8e89866d 2015-12-11T12:24:21 Remove redundant index integer check from ValidateLimitations Non-integer indices are already rejected in the parser, so the ValidateLimitations pass doesn't need to check for them. ESSL 1.00 spec is not actually terribly clear about whether the parser should do this check, but the language grammar in the spec only has indexing with "integer_expression" so it seems like ANGLE's interpretation of only allowing indexing with integers is correct. ESSL 3.00 makes this restriction explicitly clear in section 5.7. BUG=angleproject:1254 TEST=angle_unittests Change-Id: I02b2a6f4d9fa7801a98df63ed21bc990e1585eb8 Reviewed-on: https://chromium-review.googlesource.com/317741 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8a76dcc7 2015-12-10T20:25:12 Don't try to apply ForLoopUnroll to loops it can't handle ForLoopUnroll should only mark loops that fit the limitations in ESSL 1.00 Appendix A. BUG=angleproject:1253 TEST=angle_unittests, WebGL conformance tests Change-Id: I00b0a7d29cd42efea9611d020aa1f873ac04773f Reviewed-on: https://chromium-review.googlesource.com/317551 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho d561057f 2015-12-10T19:42:09 Fix ValidateLimitations for folded non-constant expressions ANGLE recently gained the ability to constant fold some expressions that are not constant expressions. ValidateLimitations should continue to recognize all cases where an expression is not a constant expression. BUG=angleproject:851 TEST=angle_unittests Change-Id: I8ad0552a59213cdd6af9a220ffd672be9752271d Reviewed-on: https://chromium-review.googlesource.com/317281 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 183d7e24 2015-11-20T15:59:09 Remove predefined precision qualifiers from ESSL3 samplers New sampler types in ESSL3 should not have default precision qualifiers. This is specified in ESSL 3.00.4 section 4.5.4. BUG=angleproject:1222 TEST=angle_unittests Change-Id: I9c8e7a5fbb4278db80de79bcaeebaf23e64242a0 Reviewed-on: https://chromium-review.googlesource.com/312048 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 0980e29d 2015-11-20T14:57:34 Don't accept default precision for uint Default precision can only be specified for float, int and sampler types. Default precision for int also applies to uint and uvec declarations. BUG=angleproject:1221 TEST=angle_unittests Change-Id: I31fdcde80da16e2ea8771838f7c1a6ab4e478194 Reviewed-on: https://chromium-review.googlesource.com/313314 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e1a94c67 2015-11-16T17:35:25 Check that texture offset is constant and valid Offset passed to textureOffset and similar functions must be constant. See ESSL 3.00 spec section 8.8. It must also be in the valid range between MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET. Using values outside the valid range makes the results of the texture lookup undefined, as specified in GLES 3.0.4 section 3.8.10. We generate a compiler error if an offset is outside the valid range. BUG=angleproject:1215 TEST=angle_unittests Change-Id: Ida28361444d2f4050d516160f1491674c31868a1 Reviewed-on: https://chromium-review.googlesource.com/312223 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3e960463 2015-11-12T15:58:39 Detect when gl_FragData is indexed with != 0 in WebGL 2.0 WebGL 2.0 explicitly specifies it to be an error when gl_FragData is indexed with anything else than constant zero in spec section 'GLSL ES 1.00 Fragment Shader Output'. This doesn't apply to WebGL 1.0 or GLES. dEQP-GLES2.functional.shaders.fragdata* test that dynamic indexing of gl_FragData is allowed. TEST=angle_unittests BUG=angleproject:1210 Change-Id: Ib401242e7867f5e7943456b059dd8e24dc404098 Reviewed-on: https://chromium-review.googlesource.com/312045 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho bd163f6a 2015-11-13T12:15:38 Fix parsing structure definitions in place of constructors The shader parser used to accept structure definitions in place of constructors, which is invalid GLSL. This patch fixes that. BUG=angleproject:939 TEST=angle_unittests Change-Id: Ibcf502160e91c19e693e9427b548a399d83e2a71 Reviewed-on: https://chromium-review.googlesource.com/312032 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 36b0514a 2015-11-12T13:10:42 Fix ESSL3 indexing corner cases Indexing interface blocks or fragment outputs with a non-constant expression is not valid even if ANGLE has been able to constant fold the expression. BUG=angleproject:1210 TEST=angle_unittests Change-Id: I2ccb67871b682976a31b8de306053b9b28c06437 Reviewed-on: https://chromium-review.googlesource.com/312044 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 15c2ac30 2015-11-09T15:51:43 Fix constructor parsing issues After this patch, ANGLE no longer accepts constructors where any of multiple parameters is sampler or void. Also, structure array constructors with just one parameter are now accepted. Error message for a constructor with no parameters is also more informative than before. BUG=angleproject:1193 TEST=angle_unittests Change-Id: I6b897973448cf500096f612b3b95dcc23aebc716 Reviewed-on: https://chromium-review.googlesource.com/311590 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7c3848e5 2015-11-04T13:19:17 Allow constant folding some non-constant expressions This requires removing the assumption that constant folding implies constness in the constant expression sense from various places in the code. This particularly benefits ternary operators, which can now be simplified if just the condition is a compile-time constant. In the future, the groundwork that is laid here could be used to implement more aggressive constant folding of user-defined functions for example. TEST=angle_unittests BUG=angleproject:851 Change-Id: I0eede806570d56746c3dad1e01aa89a91d66013d Reviewed-on: https://chromium-review.googlesource.com/310750 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho b1edc4f5 2015-11-02T17:20:03 Accept const array initialization in shader parsing Array constructors are not folded, unlike all other constant expressions. Change initializer parsing path so that it accepts constant initializers whether they are folded or not. Some parts need to be adapted to work with expressions that are qualified as constant but that are not necessarily folded: 1. Identifier parsing 2. Indexing parsing 3. Field selection parsing 4. HLSL output for variable declarations 5. Determining unary operator result type 6. Determining binary operator result type 7. Determining built-in function call result type 8. Determining ternary operator result type Corner cases that are not supported yet: 1. Using array constructors inside case labels 2. Using array constructors inside array size expressions 3. Detecting when a negative constant expression containing an array constructor is used to index an array In these cases being able to constant fold the expression is essential to validating that the code is correct, so they require a more sophisticated solution. For now we keep the old code that rejects the shader if ANGLE hasn't been able to constant fold the case label or array size. In case of indexing an array with a negative constant expression containing an array constructor, ANGLE will simply treat it as a non-constant expression. BUG=541551 BUG=angleproject:1094 TEST=dEQP-GLES3.functional.shaders.constant_expressions.* (all pass), angle_unittests Change-Id: I0cbc47afd1651a4dece3d68acf7ec72a01fdf047 Reviewed-on: https://chromium-review.googlesource.com/310231 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho f541f529 2015-10-13T12:21:01 Fix parsing integers larger than 0x7FFFFFFF Parsing should accept all values between 0 and 0xFFFFFFFF as specified in ESSL 3.00 section 4.1.3. When a signed literal is parsed, it's interpreted as if it specifies the bit pattern of a two's complement integer. For example, parsing "0xFFFFFFFF" results in -1. Decimal literals behave the same way, so for example parsing "3000000000" results in -1294967296. This change affects parsing of literals in ESSL 1.00 as well. In ESSL 3.00, an out-of-range integer literal now generates a compiler error. Unit tests are added based on examples in the ESSL 3.00 spec and one example in GLSL 4.5 spec that ESSL should match. BUG=541550 TEST=angle_unittests Change-Id: I82f8ef5cfa2881019a3f80d77ff99707d61c000d Reviewed-on: https://chromium-review.googlesource.com/305420 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@google.com>
Olli Etuaho b3fbd867 2015-09-30T17:55:02 Fix setting const qualifier on indexing expression Resubmitting now that separate fix for updating mangled names of types has been merged. A unit test is added to make sure that the same regression doesn't happen again. Previously, constness of indexing expressions did not take the index expression into account. Now constness correctly takes into account both the base expression and the index expression. Setting the type of expressions that index arrays is also simplified. BUG=angleproject:1170 TEST=angle_unittests Change-Id: Ie9b6aaee8185b945c03657b13d9513cc55cd2a9f Reviewed-on: https://chromium-review.googlesource.com/303601 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill e623bd46 2015-10-02T19:14:15 Revert "Fix setting const qualifier on indexing expression" Failing to compile shaders which are used in some layout_tests, see http://crbug.com/538692 for logs and bad shaders. We should diagnose if the shaders are faulty or if there's a bug in this CL and take appropriate action, but first priority is to get the tests running again. BUG=538692 BUG=angleproject:1170 This reverts commit 16a79cd169420cdf0254964b1bac9dd9964a8119. Change-Id: Iea14c58d87041bcf5ba645b7076ba0936dea6b9d Reviewed-on: https://chromium-review.googlesource.com/303794 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 16a79cd1 2015-09-30T17:55:02 Fix setting const qualifier on indexing expression Previously, constness of indexing expressions did not take the index expression into account. Now constness correctly takes into account both the base expression and the index expression. Setting the type of expressions that index arrays is also simplified. BUG=angleproject:1170 TEST=angle_unittests Change-Id: Ie2d122020cc252655ab0eea96886b9f85931b80a Reviewed-on: https://chromium-review.googlesource.com/303350 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho cc36b983 2015-07-10T14:14:18 Implement ESSL 3.00 shader input/output variable type rules ESSL 3.00 allows a wider variety of types of input/output variables than ESSL 1.00, but there are still specific restrictions on structs, matrices and arrays. Some of the checks need to be implemented twice: once for array syntax where the brackets are after the type, and another time for array syntax where the brackets are after the variable name. This requires fixes to constant folding unit tests which were previously incorrectly using matrix outputs in fragment shaders. New unit tests are added for several of the rules introduced, but some cases are also covered by dEQP. TEST=angle_unittests, dEQP-GLES.functional.shaders.linkage.varying.rules.* BUG=angleproject:1061 Change-Id: I655b054cfe56d376db775b96a2bb41b3ac5740b0 Reviewed-on: https://chromium-review.googlesource.com/285482 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Kimmo Kinnunen 8518e7f6 2015-07-16T14:54:08 Make all fragment shader out variables require location layout qualifier Make all fragment shader out variables require location layout qualifier. Previously, the last variable did not need a location layout qualifier if the previous variables had those. TEST=angle_unittests BUG=angleproject:1070 Change-Id: Ifb66ee52b811409f5278eaad330d6cd9b8ea059f Reviewed-on: https://chromium-review.googlesource.com/287100 Tested-by: Kimmo Kinnunen <kkinnunen@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6d276c8e 2015-07-20T19:00:38 Revert "Make all fragment shader out variables require location layout qualifier" Causes a warning on Windows: compiler\translator\ValidateOutputs.cpp(37): warning C4804: '>' : unsafe use of type 'bool' in operation BUG=angleproject:1070 This reverts commit 140941d066c11238ba4f2f15647fb2d65ae56faf. Change-Id: Ieed42cdda22f17c6e15c38ee1c059184869e6919 Reviewed-on: https://chromium-review.googlesource.com/286820 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Kimmo Kinnunen 140941d0 2015-07-16T14:54:08 Make all fragment shader out variables require location layout qualifier Make all fragment shader out variables require location layout qualifier. Previously, the last variable did not need a location layout qualifier if the previous variables had those. TEST=angle_unittests BUG=angleproject:1070 Change-Id: I3763b8ca38b1e14ee8456a54592c01e0fd89692c Reviewed-on: https://chromium-review.googlesource.com/286101 Tested-by: Kimmo Kinnunen <kkinnunen@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho c1ac41bb 2015-07-10T13:53:46 Apply array restriction on qualified types only on ESSL1.00 Add a test that checks that uniforms with an array type are allowed in ESSL3.00. TEST=angle_unittests BUG=angleproject:1061 Change-Id: I6c9e8eeb3e8a6b81522c87039b93bcc0008ae317 Reviewed-on: https://chromium-review.googlesource.com/285481 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho abb0c381 2015-07-13T12:01:12 Check that layout qualifiers may only appear in declarations In the shading language grammar, layout qualifiers may appear in loop conditions and function declarations, but this is not valid ESSL 3.00 according to section 4.3.8. TEST=angle_unittests, dEQP-GLES3.functional.shaders.*layout* BUG=angleproject:1064 Change-Id: I73f805247bf6678b953f2e1d45a23391e9eacb96 Reviewed-on: https://chromium-review.googlesource.com/285040 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho b5841ef2 2015-07-08T17:25:22 Disallow texture lookup functions in global initializers Do this by simply disallowing all function calls in global initializers - all built-in math ops are handled as other ops, not function calls. This change was tested extensively with popular WebGL content, with no regressions found. TEST=angle_unittests BUG=angleproject:988 Change-Id: Id1107fa294ae4012d5dd3949539d0b7b4cd21943 Reviewed-on: https://chromium-review.googlesource.com/283703 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 846fe05f 2015-07-07T17:41:21 Disable using globals as l-values in global initializers It should not be possible to use globals as l-values in global initializers. This change was tested extensively with popular WebGL content, with no regressions found. TEST=angle_unittests BUG=angleproject:988 Change-Id: I21ab731eb1d92aeae25795856ccae280792ad1f0 Reviewed-on: https://chromium-review.googlesource.com/283910 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho ce39f6ff 2015-07-06T15:25:19 Disallow user-defined function calls in global variable init Generate an error message when an user-defined function call is found in a global variable initializer. Even before this patch, the call graph already marked functions that were only called from the global scope as unused. This change was tested extensively with popular WebGL content, with no regressions found. TEST=angle_unittests BUG=angleproject:988 Change-Id: Iec1b16d2af386f1e5c383f86926d80cef553b694 Reviewed-on: https://chromium-review.googlesource.com/283291 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho c378cd8a 2015-05-25T15:21:44 Check that #version 300 es directive is on the first line ESSL3.00 and 3.10 specs don't allow even newlines before the version directive. BUG=angleproject:1009 TEST=WebGL 2 conformance tests, angle_unittests Change-Id: Id7967829077e35e03572c724e0eafffbed0c975b Reviewed-on: https://chromium-review.googlesource.com/272719 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 14e95b38 2015-05-07T10:10:41 translator: Reject shaders that use both FragColor+FragData. *re-land with fix for unused var in release* We checked this at link time in the D3D back-end, but this restriction applies to all shaders. TEST=dEQP-GLES2.functional.shaders.fragdata.* BUG=angleproject:995 BUG=478572 Change-Id: I63258f4de47e658812822f31601cc235f48c0826 Reviewed-on: https://chromium-review.googlesource.com/271470 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 531e3d22 2015-05-15T11:01:27 Revert "translator: Reject shaders that use both FragColor+FragData." The change introduced a warning in Windows release build. This reverts commit b8e3a568bbd16fca1099a1b54cd82a981cd88a8e. Change-Id: I77bbc35876043c9a164aa2665965f5189ee90052 Reviewed-on: https://chromium-review.googlesource.com/271430 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill b8e3a568 2015-05-07T10:10:41 translator: Reject shaders that use both FragColor+FragData. We checked this at link time in the D3D back-end, but this restriction applies to all shaders. TEST=dEQP-GLES2.functional.shaders.fragdata.* BUG=angleproject:995 BUG=478572 Change-Id: I99111cc6aa05b9352693f9c3b5bc70d56c9842d4 Reviewed-on: https://chromium-review.googlesource.com/269846 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b0c645e2 2015-05-12T14:25:36 Validate global initializer qualifiers Allow only constants, other globals, temporaries, and uniforms to be used in global variable initialization for now. The spec limits global variable initialization further to only constant expressions, but fully implementing this has a too large compatibility cost for ESSL 1.00, so implement it only partially. In the case of ESSL 3.00 we can use stricter validation, since there's no legacy to worry about. Resubmitting the change, since the previous version neglected to remove incorrect GLSL tests. TEST=angle_unittests, WebGL conformance tests, angle_end2end_tests BUG=angleproject:988 Change-Id: I1bb3b8dc305689a90eadfe8cc7705e5ac3829e03 Reviewed-on: https://chromium-review.googlesource.com/270651 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b6a52bb4 2015-05-13T12:41:24 Revert "Validate global initializer qualifiers" Seems to be failing angle_end2end_tests: GLSLTest.GlobalStaticAndVarying_0 GLSLTest.GlobalStaticAndVarying_1 GLSLTest_ES3.GlobalStaticAndInstanceID_0 http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28NVIDIA%29/builds/15598 BUG=angleproject:988 This reverts commit 6caa5e815f7e3c11e4452ed5e60446b9943db183. Change-Id: I394b571c9b4ee739721018c5287a45df49e1471c Reviewed-on: https://chromium-review.googlesource.com/270589 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 6caa5e81 2015-05-12T14:25:36 Validate global initializer qualifiers Allow only constants, other globals, temporaries, and uniforms to be used in global variable initialization for now. The spec limits global variable initialization further to only constant expressions, but fully implementing this has a too large compatibility cost for ESSL 1.00, so implement it only partially. In the case of ESSL 3.00 we can use stricter validation, since there's no legacy to worry about. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:988 Change-Id: I6a66f6a31130b44717dd2bef3082a0fc395a60b6 Reviewed-on: https://chromium-review.googlesource.com/270430 Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 96e67388 2015-04-23T14:27:02 Fix array.length() to return a signed integer array.length() should return a signed integer as specified in ESSL 3.00 section 4.1.9, not unsigned. Fix this and add a simple unit test - the dEQP tests included in WebGL conformance are built in a way that they don't catch the issue. TEST=angle_unittests BUG=angleproject:972 Change-Id: I1389f51751a6a25c1681f57ac3d2d52f31ecc8fb Reviewed-on: https://chromium-review.googlesource.com/266991 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a2d53039 2015-04-15T14:14:44 Disallow ternary operator on arrays and structs ESSL specs only allow a limited number of operators on arrays and structs. The spec section on the ternary operator contradicts this to an extent, saying that the second and third operands can be "any type" or "any type other than an array", but we interpret the spec so that the operator restrictions on structures and arrays override this. BUG=angleproject:976 TEST=angle_unittests Change-Id: Icd90d5450dcb94bb23b1683d4cb9e579e82de4ad Reviewed-on: https://chromium-review.googlesource.com/265644 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5290174b 2015-04-15T13:42:45 Refactor ternary operator parsing Refactor ternary operator parsing so that validation is done in ParseContext and Intermediate's role is simply to create the node added to the tree. Remove partially bugged checks for null nodes as a part of this - in error cases the parser doesn't typically add null nodes to the tree, but rather always has a fallback to add a dummy node if parsing fails as a method of recovery. When parsing ternary operators it should be guaranteed that none of the parameter nodes is null. Includes a better explanation of why ternary operators are not always folded when only the condition is constant, and a test to make sure this doesn't regress. BUG=angleproject:952 TEST=WebGL conformance tests, angle_unittests Change-Id: Icbcb721b5ab36cf314a16e79f9814aef1f355fa0 Reviewed-on: https://chromium-review.googlesource.com/265643 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 376f1b5d 2015-04-13T13:23:41 Add support for implicit array size ESSL3 introduces implicit array size that is determined automatically according to the initializer. Implicit sizes are resolved when parsing constructors and when initializers are evaluated, so ANGLE's AST will not contain implicit sizes. Declarations where there are two differently sized arrays with the same implicitly sized type, for example: float[] a = float[](0.0), b = float[](0.0, 1.0); will be transformed into declarations where the two arrays don't share the array size like this: float a[1] = float[1](0.0), float b[2] = float[2](0.0, 1.0); so they are not a problem. Unlike sized arrays, implicitly sized arrays don't have a size limit enforced by the parser. Include a test that verifies that non-initialization of an implicitly sized array defined using ESSL3 type syntax is caught by the parser. Additionally tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:941 Change-Id: Ib55b7601848102a103af9db284a80f09abaeb021 Reviewed-on: https://chromium-review.googlesource.com/265653 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 33e98913 2015-04-10T17:03:06 Add tests for disallowing arrays of arrays TEST=angle_unittests BUG=angleproject:941 Change-Id: Ie45a8a581bf2931ecccfc41b26db49a257fcaf1d Reviewed-on: https://chromium-review.googlesource.com/265201 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho fa33d580 2015-04-09T14:33:12 Improve handling of declarator lists with empty declarations The code previously failed to check for correctness of layout qualifiers in case a declarator followed an empty declaration, like so: layout(packed) uniform float, a; Fix this by running all necessary declaration checks also for declarators which follow an empty declaration. structQualifierErrorCheck is merged into singleDeclarationErrorCheck. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:969 Change-Id: Idcb0673e3bcf64087744ff0d260f51a7546f024a Reviewed-on: https://chromium-review.googlesource.com/264812 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 43ce600c 2015-04-09T14:50:40 Fix a bunch of mistakes in MalformedShaderTest A number of mistakes had slipped in to this test that made the compilation of some shaders always fail regardless of the semantic checks applied by the parser. TEST=angle_unittests BUG=angleproject:941 Change-Id: I9906792e2c7fe3805288255b855afb46840a77a7 Reviewed-on: https://chromium-review.googlesource.com/264811 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 3739d235 2015-04-08T12:23:44 Make checking for array non-constness depend on input version First, remove duplicate check for const qualifier on arrays. Only keep the check inside arrayQualifierErrorCheck(). Second, ESSL3 will introduce array initializers and by extension constant arrays, so it should allow const qualifier on arrays. These checks are somewhat superfluous in ESSL1 as well, since the parser already checks for missing initializers, but it's useful to keep the informative error messages around. Add a few tests to make sure that when the ESSL3 implementation progresses, it still checks for missing initializers on constant arrays. TEST=angle_unittests BUG=angleproject:941 Change-Id: Id871c872c5b92e2a5bf81c00080ac23004916a75 Reviewed-on: https://chromium-review.googlesource.com/264671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 93a90fd0 2015-04-07T18:14:07 Remove half-baked non-sized array support ANGLE used to accept shaders with non-sized arrays in initializer lists. Fix this. Proper support for implicitly sized arrays will be implemented later for ESSL3. TEST=angle_unittests BUG=angleproject:941 Change-Id: I53c5ccf0f7ef09ad30e142f8350812959fc4846c Reviewed-on: https://chromium-review.googlesource.com/264360 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho ecbfc5c6 2015-03-23T15:15:59 Fix formatting in compiler tests Remove extraneous semicolons and fix indentation in a couple of places. TEST=angle_unittests Change-Id: Iaa51eb50990c0435f41dfd346ec161216cd8d372 Reviewed-on: https://chromium-review.googlesource.com/261823 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ff699005 2015-03-23T14:38:42 Disallow operations on structs containing samplers ESSL 1.00 spec section 5.9 says that equality operators don't operate on structs containing sampler types. Section 5.7 also suggests this. ESSL 3.00 doesn't have a similar restriction. ESSL 1.00 spec section 4.1.7 says that structs containing samplers can't be used as l-values. This is interpreted to apply also in the case of ESSL 3.00, which similarly disallows samplers as l-values, but doesn't explicitly mention structs. BUG=angleproject:954 TEST=angle_unittests, WebGL conformance tests Change-Id: I73f74962a192e8d9449990ffa5f3d8c851491601 Reviewed-on: https://chromium-review.googlesource.com/261822 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 9dd217bc 2015-03-20T14:24:31 Disallow operations on structures containing arrays in ESSL1 Comparing structures that contain arrays to each other and assigning structures that contain arrays is "not defined" in ESSL 1.00 (section 5.7). Sections 5.8 and 5.9 further suggest that these operations are not allowed. Additionally some platform drivers on Linux seem to reject shaders produced by ANGLE which compare structures containing arrays. This might require changing the output GLSL version for ESSL 3.00. BUG=angleproject:954 TEST=angle_unittests Change-Id: I5f3a016f360f940f2fc1ec1ff8e60d13a977eb69 Reviewed-on: https://chromium-review.googlesource.com/261531 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho b2983c95 2015-03-18T14:02:46 Correctly insert unmangled function names to symbol table This fixes detecting some cases of function parameter mismatch (previously a mangled function name corresponding to no function parameters was added to the symbol table for each user-defined function, and this was returned when doing function lookups with no parameters). Also fixes detection of reusing a function name as a variable/struct name. New unit tests are added to ensure that these fixes don't regress. BUG=angleproject:936 TEST=angle_unittests, WebGL conformance tests Change-Id: I2dadde9dcc01c7a4a653c1982c36377b89e6d437 Reviewed-on: https://chromium-review.googlesource.com/260800 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>