src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp


Log

Author Commit Date CI Message
Clemen Deng d7d42540 2019-08-21T15:22:49 Don't build symbol table for GLSL built-ins if on Android The GLSL + ESSL autogenerated symbol table is too large for android, and android also doesn't need desktop GL functionality If on android, compile the ESSL only symbol table Bug: chromium:996286 Change-Id: I14dfc7748dae389e78c35f82a390c67962665356 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1757372 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis f563fdc9 2019-01-31T13:53:59 Reland "Fix unit test for setting locale creating malformed HLSL shader code Fix malformed HLSL shader code in other locales than classic" This is a reland of 5f662c0042703344eb0eef6d1c123e902e3aefbf Original change's description: > Fix unit test for setting locale creating malformed HLSL shader code > Fix malformed HLSL shader code in other locales than classic > > Bug: angleproject:1433 > Change-Id: I30bad0bd0cfda465ec7200e48e12800d7d8efd26 > Reviewed-on: https://chromium-review.googlesource.com/c/1447862 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Bug: angleproject:1433 Change-Id: I94caf7b4c7179119e5a5567c3014d7232df45a13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1516192 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Jonah Ryan-Davis 1d35d511 2019-02-15T15:39:27 Revert "Fix unit test for setting locale creating malformed HLSL shader code" This reverts commit 5f662c0042703344eb0eef6d1c123e902e3aefbf. Reason for revert: Some recent crashes related to streams, could be related to this change. https://bugs.chromium.org/p/chromium/issues/detail?id=932359 Original change's description: > Fix unit test for setting locale creating malformed HLSL shader code > Fix malformed HLSL shader code in other locales than classic > > Bug: angleproject:1433 > Change-Id: I30bad0bd0cfda465ec7200e48e12800d7d8efd26 > Reviewed-on: https://chromium-review.googlesource.com/c/1447862 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> TBR=geofflang@chromium.org,jmadill@chromium.org,jonahr@google.com Bug: angleproject:1433 Change-Id: I28caa073b3996a95f3f233bed9dc91dc44263835 Reviewed-on: https://chromium-review.googlesource.com/c/1474624 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jonah Ryan-Davis 5f662c00 2019-01-31T13:53:59 Fix unit test for setting locale creating malformed HLSL shader code Fix malformed HLSL shader code in other locales than classic Bug: angleproject:1433 Change-Id: I30bad0bd0cfda465ec7200e48e12800d7d8efd26 Reviewed-on: https://chromium-review.googlesource.com/c/1447862 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Olli Etuaho 5fec7ab2 2018-04-04T11:58:33 Identify functions by unique id in BuiltInFunctionEmulator Now that unique ids of all builtins are compile-time constants, we can use them to look up functions in BuiltInFunctionEmulator. This is simpler than using a custom struct with the name and parameters for identifying functions. This requires that we store a reference to a TFunction in those TIntermUnary nodes that were created based on a function. This decreases shader_translator binary size by about 6 KB on Windows. BUG=angleproject:2267 BUG=chromium:823856 TEST=angle_unittests Change-Id: Idd5a00c772c6f26dd36fdbbfbe161d22ab27c2fe Reviewed-on: https://chromium-review.googlesource.com/995372 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f7f0b8c3 2018-02-21T20:02:23 Rename operator enums so they can be autogenerated Camel casing is removed from the enums where it differs from the GLSL spec. This way it's easier to autogenerate code for built-in functions mapped to operators. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2490d5d0e8ffb45eba343f225f76779e63381a65 Reviewed-on: https://chromium-review.googlesource.com/929361 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Kai Ninomiya 614dd0f5 2017-11-22T14:04:48 Replace TCache with static TType instances Replaces TCache with (static generation + static/dynamic lookups) of TType instances, using compile-time template and constexpr magic. Work started by jmadill here: https://crrev.com/c/776280 With more contributions from jmadill here: https://crrev.com/c/801494 Bug: angleproject:1432 Change-Id: I07181543f8fee4b2606cdd2d0738351e83d4ce57 Reviewed-on: https://chromium-review.googlesource.com/786317 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho c634a637 2017-05-18T14:09:49 Remove webgl_ prefix from emulated function names The prefix is unnecessary now that user-defined names are prefixed in both GLSL and HLSL output. Removing the prefix makes compiler output a bit simpler to read. BUG=angleproject:2038 TEST=angle_unittests Change-Id: I9ffc508f50d6146a2d85798875c88e2c385b83fe Reviewed-on: https://chromium-review.googlesource.com/508730 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho da9fb093 2016-12-09T17:32:29 Work around atan(y, x) bug on NVIDIA atan(y, x) is not always returning expected results on NVIDIA OpenGL drivers between versions 367 and 375. Work around this by emulating atan(y, x) using the regular atan(x) function. A fix to the driver is expected in a future release. It is most convenient to implement the vector atan(y, x) functions by using the scalar atan(y, x) function. Support for simple dependencies between emulated functions is added to BuiltInFunctionEmulator. In the current implementation one function is allowed to have at most one other function as its dependency. BUG=chromium:672380 TEST=angle_end2end_tests Change-Id: I9eba8b0b7979c7c7eaed353b264932e41830beb1 Reviewed-on: https://chromium-review.googlesource.com/419016 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 45bcc784 2016-11-07T13:58:48 translator: Scope all classes with "sh". I was seeing an odd problem with our PoolAlloc conflicting with the glslang/Vulkan TIntermNode, so the fix was to move everything to a separate namespace. The bison grammars are also regenerated. No functional changes. BUG=angleproject:1576 Change-Id: I959c7afe4c092f0d458432c07b4dcee4d39513f3 Reviewed-on: https://chromium-review.googlesource.com/408267 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shao 6f0a0dca 2016-09-27T13:51:29 Workaround isnan() on Intel drivers On some Intel drivers, calling function isnan() on highp float will get wrong answer. This patch work arounds this bug by using an expression to emulate this function. BUG=chromium:650547 Change-Id: I5bc5e0352c434f42cd2c55103a74f9f7ba51a72c Reviewed-on: https://chromium-review.googlesource.com/389834 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qiankun Miao 5b55edd8 2016-09-05T14:55:15 Work around unpackHalf2x16 emulation for Intel Mac Negative operator is buggy in an expression on Intel Mac. Use abs(v) to replace -v for negative value. BUG=chromium:644057 TEST=deqp/functional/gles3/shaderpackingfunction.html Change-Id: I6182e7a00b162e36ed9278c0e5a2fdd8fb480959 Reviewed-on: https://chromium-review.googlesource.com/381152 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qiankun Miao e5bb72ff 2016-09-01T01:41:27 Remove SH_EMULATE_BUILT_IN_FUNCTIONS which isn't used The flag is not used in chrome. We decide to do per emulation per flag. BUG=chromium:642227 Change-Id: I936d53e5015186e35e672d0cb51c853a941582d2 Reviewed-on: https://chromium-review.googlesource.com/379077 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qiankun Miao a4e6f074 2016-08-29T14:49:21 Work around abs() issue in Intel Mac drivers abs(i) where i is an integer returns unexpected result in Intel Mac. This works around the issue by emulating abs(i) manually. BUG=chromium:642227 TEST=deqp/functional/gles3/shadercommonfunction.html Change-Id: I2a41e0f4bcb0766109d651e663283b1760468017 Reviewed-on: https://chromium-review.googlesource.com/377628 Commit-Queue: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Geoff Lang 91d56945 2015-07-21T18:56:48 Emulate the pack/unpack functions for unorms. BUG=angleproject:1044 Change-Id: I2cfb792de43d3a6fddd750100c74f948948dc1f6 Reviewed-on: https://chromium-review.googlesource.com/287290 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 91dbc188 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. reland: use the defined preprocessor function. BUG=angleproject:1044 Change-Id: I6171708a2d55ec085ba2c598a1a863779842da6c Reviewed-on: https://chromium-review.googlesource.com/311270 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e7fcf1e3 2015-11-05T21:23:53 Revert "Enable needed extensions in generated GLSL shaders and call them when possible." This reverts commit 233b334213c1a4853e81f71ba90aa223b2a68dce. Change-Id: Id99024b736324ad030ce63c5d0baae32b6d7f54b Reviewed-on: https://chromium-review.googlesource.com/311181 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 233b3342 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. BUG=angleproject:1044 Change-Id: Ife94d2258fb912974aa97484a0e30f289dd96734 Reviewed-on: https://chromium-review.googlesource.com/278324 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 01c796ac 2015-07-21T18:53:58 Revert "Emulate the pack/unpack functions for unorms." Causing MSAN failures on Linux. This reverts commit 1915652ee82109d7756dc8349562c3c11ea39b77. Change-Id: Ib23bec16eab22288930be0b41186e54cd8d1f921 Reviewed-on: https://chromium-review.googlesource.com/287127 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 8b6587a7 2015-07-20T14:16:59 Use the type cache for the types used in the emulated GLSL functions. BUG=angleproject:1044 Change-Id: I7c4bde80448b2cd64921b809a3a0dfb37c4e0f47 Reviewed-on: https://chromium-review.googlesource.com/286643 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 1915652e 2015-06-18T09:40:14 Emulate the pack/unpack functions for unorms. BUG=angleproject:1044 Change-Id: I0e7bee366398159ae6b87a820f36cb51c05cb064 Reviewed-on: https://chromium-review.googlesource.com/280362 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 8273e006 2015-06-15T13:40:19 Add new GLSL target versions. Test the emulated GLSL functions against multiple GL versions. BUG=angleproject:1044 Change-Id: I1e12523301042f0d541ab2f4e73f02319d1584ef Reviewed-on: https://chromium-review.googlesource.com/277702 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e148f3d3 2015-06-17T11:41:28 Fix lots of compilation errors in generated GLSL functions. Reformatted to improve readability. BUG=angleproject:angleproject:947 Change-Id: I467f0396a0318b7a51d5cafce3f11e55d929c369 Reviewed-on: https://chromium-review.googlesource.com/278250 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 7b9b284b 2015-06-15T11:02:49 Refactor GLSL version calculations for emulated functions. Pass the target GLSL version to InitBuiltInFunctionEmulatorForGLSL so that it can be updated to generate emulated functions for multiple versions. BUG=angleproject:1044 Change-Id: I34c408df52fd0f7d6c2f66d0579ac854afd93b87 Reviewed-on: https://chromium-review.googlesource.com/277700 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 34482831 2015-06-10T15:16:07 Add missing newlines to BuiltInFunctionEmulatorGLSL.cpp and Pack_Unpack_test.cpp. BUG=angleproject:947 Change-Id: I8cbcd99e8c2cb7c461b0c624596631a4dec6dcc8 Reviewed-on: https://chromium-review.googlesource.com/276668 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Qingqing Deng 03f3caec 2015-03-16T02:01:21 Emulate Missing pack_unpack functions from OpenGL 4.1 BUG=angleproject:947 TEST=angle_unittests, angle_end2end_tests Change-Id: Id1afd7630d9720b6701225b7abf1ce4a3bf528b6 Reviewed-on: https://chromium-review.googlesource.com/260232 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 950457b3 2015-05-26T14:36:59 Fix destructing TStrings through BuiltInFunctionEmulator after free BuiltInFunctionEmulator gets destructed after the PoolAllocator has already freed memory. That's why BuiltInFunctionEmulator can't hold any objects that contain parts stored in the memory pool that would be accessed in its destructor. Use only pointers to TType objects inside BuiltInFunctionEmulator, so that the BuiltInFunctionEmulator destructor doesn't access TStrings which have data in the memory pool. Also fix style issues in BuiltInFunctionEmulator. BUG=angleproject:1010 TEST=dEQP-GLES3.functional.shaders.builtin_functions.* Change-Id: Ic35caf80bf125d0427c2ed2024e98657756103b6 Reviewed-on: https://chromium-review.googlesource.com/272738 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 51585037 2015-03-05T19:40:42 Remove unnecessary ifdef APPLE from built-in emulation The emulation is already toggled by a compilation flag, so having it behind an ifdef only adds unnecessary complexity, particularly when testing changes to the emulation code. BUG=angleproject:865 Change-Id: Idf7854c2b5323609880b527ed806440dcc8ac091 Reviewed-on: https://chromium-review.googlesource.com/256365 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 8efc5ad5 2015-03-03T17:21:10 Initialize BuiltInFunctionEmulator outside Compiler This moves GLSL output specific code from the Compiler class to the GLSL/ESSL translators. BUG=angleproject:865 Change-Id: I2d552e9cdb41f7d8ddfee7b0249a99d629a6d7d7 Reviewed-on: https://chromium-review.googlesource.com/255471 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 95cd3c68 2015-03-03T16:45:32 Move some output out of BuiltInFunctionEmulator subclasses This paves the way for getting rid of the BuiltInFunctionEmulator subclasses in favor of initializing the BuiltInFunctionEmulator dynamically in Compiler subclasses. The eventual goal is getting rid of GLSL output specific functionality in Compiler, which should be language-agnostic. BUG=angle:865 Change-Id: Ibb114b905785c7343b2726c97699268c982536a0 Reviewed-on: https://chromium-review.googlesource.com/255470 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 80a5a6c6 2015-01-12T15:35:27 Clean up BuiltInFunctionEmulator public interface This removes all language-specific bits from BuiltInFunctionEmulator parent class, and makes the public interface of BuiltInFunctionEmulator minimal. Writing comments around emulated function definitions is removed from OutputHLSL, they are not necessary as the emulated function definitions are just another part of the shader header. Change-Id: I9abf57d86f4e37b0674d7dfafe653298f205dd27 Reviewed-on: https://chromium-review.googlesource.com/240230 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f6bdb312 2015-01-09T15:21:38 Refactor defining emulated functions in BuiltInFunctionEmulator This removes the fixed enumeration of emulated functions in favor of a dynamic map. This makes the code more compact and flexible. The main benefit is that maintaining the list emulated functions is a lot simpler now. Change-Id: Ic9951a496b9f021c76ad5b4c3daccd89af5ac093 Reviewed-on: https://chromium-review.googlesource.com/239871 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Olli Etuaho 5c9cd3d1 2014-12-18T13:04:25 Implement hyperbolic function support for ESSL 3.00 Emulating arc hyperbolic functions is required on HLSL, where they do not exist natively. For this, BuiltInFunctionEmulator is split into GLSL and HLSL subclasses. The GLSL subclass handles the pre-existing built-in emulation implemented for working around OSX bugs, and the HLSL subclass handles emulating asinh, acosh and atanh on HLSL. BUG=angle:855 Change-Id: I0dfeffb862ac27ba7f9ecf5492ec31d9d952b273 Reviewed-on: https://chromium-review.googlesource.com/236861 Reviewed-by: Nicolas Capens <capn@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>