|
56db3789
|
2019-08-01T17:09:53
|
|
Use flat arrays instead of switches for function lookups
Current implementation of built in function lookup uses
autogenerated switch statements. Instead, use the perfect
hash mapping to have the lookup use arrays instead. This
will improve runtime performance.
Bug: angleproject:3805
Change-Id: I6d0ba62d79abd53a7fe818fe675282800781f256
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1756883
Commit-Queue: Clemen Deng <clemendeng@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
|
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>
|
|
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>
|
|
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>
|
|
89398b65
|
2018-03-21T17:30:50
|
|
Avoid mangled name comparisons of 3-parameter functions
The hash values used for looking up built-ins now encode whether the
mangled name contains arrays, structs or interface blocks in its
parameters list. This is written in the most significant bit of the
hash value.
We check this bit at the start of built-in lookup and if the bit is
set we exit early. After that we know that the lookup name doesn't
contain array, struct or interface block parameters.
When we find a hash that matches a hash of a built-in function, we now
know 3 things:
1) the length of the mangled name matches
2) the open parentheses in the mangled name matches
3) the lookup doesn't contain array, struct or block parameters.
Additionally, we have an if statement checking whether the function
name matches. Collisions are only possible with functions that
1) have the same name
2) have the same number of parameters
With these preconditions we can check beforehand whether collisions
are possible for 3-parameter functions. If there are no collisions, we
don't need to compare the full mangled name. This is similar to what
was already being done with functions that had 0 to 2 parameters.
This reduces shader_translator binary size by around 4 KB on Windows.
Besides increased complexity, the tradeoff is that an exhaustive
search of hash values for possible 3-parameter combinations is costly,
so the gen_builtin_functions.py code generation script now takes
around one minute to run on a high-end workstation. Due to this, the
script now exits early if it detects it has already been run with the
same inputs based on a hash value stored in
builtin_symbols_hash_autogen.txt.
BUG=angleproject:2267
BUG=chromium:823856
TEST=angle_unittests
Change-Id: I3ff8c6eb85b90d3c4971ac8d73ee171a07a7e55f
Reviewed-on: https://chromium-review.googlesource.com/973372
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
3b678745
|
2018-03-21T12:59:19
|
|
Use a specialized hash function for mangled names
The hash values used for looking up built-ins now encode the string
length and the location of parentheses as six-bit values, so that we
don't need to check for these if the hash matches.
This decreases shader_translator binary size on Windows by around 10
KB.
BUG=angleproject:2267
BUG=chromium:823856
TEST=angle_unittests
Change-Id: If8c28e1c8851750633509ec6273f556e06e91cd1
Reviewed-on: https://chromium-review.googlesource.com/973243
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
c4bd0ac9
|
2018-02-22T16:29:32
|
|
Add 32-bit hash helper to ImmutableString
Since the length of the hash is known prior to compilation, it can be
compared with script-generated hashes.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: Ia0a78dfd450c4ea2d526da7f3495b9750dcbd1af
Reviewed-on: https://chromium-review.googlesource.com/931884
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
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>
|
|
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>
|
|
12c03761
|
2018-01-25T12:22:33
|
|
Resubmit: Use ImmutableString for HLSL texture references
This fixes an issue in the original revision of this patch by adding
a operator<< to TInfoSinkBase that takes ImmutableString as a
parameter.
This also adds ImmutableStringBuilder class, which can be used to
build ImmutableStrings in place without extra allocations if the
maximum length is known in advance.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I52e984657a3aba3e6fe67a82b401c6b8de557d18
Reviewed-on: https://chromium-review.googlesource.com/890522
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
d1434c04
|
2018-01-29T02:29:53
|
|
Revert "Use ImmutableString for HLSL texture references"
This reverts commit c13bda8678e86ff75a4acfc94f7a45e58224926d.
Reason for revert: May have broken LibFuzzer and AFL builds:
https://ci.chromium.org/buildbot/chromium.fyi/Afl%20Upload%20Linux%20ASan/7718
https://build.chromium.org/deprecated/chromium.fyi/builders/Libfuzzer%20Upload%20Linux%20ASan/builds/8691
In file included from ../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.cpp:12:
In file included from ../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.h:19:
../../third_party/angle/src/compiler/translator/InfoSink.h:40:16: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
stream << t;
^
../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.cpp:111:9: note: in instantiation of function template specialization 'sh::TInfoSinkBase::operator<<<sh::ImmutableString>' requested here
out << textureReference;
^
../../third_party/angle/src/compiler/translator/ImmutableString.h:76:15: note: 'operator<<' should be declared prior to the call site or in namespace 'sh'
std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str);
^
1 error generated.
Bug: chromium:806619
Original change's description:
> Use ImmutableString for HLSL texture references
>
> This also adds ImmutableStringBuilder class, which can be used to
> build ImmutableStrings in place without extra allocations if the
> maximum length is known in advance.
>
> BUG=angleproject:2267
> TEST=angle_unittests
>
> Change-Id: I4dfb78adeb0cffcfad0d25753fb8063466012c92
> Reviewed-on: https://chromium-review.googlesource.com/886362
> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
TBR=jmadill@chromium.org,cwallez@chromium.org,oetuaho@nvidia.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: angleproject:2267
Change-Id: I445f5a786f8b16c3f40f28df09d45fcb215a9c88
Reviewed-on: https://chromium-review.googlesource.com/890542
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
|
c13bda86
|
2018-01-25T12:22:33
|
|
Use ImmutableString for HLSL texture references
This also adds ImmutableStringBuilder class, which can be used to
build ImmutableStrings in place without extra allocations if the
maximum length is known in advance.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I4dfb78adeb0cffcfad0d25753fb8063466012c92
Reviewed-on: https://chromium-review.googlesource.com/886362
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
2d8e432a
|
2018-01-22T14:12:46
|
|
Add ImmutableString to encapsulate some compiler strings
The new ImmutableString class is intended to be used instead of plain
const char pointers to pool-allocated or static memory.
It has the following advantages over using plain const char pointers:
1. It makes it clear when a string is guaranteed to be safe to pass
around inside the compiler.
2. It can be compared with a comparison operator rather than using
strcmp, which is easier to read.
3. It records the length of the stored string, which enables faster
copies and comparisons in some cases.
4. ImmutableStrings could be implicitly converted from std::strings
when a pool-allocated string is required. This is robust and
convenient.
C++17 has a similar class std::string_view, but our code style doesn't
allow it yet. We also couldn't use it as is if we require properties
1 and 4 from above, but would rather need to inherit or wrap it in a
custom class.
Eventually all current usage of TString could be replaced with
ImmutableString. For now, use it for unmangled built-in names.
TEST=angle_unittests
BUG=angleproject:2267
Change-Id: Id60c7b544032e06460e1b99837e429bc84dc4367
Reviewed-on: https://chromium-review.googlesource.com/881020
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|