src/tests/compiler_tests/MalformedShader_test.cpp


Log

Author Commit Date CI Message
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>