src/compiler/translator/Symbol.cpp


Log

Author Commit Date CI Message
James Dong 1d5aaa6c 2019-08-06T11:20:13 Vulkan: support dynamic indices in array of arrays Expands existing struct-sampler rewrite to flatten arrays of arrays. This allows us to support dynamically-uniform array indexing, which is core in ES 3.2. Samplers inside (possibly nested) structs are broken apart as before, and then if the type resulting from merging the array sizes of the field and its containing structs is an array of array, the array is flattened. Also adds an offset parameter to functions taking in arrays to account for this translation. As a result of outer array sizes leaking into function signatures, functions taking arrays of different sizes are duplicated according to how the function is invoked. Bug: angleproject:3604 Change-Id: Ic9373fd12a38f19bd811eac92e281055a63c1901 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744177 Commit-Queue: James Dong <dongja@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
Brandon Jones 4a22f4b0 2018-10-23T14:36:47 ES31: Add atomic_uint support to HLSL translator This is the first commit in a series to enable atomic counter buffers. Adds support for atomic counters to the GLSL->HLSL translator using RWByteAddressBuffer. Bug: angleproject:1729 Test: angle_end2end_tests Change-Id: I3b7e08f9256dc9bdbcc02ad8910040f2bc14aeac Reviewed-on: https://chromium-review.googlesource.com/c/1291329 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 84c11c53 2018-07-11T10:12:39 Vulkan: Implement sampler structs as function args. Bug: angleproject:2494 Change-Id: Ia8e374846427b7140ab2565ae5b9b18409a76d96 Reviewed-on: https://chromium-review.googlesource.com/1117323 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill b779b12c 2018-06-20T11:46:43 Add kEmptyImmutableString. We can use this instead of ImmutableString(""). Bug: angleproject:2665 Change-Id: I8b3d5d3075838b9f2caa1627071202e48a5fdc83 Reviewed-on: https://chromium-review.googlesource.com/1108085 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill e033999e 2018-06-20T11:46:40 Vulkan: Add struct sampler parsing. Vulkan requires all uniforms to be declared in a block. Uniform blocks can't have store samplers. Thus we can't use structs in samplers with Vulkan GLSL. To work around this limitation we extract samplers from structs and move them into standalone types. The samplers are named according to the variable and struct fields. Arrays of structs and nested structs to come later. Bug: angleproject:2494 Change-Id: I83a94ab082c6ce7ee68ec1290751ecee18820683 Reviewed-on: https://chromium-review.googlesource.com/1101567 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8073a951 2018-05-09T16:41:39 Enable warning for non-virtual destructors Virtual functions are removed from TSymbol, so the warning for non-virtual destructor found in a class with virtual functions can be enabled. BUG=angleproject:2417 TEST=angle_unittests Change-Id: Icd0ea2c77ce826739fbe954137f8ee78e6ef5386 Reviewed-on: https://chromium-review.googlesource.com/1051830 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 40b1c770 2018-03-19T10:29:37 Fix asserts related to writing nameless parameters in HLSL We rely on TSymbol::name() to generate names also for nameless parameters. Fix asserts to reflect this. BUG=chromium:823041 TEST=angle_unittests Change-Id: Ie9b8253a150e79965bf85d8a7f36643ada6c54cc Reviewed-on: https://chromium-review.googlesource.com/968242 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4bd963f 2018-03-08T16:32:44 Don't use TIntermSymbol nodes for function parameters Parameter nodes are not needed - it's simpler to just create a TVariable object for each parameter when the TFunction is initialized. With this change we also store only one object per each parameter type used in built-in functions, instead of one array of TConstParameter entries for each unique parameter sequence. This simplifies code and reduces binary size and compiler memory use. Compiler perf does not seem to be significantly affected. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2b82400dd594731074309f92a705e75135a4c82c Reviewed-on: https://chromium-review.googlesource.com/955589 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 391bda23 2018-02-23T11:43:14 Generate code for initializing built-in variables gen_builtin_symbols.py now generates code for initializing built-in variable symbols as well. Some of the variable symbols are static, but some of them also get initialized dynamically based on values in ShBuiltInResources. The static symbols have get functions in a header file so they can be referenced from AST traversers as well without doing a lookup. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: Ida7f3aeb06d2bce0f737f1483b1bd5833aeddd2e Reviewed-on: https://chromium-review.googlesource.com/911768 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 140152e7 2018-02-08T14:46:44 Statically allocate built-in function symbols A script gen_builtin_symbols.py now generates code for initializing built-in function symbols. The TFunction objects are initialized at C++ compile time. The source file used for the functions is in a format that's similar to how functions are given out in the GLSL spec, so it is easy to maintain. The function symbols are still inserted to the symbol table levels same as before. Getting rid of inserting the symbols at runtime is intended to be done as follow-up. This speeds up angle_unittests on Linux in release mode by a bit less than half, and in debug mode by more than half. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I11c9de98c74d28e7e8cdf024516e2f6ee30ca33e Reviewed-on: https://chromium-review.googlesource.com/924155 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 029e8ca7 2018-02-16T14:06:49 Add a constexpr constructor for TFunction Access to TFunction parameters is now handled through two new members: a pointer to a parameter array and a parameter count. There's still also a vector pointer in TFunction for adding function parameters one by one. This is used when parsing user-defined functions. TEST=angle_unittests BUG=angleproject:2267 Change-Id: I86987ae56b7cf37f010d0651e9861789050aec2b Reviewed-on: https://chromium-review.googlesource.com/923987 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7b17fa18 2018-01-29T11:12:57 Add a constexpr constructor for TVariable BUG=angleproject:2267 TEST=angle_unittests Change-Id: I9b7e01801caa7235ac5e2d4212ea92e38c1f774d Reviewed-on: https://chromium-review.googlesource.com/908752 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 95ed1947 2018-02-01T14:01:19 Add a class for function lookups Using a purpose-built class for function lookups instead of using a combination of TFunction and a struct container for the this node and arguments makes the code clearer. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I3f345d836abeaa7f84cc46b4b840fd06c7e2e1a7 Reviewed-on: https://chromium-review.googlesource.com/897363 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 68981eb5 2018-01-23T17:46:12 Track parameter qualifiers of functions in call nodes We now add a reference to TFunction to all TIntermAggregate nodes where it is possible, including built-in ops. We also make sure that internal TFunctions added in traversers have correct parameter qualifiers. This makes TLValueTrackingTraverser much simpler. Instead of storing traversed functions or looking up builtin functions from the symbol table, determining which function parameters are out parameters can now be done simply by looking it up from the function symbol associated with the aggregate node. Symbol instances are no longer deleted when a symbol table level goes out of scope, and TFunction destructor no longer clears the parameters. They're all either statically allocated or pool allocated, so this does not result in leaks. TEST=angle_unittests BUG=angleproject:2267 Change-Id: I57e5570da5b5a69a98a8778da3c2dc82b6284738 Reviewed-on: https://chromium-review.googlesource.com/881324 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b60d30f7 2018-01-16T12:31:06 Make TVariable type immutable This enables using constexpr types for built-in variables and some of the variables created in AST transformations. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ie85b3c9872a071a7c023ced013b14ad91cff7cee Reviewed-on: https://chromium-review.googlesource.com/868134 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho bbd9d4c6 2017-12-21T12:02:00 Use TVariable instead of TIntermSymbol for variables This removes unnecessary indirection. It's easier to just create TVariables in createSamplerSymbols, and to track referenced variables using TVariable pointers instead of TIntermSymbol pointers. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: Id1e75e04da084eb9026f581f22070b27a45615ba Reviewed-on: https://chromium-review.googlesource.com/839442 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8b5e8fdb 2017-12-15T14:59:15 Replace remaining usage of TName with TSymbol TName used to contain just a subset of the information stored in TSymbol. It makes more sense to use TSymbol directly instead of converting it to TName. This also improves type safety a bit by making some functions only take in TVariable or TFunction instead of the more generic TName. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Icb46923c25d33ebbbbc06ddc487da25957dda771 Reviewed-on: https://chromium-review.googlesource.com/829143 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho bed35d76 2017-12-20T16:36:26 Don't query names of empty symbols This makes it possible to return a reference from TSymbol::name() instead of a pointer. This is safer since it completely avoids the possibility of a nullptr dereference. An assert is making sure that the function is not being called for empty symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I44279f65989dbb828322843fc0216ba84d91dedf Reviewed-on: https://chromium-review.googlesource.com/836894 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1bb8528c 2017-12-14T13:39:53 Remove TFunctionSymbolInfo from TIntermAggregate All the information stored in TFunctionSymbolInfo was duplicated from the TFunction that the aggregate node pointed to. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I1f5574ab0416e5cae00c3dae6fc11d2fe1fa128c Reviewed-on: https://chromium-review.googlesource.com/827065 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 0c37100d 2017-12-13T17:00:25 Always create TFunctions for function call nodes This simplifies code and ensures that nodes get consistent data. In the future function call nodes could have a pointer to the TFunction instead of converting the same information into a different data structure. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: Ic0c24bb86b44b9bcc4a5da7f6b03701081a3af5c Reviewed-on: https://chromium-review.googlesource.com/824606 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4529f30 2017-12-12T13:06:40 Define symbol classes in a separate file The plan is to use symbols more also outside the symbol table, so it makes sense to define the symbol classes in a separate header file. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I94167415ef43ba9bd9126ca32d9c498e1437f3f8 Reviewed-on: https://chromium-review.googlesource.com/822414 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>