src/compiler


Log

Author Commit Date CI Message
Corentin Wallez a588ef5b 2015-05-19T16:38:47 Fix most occurences of -Winconsistent-missing-override Other occurences are in code generated by macro in googlemock. BUG=angleproject:892 Change-Id: I8b2c6ad4b793be2d9a440687b1b010c9feb8bdae Reviewed-on: https://chromium-review.googlesource.com/272224 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 7d7f8c44 2015-05-19T18:38:49 Ensure that conditional blocks and loop bodies are sequence nodes AST transformations such as unfolding logical operations can only create nodes inside sequence (block) nodes. This patch ensures that these AST transformations work even inside conditional blocks and loop bodies that were first parsed as single statements instead of blocks. BUG=angleproject:971 TEST=WebGL conformance tests Change-Id: If98cb7be653ec7b005537b89547f4f4cf1c07c72 Reviewed-on: https://chromium-review.googlesource.com/272141 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 56eea884 2015-05-18T12:41:03 Refactoring: make tracking parent block position in AST traversal reusable Add a helper function to make it easier for traverser classes to insert statements, and use it in UnfoldShortCircuitToIf. BUG=angleproject:971 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: I141bdd8abf4b01988581e6cb27c2320bf38370ac Reviewed-on: https://chromium-review.googlesource.com/272140 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole d94f6647 2015-05-18T16:25:12 Add ANGLE support for ESSL3 variant of mix() This change adds support for ESSL3 variant of built-in function mix() that takes last argument as a boolean vector. lerp() - HLSL equivalent of mix() doesn't look to be supporting a variant that takes last argument as a boolean vector so emulated it for HLSL. BUG=angleproject:1006 TESTS=dEQP tests Fixes "no matching overloaded function found " errors in below tests: dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.mix_*_b* (Note: These tests still fail because of constant expression issues) Change-Id: I79b353933cb450516b8678b1fdaeabe60417e9a7 Reviewed-on: https://chromium-review.googlesource.com/271751 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez bc99bb6b 2015-05-14T17:42:20 Enable more warnings on GCC and clang BUG=angleproject:892 Change-Id: I74ca341f29b245f698d1e1ad43149a91db46817f Reviewed-on: https://chromium-review.googlesource.com/271411 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho fd3b9be6 2015-05-18T17:07:36 Set mUsesDiscardRewriting more conservatively This fixes a regression from recent refactoring of unfolding short-circuiting operators. mUsesDiscardRewriting used to be set based on detecting patterns that the AST traverser now overwrites before the code reaches OutputHLSL. With this patch mUsesDiscardRewriting is set more conservatively, which ensures that using discard works correctly also in case the input shader contains the same kind of pattern as the short-circuiting operator unfolding creates. TEST=WebGL conformance tests on D3D9 BUG=chromium:488552 Change-Id: Iea0103822a268079593b0913f0b6fc54c745c6e3 Reviewed-on: https://chromium-review.googlesource.com/271761 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 274f0709 2015-05-05T13:33:30 Add constant folding support for min,max and clamp This change adds necessary mechanism to support constant folding of built-ins that take more than one parameter and also adds constant folding support for min, max and clamp built-ins. BUG=angleproject:913 TESTS=dEQP tests (126 tests started passing with this change) dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.min_* dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.max_* dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.clamp_* Change-Id: Iccc9bf503a536f2e3c144627e64572f2f95db9db Reviewed-on: https://chromium-review.googlesource.com/271251 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
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 0ea959f4 2015-05-13T14:51:59 Unfold sequence operator when operations inside need unfolding Unfolding the sequence operator ensures correct evaluation order when parts of the expression need to get hoisted out of the expression to the surrounding scope. BUG=angleproject:1001 TEST=WebGL conformance tests Change-Id: Ifd3093c9fb63d3e9842ebb4b9531b2f46875ad8a Reviewed-on: https://chromium-review.googlesource.com/270660 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d81ed841 2015-05-12T12:46:35 Defer executing if statements in the global scope Unfolding of short-circuiting operators (ternary and logical operators) may create if statements in the global scope, which is not valid HLSL. Use existing deferred global initialization function to defer execution of if statements in the global scope. TEST=WebGL conformance tests BUG=angleproject:819 Change-Id: I2b0afcc6824dab6bb87eb6abed609e75b1384dab Reviewed-on: https://chromium-review.googlesource.com/270461 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a6f22096 2015-05-08T18:31:10 Make UnfoldShortCircuit to change AST instead of writing output This is needed to make way for further AST transformations to handle array expressions that need to work correctly together with unfolding short- circuiting operators. This also improves the maintainability of HLSL output by isolating the unfolding into a separate compilation step. The new version of UnfoldShortCircuit traverser will traverse the tree until an expression that needs to be unfolded is encountered. It then unfolds it and gets reset. The traverser will be run repeatedly until no more operations to unfold are found. This helps with keeping the traverser's design relatively simple. All declarations are separated to single declarations before short-circuit unfolding is run. Previously OutputHLSL already output every declaration separately. BUG=angleproject:960 TEST=WebGL conformance tests, angle_unittests, angle_end2end_tests Change-Id: Id769be396adbd4c0223e418980dc464dd855f019 Reviewed-on: https://chromium-review.googlesource.com/270460 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@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>
Corentin Wallez e8675195 2015-05-14T15:31:36 Fix "unused private variable" warning in ParseContext BUG=angleproject:892 Change-Id: I3d0c23f1c2d43477c8b4ff28a6db470b3491de0b Reviewed-on: https://chromium-review.googlesource.com/271276 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
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>
Jamie Madill 6e06b1f4 2015-05-14T10:01:17 Make TParseContext a class, with private data. *re-land with build fix* BUG=angleproject:995 Change-Id: I67d3ded8f6c705b54fb372857e07ce1a86b58475 Reviewed-on: https://chromium-review.googlesource.com/271162 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 749fe340 2015-05-13T21:07:55 Revert "Make TParseContext a class, with private data." Causing build errors on Linux: FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj.rsp /c ..\..\third_party\angle\src\compiler\translator\ParseContext.cpp /Foobj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj /Fdobj\third_party\angle\src\translator_lib.cc.pdb c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : error C2220: warning treated as error - no 'object' file generated c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : warning C4099: 'TParseContext' : type name first seen using 'class' now seen using 'struct' c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\parsecontext.h(28) : see declaration of 'TParseContext' BUG=angleproject:995 This reverts commit 6c0c2987fba9dcf2a8d432534c9548092281bfa4. Change-Id: I49a8b7df9bc8b7c4892bf3af5e2c7a6444fba890 Reviewed-on: https://chromium-review.googlesource.com/270767 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c0c2987 2015-05-13T13:50:04 Make TParseContext a class, with private data. BUG=angleproject:995 Change-Id: Ie077e3a4f0fd5ef840aa35edeb41d15a98b7c0ff Reviewed-on: https://chromium-review.googlesource.com/270628 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 06145236 2015-05-13T13:10:01 Refactor style in ParseContext.h. BUG=angleproject:995 Change-Id: I893785a068d0d5cf4afc18123896bf540e53a3e0 Reviewed-on: https://chromium-review.googlesource.com/270627 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 95d34aaf 2015-05-13T19:44:31 Revert "Add constant folding support for min,max and clamp" This reverts commit 1137a2a6b4a68fe3f7497bb9289975b030576372. Change-Id: I1493c2706e5f08a9f0001835e663a147be85a303 Reviewed-on: https://chromium-review.googlesource.com/270782 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@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>
Arun Patole 1137a2a6 2015-05-05T13:33:30 Add constant folding support for min,max and clamp This change adds necessary mechanism to support constant folding of built-ins that take more than one parameter and also adds constant folding support for min, max and clamp built-ins. BUG=angleproject:913 TESTS=dEQP tests (126 tests started passing with this change) dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.min_* dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.max_* dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.clamp_* Change-Id: I5d3e96ef2062116cbf164a7a42cba096bd4d5389 Reviewed-on: https://chromium-review.googlesource.com/269317 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 4f3b8f63 2015-05-11T16:56:21 Add missing EvqPointCoord to getQualifierString Also sort enums in getQualifierString in the same order as in the enum definition. BUG=angleproject:999 TEST=WebGL conformance tests with --gl-shader-interm-output Change-Id: I31aa2e4b2405a090f560bf4140d9ee66271e526c Reviewed-on: https://chromium-review.googlesource.com/269941 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 37ad4744 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. A shading language version dependent varying matching check is added to the translator API to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. A previous revision of this change that broke API compatibility was reverted since it broke Chromium FYI bots. This revision keeps deprecated API functionality around for now so that changes can be rolled step-by-step to Chromium without breakage. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: Iecb64e3afd23e267ba999bc17f44390affcdfc13 Reviewed-on: https://chromium-review.googlesource.com/269940 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 9e64edce 2015-05-07T14:08:06 Revert "Add support for parsing ESSL3 invariant qualifiers" Build breaks in GPU FYI bots. BUG=angleproject:987 This reverts commit 4008879357159c7850cf105f2ae842bc68dd3c18. Change-Id: Ia88ad302c403c65516c050eb7741316b5097bcfb Reviewed-on: https://chromium-review.googlesource.com/269847 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 40088793 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. The varying matching check in the translator API is changed to be shading language version dependent to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I3982feff7380c4dfc647940ee03a020692dd0c59 Reviewed-on: https://chromium-review.googlesource.com/267663 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 06e24a7e 2015-04-27T14:48:59 Track if a non-preprocessor token has been seen and validate #extension with it. Reland: Only report a warning instead of an error. BUG=angleproject:989 BUG=483252 Change-Id: Ife3e7759cdef6bc0f41cae3c58c307682b608279 Reviewed-on: https://chromium-review.googlesource.com/269404 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 4b6bfe10 2015-05-05T20:10:20 Revert "Track if a non-preprocessor token has been seen and validate #extension with it." Causing failures in the GLES2 CTS "build", related to extensions. BUG=483252 BUG=angleproject:989 This reverts commit bbdb9e2259c38454be097ce01505db83db3ad7a8. Change-Id: I3e1ad989af645194c8ee9b9847b2131e289d09e1 Reviewed-on: https://chromium-review.googlesource.com/269403 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang bbdb9e22 2015-04-27T14:48:59 Track if a non-preprocessor token has been seen and validate #extension with it. Reland: Only report a warning instead of an error. BUG=angleproject:989 BUG=483252 Change-Id: Ibf9adbf423cd9dee20ec45b8d2ea42bcfd9311be Reviewed-on: https://chromium-review.googlesource.com/269205 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 214c2d8e 2015-04-27T14:49:13 Separate invariance from qualifiers ESSL3 makes it possible to combine invariant with several more different qualifiers. To avoid combinatorial explosion of the qualifier enum, track invariance with a separate boolean. TEST=WebGL conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I0c6629e5ca2ded06db9ac9e5bab2fb6480299a5a Reviewed-on: https://chromium-review.googlesource.com/267662 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho bab4c08f 2015-04-24T16:38:49 Require size for empty array declarations Passing dEQP tests requires this check, which seems to be a valid interpretation of ESSL3 spec section 4.1.9. BUG=angleproject:941 TEST=dEQP-GLES3.functional.shaders.arrays.invalid.* Change-Id: Iae88e6bb8e4ec784a2f1c8a94554e1e5c5e3ee85 Reviewed-on: https://chromium-review.googlesource.com/267430 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill b11e2483 2015-05-04T14:21:22 translator: Fix validation sometimes modifying builtins. When validating some shaders with out-of-bounds array indexes, we would write the sanitized index into the global symbol table. We would then overwrite a wrong value for the builtin. This fixes the WebGL test extensions/webgl-draw-buffers-max-draw-buffers. Also mark const on as many uses ConstantUnion as we can. BUG=angleproject:993 Change-Id: I110efaf1b7b0158b08b704277e3bc2472437902c Reviewed-on: https://chromium-review.googlesource.com/268962 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 6ba6eadc 2015-05-04T14:21:21 Rename ConstantUnion to TConstantUnion. This clarified that we're using the Pool allocator/deallocator for this type. BUG=angleproject:993 Change-Id: If8c95f6054d07291e7014be0d4e35766ba2e943b Reviewed-on: https://chromium-review.googlesource.com/269131 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Scott Graham a897542f 2015-05-01T11:09:12 vs2015: disable warning in generated code, fix another Macro redefinition is for INT8_MIN, etc. which are generated by flex. VS doesn't define __STDC_VERSION__ as >= C99 because it's still only partial support in VS2015. Fix a float->int conversion narrowing warning. Change-Id: I5232eb23426eaf584218137c068e14d74119a1ef Reviewed-on: https://chromium-review.googlesource.com/268821 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Scott Graham <scottmg@chromium.org>
Jamie Madill 55def583 2015-05-04T11:24:57 translator: Fix variable collection for gl_DepthRange. *re-land with Linux fixes, and fix for locations* This built-in uniform wasn't being collected in VariableInfo.cpp. Also remove the existing workaround for D3D gl_DepthRange collection. BUG=angleproject:991 BUG=478570 Change-Id: Iba84651bfc58f82fd4ce039421874f561f83c348 Reviewed-on: https://chromium-review.googlesource.com/268840 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 26e1a466 2015-05-01T19:19:19 Revert "translator: Fix variable collection for gl_DepthRange." Build errors on Linux: error: comparison of integers of different signs: 'const int' and 'const unsigned int' BUG=angleproject:991 BUG=478570 This reverts commit f1ae954b660cb058c40665b623f4d689b65180d4. Change-Id: I217aba1b32dc0e70d6153337a1f0ccef0483a0e1 Reviewed-on: https://chromium-review.googlesource.com/268792 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill f1ae954b 2015-05-01T13:33:57 translator: Fix variable collection for gl_DepthRange. This built-in uniform wasn't being collected in VariableInfo.cpp. Also remove the existing workaround for D3D gl_DepthRange collection. BUG=angleproject:991 BUG=478570 Change-Id: Ie254132e37c307323ba9e6e1705d138eea67b520 Reviewed-on: https://chromium-review.googlesource.com/268524 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Geoff Lang 4c8cae60 2015-05-01T16:46:16 Revert "Don't mark all macros with double underscores as reserved." Fails a WebGL CTS test. BUG=angleproject:989 This reverts commit 942e36254a1e3537371c39f3f23d1ce12f4c87e8. Change-Id: I9f833366d5b69535ef74e358ac21efaccb1f1a3d Reviewed-on: https://chromium-review.googlesource.com/268751 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 942e3625 2015-04-30T11:00:01 Don't mark all macros with double underscores as reserved. Only __FILE__, __LINE__, __VERSION__ and GL_ES are reserved but it is still not recommended to use a name with double underscores because it may be used by the "underlying software layers". Updated the tests to reflect that it is OK to define macros with double underscores but it is not valid to make assumptions about their values. Fixes: dEQP-GLES2.functional.shaders.preprocessor.basic.identifier_with_double_underscore_vertex dEQP-GLES2.functional.shaders.preprocessor.basic.identifier_with_double_underscore_fragment BUG=angleproject:898 Change-Id: I77054d04c9935eedcdbb7304dc0c3b60b53994f9 Reviewed-on: https://chromium-review.googlesource.com/268434 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2dc8bf8b 2015-04-30T15:56:52 translator: Fix C++11-deprecated register usage. Define 'register' as an empty string if we're in a modern version of C++. BUG=255186 BUG=angleproject:463 Change-Id: Ied044fb87a9b05c91cb419c54295c39f0f0ab776 Reviewed-on: https://chromium-review.googlesource.com/268512 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b96687df 2015-04-30T15:56:51 translator: Regenerate with Bison 3.0.4. BUG=angleproject:463 Change-Id: If89a29de8fb006e8e3b0483ac5df21c8833ce974 Reviewed-on: https://chromium-review.googlesource.com/268511 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 9624e058 2015-05-01T14:04:24 Revert "Track if a non-preprocessor token has been seen and validate #extension with it." Breaks some WebGL applications, holding off until a decision is made. BUG=483252 BUG=angleproject:989 This reverts commit fa55bf1ed6a26341c57f45b3a3da8feda0b6c18d. Change-Id: Iebef439095a95741c8502716a4ce90c4785561eb Reviewed-on: https://chromium-review.googlesource.com/268742 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2e295e23 2015-04-29T10:41:33 hlsl: Fix struct specifiers in uniforms. We would miss the definition for structs specfied in uniforms. Fix this by always checking to add the constructor. Fixes the WebGL test 'glsl/misc/struct-specifiers-in-uniforms'. BUG=angleproject:818 BUG=433412 Change-Id: I411e4a4477f7ef34fceb9faa77489f77d8efdce8 Reviewed-on: https://chromium-review.googlesource.com/267797 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez a1884f2b 2015-04-29T10:15:16 Fixes for the tagging of discontinuous loops The first fix was for all loops being considered discontinuous in OutputHLSL because of a typo that produced a tautology. The error was not detected by the unit tests because as an optimization we do not generate Lod0 calls when they are not needed for the callee function (which was correctly detected by the analysis in this case). Fixed the unit tests by adding a call to a builtin gradient operation. The second fix was for discard not being taken into account in the analyses of the AST, which caused a WebGL test regression after the first fix for conformance/glsl/bugs/conditional-discard-in-loop BUG=angleproject:982 Change-Id: I1315eac1ad36f726be52d7fda5facf3104341b1f Reviewed-on: https://chromium-review.googlesource.com/267814 Tested-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang fa55bf1e 2015-04-27T14:48:59 Track if a non-preprocessor token has been seen and validate #extension with it. Fixes: dEQP-GLES2.functional.shaders.preprocessor.extensions.after_non_preprocessing_tokens_vertex dEQP-GLES2.functional.shaders.preprocessor.extensions.after_non_preprocessing_tokens_fragment BUG=angleproject:989 Change-Id: Ie0aba80b2fde0160e83fc95f545b62954af2e5fc Reviewed-on: https://chromium-review.googlesource.com/267398 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 26be18da 2015-04-27T14:05:57 Validate that all preprocessor function arguments are unique. Fixes: dEQP-GLES2.functional.shaders.preprocessor.invalid_function_definitions.unique_param_name_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_function_definitions.unique_param_name_fragment BUG=angleproject:989 Change-Id: I32198f1c9036c371b46e7ad2986a44e42fd38e20 Reviewed-on: https://chromium-review.googlesource.com/267396 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 95a423d0 2015-04-28T11:09:45 Unexpected tokens after conditionals should be an error instead of a warning. Fixes: dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_if_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_if_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_else_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_else_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_endif_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_endif_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifdef_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifdef_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifndef_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifndef_fragment BUG=angleproject:989 Change-Id: I6511f7082c98206fb623775d81329b6bc7673c1a Reviewed-on: https://chromium-review.googlesource.com/267638 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang d3c29f57 2015-04-28T11:23:02 Add pragma errors for malformed pragmas. Instead of always warning on invalid pragmas, only warn when the pragma type is not recognized and error when the syntax is invalid. Fixes: dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_vertex dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_fragment dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_vertex dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_fragment BUG=angleproject:989 Change-Id: Ibd584dc08a2436e163dfc52eeffdf2dac8a22cb8 Reviewed-on: https://chromium-review.googlesource.com/267639 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang b819d25d 2015-04-27T14:16:34 Validate that there are no tokens following #undef on the same line. Fixes: dEQP-GLES2.functional.shaders.preprocessor.definitions.undefine_object_invalid_syntax_vertex dEQP-GLES2.functional.shaders.preprocessor.definitions.undefine_object_invalid_syntax_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_definitions.undef_non_identifier_2_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_definitions.undef_non_identifier_2_fragment BUG=angleproject:989 Change-Id: I279a38aaae8010017ef6e3f1aa139ae03f374680 Reviewed-on: https://chromium-review.googlesource.com/267397 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Qingqing Deng ad0d0799 2015-04-08T14:25:06 Expand ShShaderOutput for different GLSL versions BUG=angleproject:968 Change-Id: I2d4c0a8e9a91a940922da4501c22124da0c0399c Reviewed-on: https://chromium-review.googlesource.com/264840 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d57e0db3 2015-04-24T15:05:08 Remove separate compilerdebug.h in favor of debug.h This unifies the behavior across the compiler and rest of ANGLE - for example, one can use #define ANGLE_TEST_CONFIG to disable UNIMPLEMENTED asserts in both the compiler and the rest of ANGLE. Compiler traces from asserts also go to the same TRACE_OUTPUT_FILE as other traces instead of being directed through ParseContext. The compiler build already includes the common sources, so no changes to build config are needed. The original version of this change was reverted due to release mode build issues. This version adds UNUSED_ASSERTION_VARIABLE where needed. TEST=angle_unittests, angle_end2end_tests, dEQP-GLES3.functional.shaders.* BUG=angleproject:983 Change-Id: I36929020a04251b8bc834fbb3c069e10128c3082 Reviewed-on: https://chromium-review.googlesource.com/267411 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill a656490d 2015-04-27T14:30:32 Revert "Remove separate compilerdebug.h in favor of debug.h" Causing compile warnings in Release: 1>compiler\translator\CallDAG.cpp(238): error C2220: warning treated as error - no 'object' file generated 1>compiler\translator\CallDAG.cpp(238): warning C4189: 'op' : local variable is initialized but not referenced 1>compiler\translator\IntermNode.cpp(1495): error C2220: warning treated as error - no 'object' file generated 1>compiler\translator\IntermNode.cpp(1495): warning C4189: 'replaced' : local variable is initialized but not referenced 1>compiler\translator\IntermNode.cpp(1517): warning C4189: 'replaced' : local variable is initialized but not referenced This reverts commit 5271025865b34685da71d0309131c5aff2e32f71. Change-Id: Icdf1c37eef22a13d083767609ab0b0285d3dc517 Reviewed-on: https://chromium-review.googlesource.com/267359 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 52710258 2015-04-24T15:05:08 Remove separate compilerdebug.h in favor of debug.h This unifies the behavior across the compiler and rest of ANGLE - for example, one can use #define ANGLE_TEST_CONFIG to disable UNIMPLEMENTED asserts in both the compiler and the rest of ANGLE. Compiler traces from asserts also go to the same TRACE_OUTPUT_FILE as other traces instead of being directed through ParseContext. The compiler build already includes the common sources, so no changes to build config are needed. TEST=angle_unittests, angle_end2end_tests, dEQP-GLES3.functional.shaders.* BUG=angleproject:983 Change-Id: Ifca4d16f667b1e5cf9c2e7cc4139940091917a1c Reviewed-on: https://chromium-review.googlesource.com/266993 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 2cb7b835 2015-04-23T20:27:44 Clean up binary operation constant folding code Fix mixed up comments, remove unnecessary type conversions, clarify variable names and improve formatting in a few places. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:913 Change-Id: Ice8fe3682d8e97f42747752302a1fba116132df4 Reviewed-on: https://chromium-review.googlesource.com/266843 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho a8c414ba 2015-04-16T15:51:03 Add basic support for arrays as return values in HLSL output In HLSL output, user-defined functions that have an array as their return value get changed so that they have the array as an out parameter instead. Still missing: support for calling a function that has array as a return value without assigning the array. Also support for assignments inside complex expressions. TEST=dEQP-GLES3.functional.shaders.arrays.return.* BUG=angleproject:941 Change-Id: I79f5170139116a3dcfb2be2df5f0f79a3d955ca8 Reviewed-on: https://chromium-review.googlesource.com/266003 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c6833115 2015-04-22T15:15:54 Prune empty declarations from the AST Empty declarations in ESSL shaders currently result in errors on several platforms. Prune empty declarations that are not struct or interface block declarations from the AST. TEST=WebGL conformance tests, angle_unittests, angle_end2end_tests BUG=angleproject:980 Change-Id: I9e3abf8134e6dfed0253cc83f69ce0ee92b0e0e7 Reviewed-on: https://chromium-review.googlesource.com/266841 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 39282e1f 2015-04-23T15:41:48 Disallow length being called on expressions with side effects ESSL 3.00 definition of expressions does not include calling length on anything other than array names, so enforce this restriction in the parser. TEST=WebGL 2 conformance tests BUG=angleproject:972 Change-Id: I893d3c468ff21cb419b3239738f2a41834298cf2 Reviewed-on: https://chromium-review.googlesource.com/266992 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> 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 8fee0ab8 2015-04-23T14:52:46 Fix build regression on Linux Chromium's Linux toolchain doesn't implement the return value of std::vector::insert correctly, causing a build failure. Remove an unnecessary assignment of the return value to fix this build regression. The regression was caused by the commit: "Put each array declarator into a separate declaration in HLSL output" TEST=angle_unittests Change-Id: I2959122d28e4c7e6d6a4d842a97a8f1fd4f27ca1 Reviewed-on: https://chromium-review.googlesource.com/266990 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 78174db7 2015-04-21T16:14:00 Replace EvqInternal with a separate flag to make it more flexible The internal flag disables decorating a given symbol in output, effectively placing it to a different namespace than user-defined symbols. This enables the compiler to insert symbols to the tree when transforming it to be suitable for HLSL output without running into name conflicts. In this patch the flag is separated from the qualifiers since sometimes different qualifiers need to be used with these internal symbols. TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests BUG=angleproject:941 Change-Id: I7036bed98fdb1478a383bb959ca03b42c3cb8100 Reviewed-on: https://chromium-review.googlesource.com/266690 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 822fa84e 2015-04-16T14:26:10 Support array initialization in HLSL output Do this by separating each array initialization into a declaration and an assignment. Array assignment is already supported in HLSL output by replacing it with a function call. The functionality is tested by the struct array constructor tests in dEQP. BUG=angleproject:941 TEST=dEQP-GLES3.functional.shaders.arrays.constructor.* Change-Id: Ida84fc343b767bea8b2d04e91c60cb8197d39039 Reviewed-on: https://chromium-review.googlesource.com/266002 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho fc0e2bc0 2015-04-16T13:39:56 Put each array declarator into a separate declaration in HLSL output Since HLSL doesn't support arrays as l-values, HLSL output needs to split declarators that initialize arrays to variable declaration and assignment implemented via a function call. To prepare for this, it is necessary that each declarator has its own declaration. BUG=angleproject:941 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: I43dee487578561c01dbde90c2f55a93dda2f057a Reviewed-on: https://chromium-review.googlesource.com/266001 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 28eb65e3 2015-04-06T17:29:48 Support constant folding of exponential built-ins This change adds constant folding support for unary exponential built-ins - exp, log, exp2, log2, sqrt and inversesqrt. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.exponential* (48 out of 56 tests started passing with this change) Change-Id: I4b98782c4c4b72dd7d60dfc4f18ba6961526ec41 Reviewed-on: https://chromium-review.googlesource.com/266797 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole fddc211a 2015-04-22T13:28:10 Revert "Revert "Use nullptr consistently in TIntermConstantUnion::fold"" Revert of revert as the new changes that use nullptr in fold function are already in. This reverts commit b775778a050739c4d802da8db7edb8c865602950. Change-Id: Ifbdb35264132c66e5d1f2379932839b99291c54a Reviewed-on: https://chromium-review.googlesource.com/266803 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 97dc22e0 2015-04-06T17:35:38 Support constant folding of common built-ins This change adds constant folding support for unary common built-ins: abs, sign, floor, trunc, round, roundEven, ceil and fract. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common* (80 out of 210 tests started passing with this change) Change-Id: I46312fec43084601d4fca8195ddaaa5292f1c02a Reviewed-on: https://chromium-review.googlesource.com/265967 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8d95b741 2015-04-17T18:44:13 Revert "Support constant folding of exponential built-ins" Causing compile errors on Android: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1309:62: error: use of undeclared identifier 'log2f' else if (!foldFloatTypeUnary(unionArray[i], &log2f, infoSink, &tempConstArray[i])) This reverts commit 1623a1b90f24cd1afd8839c0726ad276a887fbda. Change-Id: If9c45aea85801eb11e7d1513b4183ec11289d2f3 Reviewed-on: https://chromium-review.googlesource.com/266154 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 1623a1b9 2015-04-06T17:29:48 Support constant folding of exponential built-ins This change adds constant folding support for unary exponential built-ins - exp, log, exp2, log2, sqrt and inversesqrt. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.exponential* (48 out of 56 tests started passing with this change) Change-Id: I63133ee8c04c4a8d6cb30da5788e9227c05d4cbe Reviewed-on: https://chromium-review.googlesource.com/266071 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 9dea48f3 2015-04-02T11:45:09 Support constant folding of trigonometry built-ins This change adds constant folding support for trigonometry built-in functions. Constant folding for these functions also fixes constant expression issues where constant initializer is a built-in trignometry function whose arguments are all constant expressions. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.angle_and_trigonometry* (112 out of 120 tests pass with this change) Change-Id: I2b7a61320819dcd095827faa1fd16e835f4688b4 Reviewed-on: https://chromium-review.googlesource.com/265819 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho cd94ef96 2015-04-16T19:18:10 Fix style issues in updateTree() "entry" is an old C keyword, so it's better not to use it as a variable name. Also fix a few other minor style issues in the code. TEST=angle_unittests BUG=angleproject:941 Change-Id: I59470555227985262b3e914ff6ca11e88d15fd8c Reviewed-on: https://chromium-review.googlesource.com/265647 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ffe6edfd 2015-04-13T17:32:03 Add basic support for the length() method of arrays Support expressions where the expression that .length() is called on does not have side effects. Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests BUG=angleproject:972 Change-Id: Ib4f8377a51da61179b6e47fbcf6b4d915e351fbd Reviewed-on: https://chromium-review.googlesource.com/265654 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>
Scott Graham a825fdce 2015-04-14T16:05:47 Disable macro redefinition warning for vs2015 From flexint.h (because VS2015 has some of c99, but doesn't define __STDC_VERSION__ yet. Change-Id: Iff82f4c72dd816dcc1959abb218442a848ea592a c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(48): error C2220: warning treated as error - no 'object' file generated c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(48): warning C4005: 'INT8_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(83): note: see previous definition of 'INT8_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(49): warning C4005: 'INT16_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(86): note: see previous definition of 'INT16_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(50): warning C4005: 'INT32_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(89): note: see previous definition of 'INT32_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(52): warning C4005: 'INT8_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(92): note: see previous definition of 'INT8_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(53): warning C4005: 'INT16_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(95): note: see previous definition of 'INT16_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(54): warning C4005: 'INT32_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(98): note: see previous definition of 'INT32_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(56): warning C4005: 'UINT8_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(101): note: see previous definition of 'UINT8_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(57): warning C4005: 'UINT16_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(104): note: see previous definition of 'UINT16_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(58): warning C4005: 'UINT32_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(107): note: see previous definition of 'UINT32_MAX' Reviewed-on: https://chromium-review.googlesource.com/265594 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
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 3875ffd1 2015-04-10T16:45:14 Add parser support for initializing sized arrays Still missing from this patch: HLSL output, implicitly sized arrays. Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests BUG=angleproject:941 Change-Id: I900f2af843fd8046f23dd4b77352e77026bbba84 Reviewed-on: https://chromium-review.googlesource.com/265652 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e7847b08 2015-03-16T11:56:12 Unify declaration parsing code Remove the unused identifierSymbol parameter from parseSingleDeclarator and unify the ordering of parameters and the code style of different declaration and declarator parsing functions. Some minor functional changes to array size handling are done mainly to unify error message generation. There's soon going to be more of these functions, so it's good to be systematic. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:941 Change-Id: I03b0220de93ca5719fdb7c1790a5999b8cb5b225 Reviewed-on: https://chromium-review.googlesource.com/265202 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
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 e16eae36 2015-04-10T11:48:55 Fix structQualifierErrorCheck calls in glslang.y structQualifierErrorCheck is called incorrectly in glslang.y. Remove one unnecessary call entirely and change another call to samplerErrorCheck. This will enable further changes to merge structQualifierErrorCheck into singleDeclarationErrorCheck. TEST=angle_unittests BUG=angleproject:969 Change-Id: Ib43233e275fbf4db7e5fda6df6b45a655bdee8a2 Reviewed-on: https://chromium-review.googlesource.com/265200 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho ab6fc6a2 2015-04-13T12:10:20 Add support for arrays as function return values in GLSL output Output the array brackets and the array size correctly when a function's return value type is array. Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html BUG=angleproject:971 TEST=WebGL 2 conformance tests Change-Id: I63aa8c54d2696f65351b23acb0749a487298ddfb Reviewed-on: https://chromium-review.googlesource.com/265410 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill bc709339 2015-04-14T15:32:19 Revert "Support constant folding of trigonometry built-ins" Part of a chain causing compile errors on Mac. Example: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1216:89: error: no member named 'sin' in namespace 'std'; did you mean 'sinf'? http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33747 This reverts commit 1767e6b4f9148a6aa462d23e3838810c0080ce78. Change-Id: Ie39b1bf9a08da61aa0b16e219b34d1ba0b6f6c0f Reviewed-on: https://chromium-review.googlesource.com/265587 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3c772f36 2015-04-14T15:30:45 Revert "Support constant folding of exponential built-ins" Part of a chain causing compile errors on Mac. Example: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1216:89: error: no member named 'sin' in namespace 'std'; did you mean 'sinf'? http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33747 This reverts commit 62e2c8d2bc55c41db4e6095eac012b8861131585. Change-Id: Id20f7f4efbc3df7756161b192d4858caeeb0572f Reviewed-on: https://chromium-review.googlesource.com/265627 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d1e9a0f4 2015-04-14T15:30:16 Revert "Support constant folding of common built-ins" Part of a chain causing compile errors on Mac. Example: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1216:89: error: no member named 'sin' in namespace 'std'; did you mean 'sinf'? http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33747 This reverts commit 2b1da6ed1dbe5960bed8c1b2fa3d33cb00c6c116. Change-Id: I5d48932a6254d6d1e78966bb3891913d9450e08e Reviewed-on: https://chromium-review.googlesource.com/265612 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b775778a 2015-04-14T15:29:29 Revert "Use nullptr consistently in TIntermConstantUnion::fold" Part of a chain causing compile errors on Mac. Example: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1216:89: error: no member named 'sin' in namespace 'std'; did you mean 'sinf'? http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33747 This reverts commit 72ed20d4bb5a5c55d9909d6cc9b7a0e89e4a81a2. Change-Id: Ia6119f6081b3184deef3deef25b9e3f43ff2e2a6 Reviewed-on: https://chromium-review.googlesource.com/265586 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 72ed20d4 2015-04-08T14:26:25 Use nullptr consistently in TIntermConstantUnion::fold Newly added code in TIntermConstantUnion::fold uses nullptr where as remaining part of the function uses NULL. This change removes NULL and consistently uses nullptr in complete function. Change-Id: I600dcf11b686d8d72b2bcdac88b7158288c68105 Reviewed-on: https://chromium-review.googlesource.com/265395 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 2b1da6ed 2015-04-06T17:35:38 Support constant folding of common built-ins This change adds constant folding support for unary common built-ins: abs, sign, floor, trunc, round, roundEven, ceil and fract. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common* (80 out of 210 tests started passing with this change) Change-Id: I06800ed0e03764c0f7aab6bcd45c4f122de5a3c1 Reviewed-on: https://chromium-review.googlesource.com/265394 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 62e2c8d2 2015-04-06T17:29:48 Support constant folding of exponential built-ins This change adds constant folding support for unary exponential built-ins - exp, log, exp2, log2, sqrt and inversesqrt. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.exponential* (48 out of 56 tests started passing with this change) Change-Id: Ie7808cd57d6ed7598c642a9a0940b8f5bd293741 Reviewed-on: https://chromium-review.googlesource.com/265393 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 1767e6b4 2015-04-02T11:45:09 Support constant folding of trigonometry built-ins This change adds constant folding support for trigonometry built-in functions. Constant folding for these functions also fixes constant expression issues where constant initializer is a built-in trignometry function whose arguments are all constant expressions. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.angle_and_trigonometry* (112 out of 120 tests pass with this change) Change-Id: I66275b2ae9faecef63d76763d21a9b67d9bb68fa Reviewed-on: https://chromium-review.googlesource.com/265392 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 2935c581 2015-04-08T14:32:06 Simplify code related to variable declaration Rename nonInitErrorCheck to declareVariable to clarify that it declares variables. Merge arrayErrorCheck with that so that logic that is common between array and non-array declarations is only in one place. This will simplify adding array initializer handling. This also enables redeclaring gl_LastFragData using ESSL3 array type syntax. Comments in executeInitializer claimed that the TVariable object was needed for error recovery, but that was not actually true, so it can also use the new declareVariable method. Make "variable" a local variable instead of a parameter to executeInitializer, since the parameter was never used by callers of the function. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:941 Change-Id: Ie133be62afc3e1f997370803cf21cada4e738935 Reviewed-on: https://chromium-review.googlesource.com/264674 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b4a058bb 2015-04-10T14:50:51 Revert "Support constant folding of trigonometry built-ins" Part of a chain breaking the clang build: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33588 This reverts commit af930db15010cacfcdc74bee630372b8f6eb3eeb. Change-Id: Ic0bf09b4088a1ee285fed0fbd77dfc4c682fcd12 Reviewed-on: https://chromium-review.googlesource.com/265144 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 50b7178d 2015-04-10T14:50:15 Revert "Support constant folding of exponential built-ins" Part of a chain breaking the clang build: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33588 This reverts commit 1c89caef47a27c63a7d0f988e74816692a9b9b39. Change-Id: I36e080d8f64d4d4ca5de04bebbd119db83956d0e Reviewed-on: https://chromium-review.googlesource.com/265185 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3cf271fe 2015-04-10T14:49:36 Revert "Support constant folding of common built-ins" Part of a chain breaking the clang build: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33588 This reverts commit 0273c68c507a10af3e45c6e4a52a44adcd0cf742. Change-Id: I00d7617a7c380f2a5ea3f38ec14948a598aa5c1a Reviewed-on: https://chromium-review.googlesource.com/265184 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c9e8c96 2015-04-10T14:48:08 Revert "Use nullptr consistently in TIntermConstantUnion::fold" Part of a chain breaking the clang build: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33588 This reverts commit 5f2feee42971fdbbd7cb389fffe2f632060ec6e3. Change-Id: I5ad54b05148ae2d4f19e50a67aded2bad4f55f91 Reviewed-on: https://chromium-review.googlesource.com/265143 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 3873cd0b 2015-04-10T15:00:55 Fix issues with computing discontinuous loops AST analysis to narrow down usage of [[loop]] and [[unroll]] failed to account for break statements inside switch statements. Add switch statement handling. This fixes asserts/crashes in dEQP tests. BUG=angleproject:937 TEST=dEQP-GLES3.functional.shaders.switch.* Change-Id: I04fdfe4733772a2a234934123bbfacf0376df562 Reviewed-on: https://chromium-review.googlesource.com/265191 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Arun Patole 5f2feee4 2015-04-08T14:26:25 Use nullptr consistently in TIntermConstantUnion::fold Newly added code in TIntermConstantUnion::fold uses nullptr where as remaining part of the function uses NULL. This change removes NULL and consistently uses nullptr in complete function. Change-Id: Ieaada3cf46bf3e16d3ef91b300c86537f778c33f Reviewed-on: https://chromium-review.googlesource.com/264632 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 0273c68c 2015-04-06T17:35:38 Support constant folding of common built-ins This change adds constant folding support for unary common built-ins: abs, sign, floor, trunc, round, roundEven, ceil and fract. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common* (80 out of 210 tests started passing with this change) Change-Id: I09f2f99b3108e0d2fb1919a0631e4317b6a28be3 Reviewed-on: https://chromium-review.googlesource.com/263709 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 1c89caef 2015-04-06T17:29:48 Support constant folding of exponential built-ins This change adds constant folding support for unary exponential built-ins - exp, log, exp2, log2, sqrt and inversesqrt. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.exponential* (48 out of 56 tests started passing with this change) Change-Id: I22af56876d1b7ce305697bf9bf43ad9ec5d8a3a5 Reviewed-on: https://chromium-review.googlesource.com/263708 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole af930db1 2015-04-02T11:45:09 Support constant folding of trigonometry built-ins This change adds constant folding support for trigonometry built-in functions. Constant folding for these functions also fixes constant expression issues where constant initializer is a built-in trignometry function whose arguments are all constant expressions. BUG=angleproject:913 TEST= dEQP tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.angle_and_trigonometry* (112 out of 120 tests pass with this change) Change-Id: I2ed4360532469fe0d70048d5f2300a8db6f9fcda Reviewed-on: https://chromium-review.googlesource.com/263679 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 6ed7bbe8 2015-04-07T18:08:46 Clean up arrayErrorCheck Remove some unnecessary TPublicType/TType conversions from the code, and clean up code style. voidErrorCheck is changed to take TBasicType so that it can be used with both TType and TPublicType. TEST=angle_unittests BUG=angleproject:941 Change-Id: I6f6cbc0761a4fc971299bad48864309009c54e7f Reviewed-on: https://chromium-review.googlesource.com/264673 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 4176cd64 2015-04-02T11:14:38 Remove now unused DetectDiscontuinity.h/.cpp BUG=angleproject:937 BUG=395048 Change-Id: Ie8e520267d594a595201cb7c2438a2202d9adf25 Reviewed-on: https://chromium-review.googlesource.com/263745 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>