src/compiler/translator/IntermNode.cpp


Log

Author Commit Date CI Message
Jamie Madill 47cb73ab 2016-09-09T11:41:44 Refactor TConstantUnion. In preparation for constant folding fixes. BUG=chromium:637050 Change-Id: I9ea49ce96b34c6ac3d2f0478b8fc6732c59e28be Reviewed-on: https://chromium-review.googlesource.com/373741 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d0bad2c7 2016-09-09T18:01:16 Split ternary node class from TIntermSelection Ternary operator nodes are typed parts of expressions, they always have two children and the children are also guaranteed to be TIntermTyped. "If" selection nodes can't be a part of an expression, they can have either one or two children and the children are code blocks. Due to all of these differences it makes sense to store these using two different AST node classes. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I913ab1d806e3cdb5c21106f078cc9c0b6c72ac54 Reviewed-on: https://chromium-review.googlesource.com/384512 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho a223430c 2016-08-31T12:05:39 Promote unary nodes automatically Unary nodes now get their type set automatically based on the operation and operand. The operand should only be changed to another of the same type after the node is constructed. The operation can't be changed on unary and binary nodes after they've been constructed. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ib1ea3dcb1162261966c02d5f03d8091cf647fac1 Reviewed-on: https://chromium-review.googlesource.com/378935 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3272a6d3 2016-08-29T17:54:50 Promote and fold indexing nodes similarly to other binary ops Indexing nodes now get their type set in TIntermBinary::promote, same as math and logic ops. They are also constant folded through TIntermBinary::fold() instead of having special functions for constant folding them in ParseContext. Index nodes for struct and interface block member access now always have integer type, instead of sometimes having the type of the field they were used to access. Usage of TIntermBinary constructor is cleaned up so only the constructor that takes in left and right operands is used. The type of TIntermBinary nodes is always determined automatically. Together these changes make the code considerably cleaner. Note that the code for constant folding for array indexing is actually never hit because constant folding array constructors is still intentionally disabled in the code. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ifcec45257476cdb0d495c7d72e3cf2f83388e8c5 Reviewed-on: https://chromium-review.googlesource.com/377961 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c955058b 2016-08-29T17:56:22 Constant-qualify nodes in a consistent way Rely on that constant qualification of binary and unary nodes comes from promote(). BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ie8d1d4df3c82ae5a2de8cc536e47016d13a4fd3d Reviewed-on: https://chromium-review.googlesource.com/377960 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f119a263 2016-08-19T15:54:22 Clean up unary and aggregate math folding Prefer asserts instead of adding internal errors to the compiler log when types of arguments are not as expected or the folding function runs into an operation it can't handle. Neither of these cases should be possible, the checks for correct argument types are solid at this point. In the future, when new built-in functions are added, constant folding support for them should be added as well. foldUnaryWithDifferentReturnType and foldUnaryWithSameReturnType are renamed to foldUnaryNonComponentWise and foldUnaryComponentWise respectively. These names better reflect what these functions are doing. The info sink member is removed from TIntermediate, since TDiagnostics is now passed into the functions that may generate warnings instead. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I6a08abbe29cf23f3a318032fdc46dd3dbaf4410e Reviewed-on: https://chromium-review.googlesource.com/377959 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 509e4560 2016-08-25T14:55:44 compiler: Work around a HLSL compiler aliasing opt bug. BUG=angleproject:1448 Change-Id: I7d5bcbd100069152cea0cb03bc4fa6af1044460b Reviewed-on: https://chromium-review.googlesource.com/376020 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho d5da505d 2016-08-29T13:16:55 Fix constant folding non-square outerProduct Use all the vector elements correctly when constant folding non-square outerProduct. Previously the code used to discard some elements of the smaller outerProduct operand. Also clear up confusion about matrix rows/columns in matrix constant folding code in general. BUG=angleproject:1482 TEST=angle_unittests Change-Id: I7cba8f97a92b875de01e57255d54258cdfd92a47 Reviewed-on: https://chromium-review.googlesource.com/377298 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 63e1ec5c 2016-08-18T22:05:12 Move the rest of the validation out of TIntermBinary::promote TIntermBinary::promote now has a single purpose of determining the type resulting from a binary math operation. The TIntermBinary constructor taking the left and right nodes can now also call promote automatically, and promote is made into a private member of TIntermBinary. Validation of binary math operand types is done inside ParseContext. BUG=angleproject:952 TEST=angle_unittests Change-Id: I52a409f680c8d4120b757193972d03aed34c6895 Reviewed-on: https://chromium-review.googlesource.com/372624 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1dded803 2016-08-18T18:13:13 Check multiplication validity in ParseContext This improves separation of responsibilities in the code: ParseContext should handle operand type validation, while TIntermBinary::promote should ideally only determine the type of the node based on the operation and operands. BUG=angleproject:952 TEST=angle_unittests Change-Id: I9a8d8ede21cdf35de631623a62194c0da5c604d2 Reviewed-on: https://chromium-review.googlesource.com/372622 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 3fdec919 2016-08-18T15:08:06 Refactor binary node creation 1. Simplify code by using asserts instead of adding internal errors to log. 2. Add a TIntermBinary constructor that takes left and right operand nodes as parameters. 3. Remove TIntermediate functions with trivial functionality. BUG=angleproject:952 TEST=angle_unittests Change-Id: I2e0e52160c9377d8efcf15f14fd59f01cb41bd83 Reviewed-on: https://chromium-review.googlesource.com/372720 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 3cbb27a1 2016-07-14T11:55:48 Simplify loop conditions so that they won't generate statements Introduce an AST traverser that can move the evaluation of certain types of loop conditions and loop expressions inside the loop. This way subsequent AST transformations don't have to worry about cases where they have to insert new statements to implement a loop condition or expression. This includes the revert of "Unfold short-circuiting operators in loop conditions correctly". The new traverser covers the loop cases that used to be handled in UnfoldShortCircuitToIf. BUG=angleproject:1465 TEST=WebGL conformance tests, dEQP-GLES2.functional.shaders.*select_iteration_count* Change-Id: I88e50e007e924d5884a217117690ac7fa2f96d38 Reviewed-on: https://chromium-review.googlesource.com/362570 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 03d863c8 2016-07-27T18:15:53 translator: Refactor node replacement APIs. BUG=angleproject:851 Change-Id: I50c3b3a4f00b27fed85f09509738513a441c7b5b Reviewed-on: https://chromium-review.googlesource.com/363990 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1048e43f 2016-07-23T18:51:28 D3D: Work around HLSL integer pow folding bug. BUG=angleproject:851 Change-Id: I68a47b8343a29e42c0a69ca3f2a6cb5054d03782 Reviewed-on: https://chromium-review.googlesource.com/362775 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho dcf12c70 2016-06-28T15:03:06 Fix validating non-square matrix compound multiplication The validation previously checked that two matrices in compound multiplication are the exact same size, which isn't correct for non-square matrices introduced in ESSL 3.00. Instead, check that the matrix multiplication is valid and that the resulting value has the same number of columns as the lvalue. The number of rows in the result is taken from the lvalue so it doesn't need to be checked. BUG=angleproject:1431 TEST=angle_unittests Change-Id: I6f32b7dc037d72c3c5cfdfffcda5d996e8450283 Reviewed-on: https://chromium-review.googlesource.com/356411 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4f4c11b 2016-04-15T15:11:24 Fix deferring global array initialization The initial implementation of DeferGlobalInitializers did not take HLSL corner cases into account. In particular, in case there was a const-qualified array variable with an initializer that contained elements that weren't constant folded, initialization would not be deferred and the global scope of HLSL output would contain a call to angle_construct_into_*(). On the other hand, deferring global initializers was also done in cases where it wasn't necessary. Initializers of non-const qualified array variables that could be written as HLSL literals by HLSL output were unnecessarily deferred. This patch fixes both of these issues: Now all global initializers are potential candidates for deferral instead of just those where the symbol has the EvqGlobal qualifier, and initializers that are constructors taking only constant unions as parameters are not unnecessarily deferred. BUG=angleproject:1205 BUG=541551 TEST=angle_end2end_tests Change-Id: I4027059e0e5f39c8a5a48b5c97a3fceaac6b6f8a Reviewed-on: https://chromium-review.googlesource.com/339201 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 40d9edf1 2015-11-12T17:30:34 Fix structure comparison constant folding objectSize() will return the size of all data in the structure, and simply iterating over the data will work for determining whether two structures are equal. The earlier complex and broken approach where the structure was traversed recursively is not needed. BUG=angleproject:1211 TEST=angle_unittests Change-Id: I0e5c5ccbb767d44ef6acb0f1f25f27dfc42866e1 Reviewed-on: https://chromium-review.googlesource.com/312490 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5c0e023c 2015-11-11T15:55:59 Qualify stored constant union data with const This prevents accidentally changing data that may be shared between multiple TIntermConstantUnion nodes. Besides making the code less prone to bugs in general, this will make it easier to implement constant folding of array constructors. BUG=541551 TEST=angle_unittests, WebGL conformance tests Change-Id: I4f3059f70b841d9dd0cf20fea4d37684da9cd47e Reviewed-on: https://chromium-review.googlesource.com/312440 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3fed4306 2015-11-02T12:26:02 Unfold short-circuiting operators in loop conditions correctly Sometimes short-circuiting operators need to be unfolded to if statements. If the unfolded operator is inside a loop condition or expression, it needs to be evaluated repeatedly inside the loop. Add logic to UnfoldShortCircuitToIf that can move or copy the unfolded part of loop conditions or expressions to inside the loop. The exact changes that need to be done depend on the type of the loop. For loops may require also moving the initializer to outside the loop. The unfolded expression inside a loop condition or expression is moved or copied to inside the loop on the first traversal of the loop node, and unfolding to if is deferred until a second traversal. This keeps the code relatively simple. BUG=angleproject:1167 TEST=WebGL 2 conformance tests, dEQP-GLES2.functional.shaders.*select_iteration_count* Change-Id: Ieffc0ea858186054378d387dca9aa64a5fa95137 Reviewed-on: https://chromium-review.googlesource.com/310230 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1d122789 2015-11-06T15:35:17 Fix constructor constant folding The previous solution for constant folding constructors was significantly overengineered and partially incorrect. Switch to a much simpler constructor folding function that does not use an AST traverser, but simply iterates over the constant folded parameters of the constructor and doesn't do any unnecessary checks. It also reuses some code for constant folding other built-in functions. This fixes issues with initializing constant matrices with only a single parameter. Instead of copying the first component of the constructor parameter all over the matrix, passing a vec4 or matrix argument now assigns the values correctly. BUG=angleproject:1193 TEST=angle_unittests, WebGL conformance tests Change-Id: I50b10721ea30cb15843fba892c1b1a211f1d72e5 Reviewed-on: https://chromium-review.googlesource.com/311191 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7c3848e5 2015-11-04T13:19:17 Allow constant folding some non-constant expressions This requires removing the assumption that constant folding implies constness in the constant expression sense from various places in the code. This particularly benefits ternary operators, which can now be simplified if just the condition is a compile-time constant. In the future, the groundwork that is laid here could be used to implement more aggressive constant folding of user-defined functions for example. TEST=angle_unittests BUG=angleproject:851 Change-Id: I0eede806570d56746c3dad1e01aa89a91d66013d Reviewed-on: https://chromium-review.googlesource.com/310750 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho b1edc4f5 2015-11-02T17:20:03 Accept const array initialization in shader parsing Array constructors are not folded, unlike all other constant expressions. Change initializer parsing path so that it accepts constant initializers whether they are folded or not. Some parts need to be adapted to work with expressions that are qualified as constant but that are not necessarily folded: 1. Identifier parsing 2. Indexing parsing 3. Field selection parsing 4. HLSL output for variable declarations 5. Determining unary operator result type 6. Determining binary operator result type 7. Determining built-in function call result type 8. Determining ternary operator result type Corner cases that are not supported yet: 1. Using array constructors inside case labels 2. Using array constructors inside array size expressions 3. Detecting when a negative constant expression containing an array constructor is used to index an array In these cases being able to constant fold the expression is essential to validating that the code is correct, so they require a more sophisticated solution. For now we keep the old code that rejects the shader if ANGLE hasn't been able to constant fold the case label or array size. In case of indexing an array with a negative constant expression containing an array constructor, ANGLE will simply treat it as a non-constant expression. BUG=541551 BUG=angleproject:1094 TEST=dEQP-GLES3.functional.shaders.constant_expressions.* (all pass), angle_unittests Change-Id: I0cbc47afd1651a4dece3d68acf7ec72a01fdf047 Reviewed-on: https://chromium-review.googlesource.com/310231 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 5d91dda9 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-relanding after clang warning fix. Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I9f6d7c7ecda8ac4dc3c30b39e15a9a0b5381c5a8 Reviewed-on: https://chromium-review.googlesource.com/310010 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a5f64de7 2015-10-30T12:31:00 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Failing build on Clang-win: ..\..\third_party\angle\src\compiler\translator\RemoveDynamicIndexing.cpp(128,43) : error: expected '(' for function-style cast or type construction fieldType.setPrimarySize(unsigned char(indexedType.getRows())); ~~~~~~~~ ^ BUG=angleproject:1116 This reverts commit 7535b761dd4740c8e76b888d7c58c7cbeefd2083. Change-Id: I7b502e3dcd45e17b7ed88fec18be702614d9ac65 Reviewed-on: https://chromium-review.googlesource.com/309772 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 7535b761 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I16119f9092360fb72798f9550a6f4d3cfffdc92f Reviewed-on: https://chromium-review.googlesource.com/308790 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b066669d 2015-10-26T10:38:18 Revert "Remove dynamic indexing of matrices and vectors in HLSL" This reverts commit 3766a40d6fda7e7190514ab7838a3f37169d863f. This CL was causing crashes in UniformHLSL.cpp, where an internal uniform "base" was attempted to be declared in HLSL. Was crashing on an external WebGL 3D canvas page (http://www.taccgl.org/?dbg=t). BUG=546686 Original commit message: Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I1d4b2e3888e91af7d5eebf743d12778698b6b903 Reviewed-on: https://chromium-review.googlesource.com/308770 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 3766a40d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I66a5e5a8d7f4267da0045f1cc2ba6b0dc7eb3f5d Reviewed-on: https://chromium-review.googlesource.com/296671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 80ecac9e 2015-08-25T15:37:48 Remove unused mOptimize/mDebug flags from TIntermAggregate These flags were written but they were never read. TEST=compile BUG=angleproject:1116 Change-Id: I41e3e89f13861ebda4828c76c753ca17c74c4358 Reviewed-on: https://chromium-review.googlesource.com/294931 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 3c192a78 2015-08-26T20:32:53 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Seems to be failing a WebGL/ES2 CTS test in D3D9: conformance/ogles/GL/mat3/mat3_001_to_006 BUG=angleproject:1116 BUG=525188 This reverts commit 83f3411da456faac8570892e3dd7d76edf4095e5. Change-Id: Ic186f51240dbdd96ccab3f5470329cdc9727c618 Reviewed-on: https://chromium-review.googlesource.com/295730 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 83f3411d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I024722ef4ca1e14d5ad47fdc540397e18858bed6 Reviewed-on: https://chromium-review.googlesource.com/290515 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d7a25243 2015-08-18T13:49:45 Add deep copying support for typed AST nodes Resubmit with inconsistent override warnings fixed. Removing dynamic indexing of vectors and matrices will require copying the indexed nodes in case they are written. Any type of l-value node that doesn't have side effects may need to be copied. Add a copying function for all typed node classes so that this copying can be performed. Private copy constructors are used to implement the deepCopy function in order to make maintenance easier. With copy constructors, each subclass only needs to take care of copying its own members, and not the base class members, which reduces the possibility of errors. Copy constructors are disabled for all node classes that don't support deep copying by inheriting TIntermNode from angle::NonCopyable. Assignment operator is disabled for all node classes through inheriting angle::NonCopyable. This applies also to classes that now get the private copy constructor. Explicit copy constructor and assignment operator declarations are added to some classes which show up in node member variables to make code clearer. BUG=angleproject:1116 TEST=angle_unittests Change-Id: I7964976f5dac7dfd745b8c6612ca06fb01d271c4 Reviewed-on: https://chromium-review.googlesource.com/295080 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Corentin Wallez b5d61dac 2015-08-20T13:43:02 Revert "Add deep copying support for typed AST nodes" This reverts commit d0d59aa4cbce2da92deaa0f4021dfed8885e8d01 and commit 760379532b02ae039790f1e8f1c89e03481aab4b To be fixed will be the newline at the end of IntermNode_tests.cpp and the -Winconsistent-missing-override BUG= Change-Id: I57693bdff01f9e3f03b2fbb5dc53fa21e68c2789 Reviewed-on: https://chromium-review.googlesource.com/294820 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho d0d59aa4 2015-08-18T13:49:45 Add deep copying support for typed AST nodes Removing dynamic indexing of vectors and matrices will require copying the indexed nodes in case they are written. Any type of l-value node that doesn't have side effects may need to be copied. Add a copying function for all typed node classes so that this copying can be performed. Private copy constructors are used to implement the deepCopy function in order to make maintenance easier. With copy constructors, each subclass only needs to take care of copying its own members, and not the base class members, which reduces the possibility of errors. Copy constructors are disabled for all node classes that don't support deep copying by inheriting TIntermNode from angle::NonCopyable. Assignment operator is disabled for all node classes through inheriting angle::NonCopyable. This applies also to classes that now get the private copy constructor. Explicit copy constructor and assignment operator declarations are added to some classes which show up in node member variables to make code clearer. BUG=angleproject:1116 TEST=angle_unittests Change-Id: Ia757b69397837f8309f0e7511c0cd24ca2c7a721 Reviewed-on: https://chromium-review.googlesource.com/293931 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 59f9a641 2015-08-06T20:38:26 Remove EOpInternalFunctionCall It's cleaner to mark internal functions by using the TName class, similarly to TIntermSymbol. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I12a03a3dea42b3fc571fa25a1b11d0161f24de72 Reviewed-on: https://chromium-review.googlesource.com/291621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Cooper Partin 4d61f7ed 2015-08-12T10:56:50 Reland Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' Additional warnings found with more testing and added C4267 warning disable only for angle_libpng BUG=angleproject:1120 Change-Id: Ic403dcff5a8018056fa51a8c408e64207f3362eb Reviewed-on: https://chromium-review.googlesource.com/293028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b195643c 2015-08-12T17:35:20 Revert "Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'" Seems to have quite a few warnings in 64-bit on my machine. BUG=angleproject:1120 This reverts commit c5cf9bc47d0ee028adbbf9e9f94ca567eec601dc. Change-Id: I86768b900aeba52e7a2242d9ae8949f93f1a5ba9 Reviewed-on: https://chromium-review.googlesource.com/293280 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Cooper Partin c5cf9bc4 2015-08-06T10:46:48 Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' BUG=angleproject:1120 Change-Id: I01ef10bea7f487c2b394d030c76628f38d2ea645 Reviewed-on: https://chromium-review.googlesource.com/292780 Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexis Hetu 07e57df7 2015-06-16T16:55:52 Added non square matrix construction Added new construction operations for non square matrices, along with the required changes to the related translation functions. Change-Id: I04ae7d4b2d1bb363b35d088cea45c0e7c4bc8a13 Reviewed-on: https://chromium-review.googlesource.com/277729 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Arun Patole 0c5409f8 2015-07-08T15:17:53 Support constant folding of fragment processing built-ins This change adds constant folding support for following derivative functions: - dFdx, dFdy and fwidth. As per spec, derivatives of constant arguments should be 0, so this change just sets result components to zero when the above operations are performed on constant argument. BUG=angleproject:913 TEST=dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions. fragment_processing.* (All 12 tests started passing with this change.) Change-Id: I67b7c5abd970b740e15e3bd1ee56721e81bbecc4 Reviewed-on: https://chromium-review.googlesource.com/283759 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 551279e5 2015-07-07T18:18:23 Support constant folding of more common built-ins This change adds const folding support for below mentioned common built-ins: - isnan, ininf, floatBitsToInt, floatBitsToUint, intBitsToFloat and uintBitsToFloat BUG=angleproject:913 TEST=angle_unittests(new: MathUtilTest.isNan/inInf), dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.* (20 more tests started passing with this change) Change-Id: Ifdedb251cd8b183b4999314c0f5de857bc20702f Reviewed-on: https://chromium-review.googlesource.com/283767 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole ab2b9a23 2015-07-06T18:27:56 Refactor unary operation constant folding code This change splits TIntermConstantUnion::foldUnary into two functions: - foldUnaryWithDifferentReturnType: - Handles constant folding of operations where the return type has a different number of components compared to the operand type. - foldUnaryWithSameReturnType: - Handles constant folding of unary operations where the return type is the same as operand type. BUG=angleproject:913 TEST=angle_unittests, dEQP Tests (dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.*) Change-Id: I675891138d4e17fd2390c03e9f710e0be0b7c7b6 Reviewed-on: https://chromium-review.googlesource.com/283464 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole cdfa8f50 2015-06-30T17:48:25 Constant fold float pack/unpack functions This change adds constant folding support for following floating point pack and unpack functions: - packSnorm2x16, unpackSnorm2x16, packUnorm2x16, unpackUnorm2x16, packHalf2x16, and unpackHalf2x16. BUG=angleproject:913 TEST=angle_unittests(new: MathUtilTest.packAndUnpack*), dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.float_pack_unpack.* (all 10 tests started passing with this change) Change-Id: I2b69faebee4127e5e13900b3a9485b7145950277 Reviewed-on: https://chromium-review.googlesource.com/282683 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 7fa3355f 2015-06-10T15:15:18 Add constant folding support for matrix built-ins This change adds constant folding support for following matrix built-ins: - matrixCompMult, outerProduct, transpose, determinant and inverse. BUG=angleproject:913 TEST=angle_unittests(new: MatrixUtilsTest, ConstantFoldingTest.*Matrix*), dEQP Tests: dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.matrix.* (All 54 tests started passing with this change) Change-Id: I7b9bf04b9a2cbff72c48216cab04df58c5f008d6 Reviewed-on: https://chromium-review.googlesource.com/276574 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho a4aa4e30 2015-06-04T15:54:30 Record precision of constant variables when needed Add a traverser that checks precision qualifiers of folded constants and hoists them to separate precision qualified variables if needed. Fixes sdk/tests/conformance/glsl/bugs/constant-precision-qualifier.html TEST=WebGL conformance tests, angle_unittests BUG=angleproject:817 Change-Id: I1639595e0e49470736be93274f0af07ee732e1fe Reviewed-on: https://chromium-review.googlesource.com/275095 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho b43846ee 2015-06-02T18:18:57 Unify aggregate operator folding with other constant folding Setting the type for folded aggregate nodes should work in a similar way as other constant folding. Common functionality between the different folding functions is refactored into a single function. TEST=dEQP-GLES3.functional.shaders.constant_expressions.* BUG=angleproject:817 Change-Id: Ie0be561f4a30e52e52d570ff0b2bdb426f6e4f7a Reviewed-on: https://chromium-review.googlesource.com/275186 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 95310b00 2015-06-02T17:43:38 Unify unary operator folding with binary operator folding Implement unary operator folding in a similar way to binary operator folding, so that the code is easier to understand. TEST=dEQP-GLES3.functional.shaders.constant_expressions.* BUG=angleproject:817 Change-Id: I069bdb38f965e1badb3e8f3f954386b205b7bb00 Reviewed-on: https://chromium-review.googlesource.com/275185 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 2c4b746c 2015-06-08T11:30:31 Revert "Revert "Make sure type gets set consistently in folded binary operations"" This patch was originally reverted only because a dependency patch failed a buggy Chromium test. This reverts commit aebd002d00d39858819c58bad1970df121b78e1b. TEST=dEQP-GLES3.functional.shaders.constant_expressions.* BUG=angleproject:817 Change-Id: Ia5acf15518ea89717c0cfe1398cb18ea27be5b19 Reviewed-on: https://chromium-review.googlesource.com/275811 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 1155ddd2 2015-06-05T18:04:36 Revert "Revert "Add constant folding support for geometric built-ins"" Revert of revert as the issue is with the failing test itself. This reverts commit b3da45c12d3eecdd319c0feb4d2b933e144f816a. Change-Id: Ie2003c78527f87cad7f8ead0d87fee75ce032379 Reviewed-on: https://chromium-review.googlesource.com/275487 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill b3da45c1 2015-06-04T19:38:22 Revert "Add constant folding support for geometric built-ins" This is failing gpu_unittests on Mac: ShaderTranslatorTest.BuiltInFunctionEmulation: ../../gpu/command_buffer/service/shader_translator_unittest.cc:314: Failure Value of: strstr(translated_source.c_str(), "webgl_dot_emu") != NULL Actual: false Expected: true Reverting until we can fix the overly-narrow test. BUG=angleproject:913 This reverts commit b50788d11dec046415565af1cc7da334e2979577. Change-Id: I5bd9df83704e771e419339745eceaa43a20bd1e6 Reviewed-on: https://chromium-review.googlesource.com/275320 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill aebd002d 2015-06-04T19:43:44 Revert "Make sure type gets set consistently in folded binary operations" This is blocking the revert of the geometric constant folding patch, which is breaking gpu_unittests and blocking the roll. BUG=angleproject:817 This reverts commit b07aba0798d3bba3118dac78933e73b3f08a601b. Change-Id: Ia00fc45b1ddd9d3c079742dea0627aa12304f93b Reviewed-on: https://chromium-review.googlesource.com/275321 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b07aba07 2015-05-29T12:19:19 Make sure type gets set consistently in folded binary operations Add a wrapper function that handles creating the folded node and setting the right parameters on it, so that the folding function handles only calculating the folded values. This will fix the precision set to constant folded values in some cases. Previously the precision was always set to be equal to one of the operands to the binary operation, but now both operands are taken into account. Folding binary operations is now in a separate function from folding unary operations. TEST=dEQP-GLES3.functional.shaders.constant_expressions.* BUG=angleproject:817 Change-Id: Id97e765173c6110f49607e21c3fb90019b1ebac7 Reviewed-on: https://chromium-review.googlesource.com/274001 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole b50788d1 2015-05-25T19:20:26 Add constant folding support for geometric built-ins * re-land after mac compilation fix (unsupported c++11 initializer) * This change adds constant folding support for following geometric built-ins: - length, distance, dot, cross, normalize, faceforward, reflect and refract. BUG=angleproject:913 TEST=angle_unittests, dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.geometric.* (56 tests started passing with this change) Change-Id: I236fc0c1af47a63f359564500c711e6bedf1c808 Reviewed-on: https://chromium-review.googlesource.com/274789 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8f76bcc4 2015-06-02T13:54:20 Add unit test for RemovePow Add two versions of the test - one with a single pow(), and another with a nested pow(). TEST=angle_unittests BUG=477306 Change-Id: Idb38e57a4b2522b7794996d6ea0f0456b349abf7 Reviewed-on: https://chromium-review.googlesource.com/274736 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 2f4823bf 2015-06-03T12:39:22 Revert "Add constant folding support for geometric built-ins" Breaks Mac build because of C++11 init syntax: FAILED: /b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/angle/src/tests/compiler_tests/angle_unittests.ConstantFolding_test.o.d -DV8_DEPRECATION_WARNINGS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=238013-3 -DCOMPONENT_BUILD -DTOOLKIT_VIEWS=1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DGTEST_HAS_POSIX_RE=0 -DGTEST_LANG_CXX11=0 -DGL_APICALL= -DGL_GLEXT_PROTOTYPES= -DEGLAPI= '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ "d3dcompiler_47.dll", "d3dcompiler_46.dll", "d3dcompiler_43.dll" }' -DANGLE_TRANSLATOR_STATIC -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -Igen -I../.. -I../../third_party/angle/include -I../../third_party/angle/src -I../../third_party/angle/src/compiler/preprocessor -I../../third_party/angle/src/tests -Igen/angle -I../../testing/gmock/include -I../../testing/gtest/include -isysroot /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -O0 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -mmacosx-version-min=10.6 -arch x86_64 -Wall -Wendif-labels -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-selector-type-mismatch -Wpartial-availability -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -std=c++11 -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load -Xclang /b/build/slave/GPU_Mac_Builder__dbg_/build/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics -fno-strict-aliasing -fstack-protector-all -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -c ../../third_party/angle/src/tests/compiler_tests/ConstantFolding_test.cpp -o obj/third_party/angle/src/tests/compiler_tests/angle_unittests.ConstantFolding_test.o ../../third_party/angle/src/tests/compiler_tests/ConstantFolding_test.cpp:210:43: error: no matching constructor for initialization of 'std::vector<float>' ASSERT_FALSE(constantVectorFoundInAST(std::vector<float>{1.0f, 1.0f, 1.0f})); ^ ~~~~~~~~~~~~~~~~~~ BUG=angleproject:913 This reverts commit 2decb4b1557a57a5a74e3ab98d8b25f9fc0f8557. Change-Id: Iaf3c61a0c0ed591c17f50f2e3eafe2debf588c95 Reviewed-on: https://chromium-review.googlesource.com/274917 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 2decb4b1 2015-05-25T19:20:26 Add constant folding support for geometric built-ins This change adds constant folding support for following geometric built-ins: - length, distance, dot, cross, normalize, faceforward, reflect and refract. BUG=angleproject:913 TEST=angle_unittests, dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.geometric.* (56 tests started passing with this change) Change-Id: I973689554bb8c30ee3ebdf71f1b8a051ceb5e0cf Reviewed-on: https://chromium-review.googlesource.com/273097 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole 9d0b1f9b 2015-05-20T14:27:17 Constant fold vector relational built-ins This change adds constant folding support for vector relational built-ins. BUG=angleproject:913 TEST=dEQP Tests dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.vector_relational* (Fixes all 138 tests) Change-Id: I291e332f2afb3ce3d6596e634f509995dbf35164 Reviewed-on: https://chromium-review.googlesource.com/272344 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 081c3f2e 2015-05-25T15:43:35 Report warning whenever constant folding results are undefined With recent constant folding changes, we are reporting warnings whenever constant folding results are undefined for values passed in, this change adds that warning at all the places where it was missing. BUG=angleproject:913 TEST=dEQP Tests, angle_unittests Change-Id: Ief8380488e2a4807c91ddac06d342cb172433b9d Reviewed-on: https://chromium-review.googlesource.com/272879 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4f303ee 2015-05-20T17:09:06 Refactoring: Make creating temporary symbols in AST traversal reusable Temporary symbols will also be needed to store temporary arrays when complex array expressions are unfolded. Also clear tree update related structures at the end of updateTree(), so that the traverser can be reused for several rounds of replacement more easily, and remove unnecessary InVisit step from UnfoldShortCircuitToIf. BUG=angleproject:971 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: Iecdd3008d43f01b02fe344ccde8614f70e6c0c65 Reviewed-on: https://chromium-review.googlesource.com/272121 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Arun Patole bf790420 2015-05-18T17:53:04 Add constant folding support for more built-ins This change adds constant folding support for following built-ins: - atan(two arguments), pow, mod, mix, step and smoothstep. BUG=angleproject:913 TEST=dEQP tests Following 80 tests from dEQP-GLES3.functional.shaders.constant_expressions started passing with this change: - builtin_functions.angle_and_trigonometry.atan_separate* - builtin_functions.exponential.pow_* - builtin_functions.common.mod_* - builtin_functions.common.mix_* - builtin_functions.common.step_* - builtin_functions.common.smoothstep_* Change-Id: I70f0a8837a82c480da8cff3f1382c6252a486fe4 Reviewed-on: https://chromium-review.googlesource.com/271753 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-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>
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>