src/compiler/translator/IntermNode.cpp


Log

Author Commit Date CI Message
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>
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>
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>
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>
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>
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>
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 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 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>
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>
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>
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>
Minmin Gong 794e0009 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: Id0e06d7d6600344d858f00dabc219d79289bbc82 Reviewed-on: https://chromium-review.googlesource.com/265020 Tested-by: Minmin Gong <mgong@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b3584fb4 2015-04-09T17:34:21 Revert "Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data)" Causing a build failure on Mac/Clang: ./Tokenizer.cpp:551:7: error: extra tokens at end of #else directive [-Werror,-Wextra-tokens] #else if defined(_MSC_VER) http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/29136 This reverts commit 3b26e231d99154814eb428f75a67bbe7a21adadc. Change-Id: I2d11ddcc18130d908fd2ec3d6f5ab890cfccd5e7 Reviewed-on: https://chromium-review.googlesource.com/264983 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Minmin Gong 3b26e231 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: I73d9a2b9ad16f032be974b9c819de0dc1247c2ea Reviewed-on: https://chromium-review.googlesource.com/264533 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho f6c694bc 2015-03-26T14:50:53 Assign built-in function return type in promote() This finishes the refactoring of unary math operation handling so that IntermUnary::promote has the complete code for setting the return type of the node. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: I19bd8d53029e24f734c9436eceb446b37e7fcf26 Reviewed-on: https://chromium-review.googlesource.com/262416 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho dca3e796 2015-03-26T13:24:04 Refactor unary math operator handling to clarify responsibilities Shuffle the code around so that each part has a clear responsibility: IntermUnary::promote is responsible for setting the return type of the node, Intermediate::addUnaryMath is responsible for creating the node object, and ParseContext::createUnaryMath is responsible for validating the operand type. This removes duplicated bool type check for logical not. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: I9f5a0abb6434ad2730441ea9199ec3f5382ebcda Reviewed-on: https://chromium-review.googlesource.com/262415 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 47fd36a7 2015-03-19T14:22:24 Move some validation from IntermBinary::promote to ParseContext This makes the role of promote() in the system clearer and helps to make the code more understandable, since more of the checks are in the same logical place. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: Idb2de927d872e46210d71cf6de06a6f8c1fc5da1 Reviewed-on: https://chromium-review.googlesource.com/260803 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e79904c3 2015-03-18T16:56:42 Accept equality and assignment for arrays in parsing This is enough to support the operations in GLSL output. HLSL output will likely require additional work to support this. BUG=angleproject:941 Change-Id: I728d511ab07af94bc3382dc2796c1e9ac79d1442 Reviewed-on: https://chromium-review.googlesource.com/260801 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d6b14287 2015-03-17T14:31:35 Move binary op array check to ParseContext Also piece together an addAssign function in ParseContext that uses the binary op array check. This will make it easier to change the array-related checks in the future to use shaderVersion. Moving validation out from IntermBinary::promote also makes the architecture clearer, promote()'s role should be mainly to determine the type of the return value of the binary operation, not to do validation. BUG=angleproject:941 TEST=angle_unittests, WebGL conformance tests Change-Id: If1de33ea250893527be7f0d7930d4678a0864684 Reviewed-on: https://chromium-review.googlesource.com/260571 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a3a36664 2015-02-17T13:46:51 Implement parsing switch statements Put in some groundwork for parsing switch statements and case labels in the parser, including definitions for IntermNode classes. Intermediate functions for adding the statements are stubbed to only generate errors for now. Tested by manually disabling shading language version checks for switch in a Chromium build and checking that the expected errors are generated. BUG=angle:921 Change-Id: I064b3e0c4c1b724a083cf5bc78eebfdd3794eb1b Reviewed-on: https://chromium-review.googlesource.com/250380 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 6b19d765 2015-02-19T09:40:39 Implement missing variants of abs/sign This change adds ANGLE support for abs/sign variants introduced in ESSL3. BUG=angle:923 TEST=Unit tests, dEQP tests Unit Tests: TypeTrackingTest.BuiltInAbsSignFunctionFloatResultTypeAndPrecision TypeTrackingTest.BuiltInAbsSignFunctionIntResultTypeAndPrecision dEQP tests passing 100% because of this change: dEQP-GLES3.functional.shaders.builtin_functions.common.abs dEQP-GLES3.functional.shaders.builtin_functions.common.sign Change-Id: I2a3b028611f0eaaac3c031f8926d34a0e146663d Reviewed-on: https://chromium-review.googlesource.com/251491 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 7c1f6f19 2015-02-19T18:56:09 Revert "Implement missing variants of abs/sign" This for some reason is failing angle_unittests: http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28NVIDIA%29/builds/13296 Happens across platforms. This reverts commit 3e142e47cc5b40564bcdba4252fd326bc28ca343. Change-Id: Ideb20457546c0dec10c9584182cc8d5ead42309d Reviewed-on: https://chromium-review.googlesource.com/251160 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 3e142e47 2015-02-19T09:40:39 Implement missing variants of abs/sign This change adds ANGLE support for abs/sign variants introduced in ESSL3. BUG=angle:923 TEST=dEQP tests Tests passing 100% because of this change: dEQP-GLES3.functional.shaders.builtin_functions.common.abs dEQP-GLES3.functional.shaders.builtin_functions.common.sign Change-Id: If22032be2c1ed08451275262e311ef5ac613d45e Reviewed-on: https://chromium-review.googlesource.com/251060 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 3eab00a0 2015-02-12T16:02:39 Fix constant folding integer modulus Constant folding % used to generate results from division instead of results from modulus. Fix this and introduce a test for this and other integer constant folding, that checks that the right constant values are found in the IntermNode tree. BUG=angle:916 TEST=angle_unittests Change-Id: I75e59b7734eb206378a1b2957af0a5437a90097c Reviewed-on: https://chromium-review.googlesource.com/249691 Reviewed-by: Gregoire Payen de La Garanderie <Gregory.Payen@imgtec.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Nicolas Capens <capn@chromium.org>
Olli Etuaho ff805cc3 2015-02-13T10:59:34 Separate integer and float modulus Integer and float modulus are separated into Mod and IMod operator types to make the code clearer and to make GetOperatorString return the correct value for both. Change-Id: Ibfbca2c558bf919b0eab6404d7349f87fe47a18c Reviewed-on: https://chromium-review.googlesource.com/249692 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 31b5fc62 2015-01-16T12:13:36 Add support for bitwise operations in ESSL3 Add support for <<, >>, &, |, ^, and their compound assignment variants <<=, >>=, &=, |=, ^=. Also add support for bitwise not (~). BUG=angle:870 Change-Id: I5e6a835409589556d5d58d58078fdf505cfd8da5 Reviewed-on: https://chromium-review.googlesource.com/241850 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 7700ff65 2015-01-15T12:16:29 Add basic support for ESSL3 vec2 (un)pack functions The functions are emulated on HLSL, and use the native functions on OpenGL 4.2+ and GLES3.0. Emulation for OpenGL versions <= 4.1 is not yet implemented. BUG=angle:865 Change-Id: I6803a1767dacdb3dca12f13924651fd38fcacb75 Reviewed-on: https://chromium-review.googlesource.com/240961 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d68157fc 2015-01-16T12:24:17 Fix issues related to modulus operator Make sure that "scalar %= vector" is not approved by the compiler, and that % and %= are only exposed on GLES3. BUG=angle:854 Change-Id: I3ac7eb607bd86a6caa905d2bef5d397688ad3fd3 Reviewed-on: https://chromium-review.googlesource.com/241410 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Gregoire Payen de La Garanderie <Gregory.Payen@imgtec.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e8d2c072 2015-01-08T16:33:54 Implement float-integer conversions for ESSL 3.00 The implementation uses asint, asuint and asfloat in the HLSL output. BUG=angle:865 Change-Id: I6b48298e18c7b3b0bdeac522b375ebc4eab7cf4e Reviewed-on: https://chromium-review.googlesource.com/239520 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Gregoire Payen de La Garanderie be954a23 2014-12-23T00:05:28 Implement support for the binary operator '%' in the translator. BUG=angle:854 Change-Id: If116de132dc83d93255749b54c1919a75abcb65c Reviewed-on: https://chromium-review.googlesource.com/236330 Tested-by: Gregoire Payen de La Garanderie <Gregory.Payen@imgtec.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 6c85047a 2014-12-02T16:23:17 Reject compound assignments of the type scalar op= vector/matrix scalar op vector/matrix produces a vector/matrix, which can't be assigned to a scalar. Handle this correctly for addition, subtraction and division. Multiplication was already handled correctly as a special case. BUG=angle:832 TEST=WebGL conformance tests Change-Id: I318cae8bf353a5c58c588876ce3f29d18389263c Reviewed-on: https://chromium-review.googlesource.com/232601 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 352beffc 2014-11-19T13:45:55 Remove RemoveAllTreeNodes, since it was a no-op IntermNode operator delete() or any of the IntermNode destructors don't do anything, since all the AST memory is allocated on the PoolAllocator. Because of this, RemoveAllTreeNodes was simply a no-op, and redundant with the PoolAllocator deallocation procedure, and could confuse people reading the code to think that IntermNodes should be deleted individually, when in fact this is not the case. BUG=angle:831 Change-Id: Ie1ccaa51986aabf267280d92a8e76ca9f97a19e5 Reviewed-on: https://chromium-review.googlesource.com/230730 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 853dc1ab 2014-11-06T17:25:48 Add mediump and lowp precision emulation support for GLSL output This implements the rounding as specified in WEBGL_debug_shader_precision extension proposal for desktop GLSL and ESSL output. The bulk of the new functionality is added in the form of a new EmulatePrecision AST traverser, which inserts calls to the rounding routines angle_frm and angle_frl in the appropriate places, and writes the rounding routines themselves to the shader. Compound assignments which are subject to emulation are transformed from "x op= y" to "angle_compound_op_frm(x, y)", a call to a function which does the appropriate rounding and places the result of the operation to x. The angle_ prefixed names should not clash with user-defined names if name hashing is on. If name hashing is not on, the precision emulation can only be used if the angle_ prefix is reserved for use by ANGLE. To support the rounding routines in output, a new operator type is added for internal helper function calls, which are not subject to name hashing. In ESSL output, all variables are forced to highp when precision emulation is on to ensure consistency with how precision emulation performs on desktop. Comprehensive tests for the added code generation are included. BUG=angle:787 Change-Id: I0d0ad9327888f803a32e79b64b08763c654c913b Reviewed-on: https://chromium-review.googlesource.com/229631 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d2a67b96 2014-10-21T16:42:57 Fix precision tracking for built-in function return values Previously, the type of the return value of all function calls was set to the type of the return value in the function signature. This did not carry precision information. This patch changes this so that the return value precision is set correctly for built-in functions. For single-argument math functions, it mostly depends on that addUnaryMath sets the type of the return value to be the same as the type of the operand. The type is replaced but the precision information from the operand type is retained when needed. For multi-argument math functions, precision is determined based on all the nodes in the aggregate after the type has been set. For texture functions, the precision is set according the sampler type as per ESSL 1.0 spec. For textureSize, the precision is always highp as per ESSL 3.0 spec. BUG=angle:787 Change-Id: I48448e3ffe38656b91177dee9b60dd07a03cd095 Reviewed-on: https://chromium-review.googlesource.com/224951 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo de1e00e1 2014-10-09T16:55:32 Implement support of unary operator "+" in translator. BUG=angle:779 TEST=conformance/glsl/misc/struct-unary-operators.html Change-Id: Ia827e07dcfc8ad3bbbc078e54336815be9027945 Reviewed-on: https://chromium-review.googlesource.com/222720 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b1a85f48 2014-08-19T15:23:24 Rename compiler intermediate source files. This prevents confusion between "TIntermediate" and "TIntermNode". BUG=angle:711 Change-Id: Ib7a086382a479db3f77bf2ab06ce321aa7b35d13 Reviewed-on: https://chromium-review.googlesource.com/212936 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>