src/compiler/translator/IntermNode.cpp


Log

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