|   | 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> | 
            
              |   | 4d549932 | 2018-03-22T17:32:10 |  | Move ReplaceVariable to tree_util directory
This was overlooked earlier when most AST transform related utilities
were moved to tree_util.
BUG=angleproject:2402
TEST=angle_unittests
Change-Id: I17d3716a434f80a9316156ca019ce49aada5c249
Reviewed-on: https://chromium-review.googlesource.com/975881
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | a07b4213 | 2018-03-22T16:13:13 |  | Move AST transformations to a subdirectory
Move AST transformations to compiler/translator/tree_ops.
BUG=angleproject:2409
TEST=angle_unittests
Change-Id: I9c620e98707d22d005da6192fe7d1b4e8030aadd
Reviewed-on: https://chromium-review.googlesource.com/975550
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | c26214de | 2018-03-16T10:43:11 |  | Move AST utilities to a subdirectory
Move AST related utilities to compiler/translator/tree_util.
BUG=angleproject:2409
TEST=angle_unittests
Change-Id: I7567c2f6f2710292029263257c7ac26e2a144ac8
Reviewed-on: https://chromium-review.googlesource.com/966032
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 4121799f | 2018-03-15T11:15:33 |  | Clean up switch/case pruning code
There was some duplicate switch/case pruning in the code in
PruneEmptyCases and RemoveNoOpStatementsFromTheEndOfSwitchStatements.
Combine the functionality of both AST transformations into
PruneEmptyCases and remove the other transformation.
The tests are improved to better cover the full functionality.
BUG=angleproject:2402
TEST=angle_unittests, angle_end2end_tests --gtest_filter=*Switch*
Change-Id: Ib74b6b9b455769ea15650e9653a9c53635342c49
Reviewed-on: https://chromium-review.googlesource.com/964081
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 0b0dcbc1 | 2018-03-14T11:33:22 |  | Prune empty cases and switch statements
The translator already prunes no-ops and unreferenced variables, and
this may result in case statements that are followed by nothing.
Since the last case statement in as switch statement must always
contain a statement to be valid GLSL, the translator must not leave
empty case statements in place. They're now being pruned by the
PruneEmptyCases AST transformation. This improves on the earlier
RemoveEmptySwitchStatements AST transformation that did address
empty switch statements but could not remove them if they had a
case statement inside.
BUG=angleproject:2402
TEST=angle_unittests
Change-Id: Ieb9598a744078e45226d8fb7266d877f7835cf0c
Reviewed-on: https://chromium-review.googlesource.com/962181
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 2bfe9f6b | 2018-03-02T16:53:29 |  | Use function id to group functions in ParseContext
This way we can do numeric comparisons instead of string comparisons.
The effect on compiler perf test scores is fairly marginal, but
this reduces binary size by a few kilobytes, and there may be a larger
effect on shaders calling a lot of texture functions.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I077db97b16b16b70b7e18ee037e06d7450d08dc9
Reviewed-on: https://chromium-review.googlesource.com/947952
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | fa886975 | 2018-01-18T19:24:54 |  | Fix handling array constructor statements in HLSL output
Array constructors that are used as a statement by themselves need to
be pruned from the AST before writing HLSL output.
This fixes an assert in OutputHLSL.
BUG=angleproject:2307
TEST=angle_unittests
Change-Id: Ib49461a4be173f3856f5a264ac0af8d818a61798
Reviewed-on: https://chromium-review.googlesource.com/874691
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | cf180fcc | 2018-01-04T16:25:40 |  | Keep TIntermSymbol data consistent in DeferGlobalInitializers
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I25bd8baded9c13e75555578e4b61b99a56e0c702
Reviewed-on: https://chromium-review.googlesource.com/850974
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 0690e1aa | 2017-12-21T20:51:38 |  | Add a workaround to clamp gl_FragDepth
NVIDIA OpenGL drivers at least up to version 388.59 don't clamp
gl_FragDepth when it is written to a floating point depth buffer.
This bug is now worked around by clamping gl_FragDepth in the shader
if it is statically used.
BUG=angleproject:2299
TEST=angle_end2end_tests on NVIDIA
Change-Id: I61589b2b0dd2813c4901a157c8d37e470063773c
Reviewed-on: https://chromium-review.googlesource.com/840842
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 765924f0 | 2018-01-04T12:48:36 |  | Fold ternary and comma ops only after parsing is done
In case folding a ternary op or a comma op would change the qualifier
of the expression, the folding is deferred to a separate traversal
step.
After this there are no more cases where the type of a TIntermSymbol
node needs to differ from the type of the variable it is referring to.
There are still some cases where some parts of TIntermSymbol type are
changed while keeping the TVariable type the same though, like when
assigning array size to gl_PerVertex nodes or sanitizing qualifiers of
struct declarations.
BUG=angleproject:2267
TEST=angle_unittests, angle_end2end_tests
Change-Id: I1501c8d361f5f765f43ca810d1b7248d9e2c5986
Reviewed-on: https://chromium-review.googlesource.com/850672
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 4728bdc8 | 2017-12-20T17:51:08 |  | Unify looking for symbols with a specific name in the AST
Keep only one traverser for looking up symbol nodes by name instead
of having two largely identical ones.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I36e906258180e22b7b1353cab79d90266d99fa0e
Reviewed-on: https://chromium-review.googlesource.com/836895
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | d5f44c98 | 2017-11-29T17:15:40 |  | Simplify parsing struct field declarators
This removes the dummy type that was attached to struct declarators
while parsing. This makes TParseContext::addStructDeclaratorList in
particular simpler to understand.
The new TDeclarator data type is the parsed representation of the
struct_declarator grammar rule. It is completely immutable. The name
and location stored in TField can also be qualified as constant now.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I2834f87fc0eee0bdb7673ef495a55fb463023c55
Reviewed-on: https://chromium-review.googlesource.com/797033
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 3d70ca9c | 2017-11-10T16:53:26 |  | Remove unreferenced variables from the AST
Unreferenced local and global variables are now pruned from the AST.
They will be removed unless their initializer has side effects.
The CollectVariables step needs to be run after the pruning, as the
pruning may affect which interface variables are statically used.
It's also good to gather built-ins that need to be emulated after the
pruning, so unnecessary built-in emulation functions are not added to
the translator output.
This will help handle some dEQP tests for arrays of arrays that have
extremely large local arrays that are only used in an array length
query. By constant folding the length and pruning unused variables we
will avoid adding a large amount of array initialization code to the
generated shaders.
BUG=angleproject:2166
TEST=angle_unittests, angle_end2end_tests
Change-Id: Ic918bfe8f16460bcd6101d73a7a674145f5aeecd
Reviewed-on: https://chromium-review.googlesource.com/766434
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 661fc487 | 2017-10-16T12:17:05 |  | Work around NVIDIA GLSL vector-scalar op bug
This adds a new AST transform VectorizeVectorScalarArithmetic. The AST
transform works around incorrect handling of certain types of GLSL
arithmetic operations by NVIDIA's GL driver. It works around only the
most common cases where the bug reproduces, since detecting all the
cases would take more sophisticated analysis of the code than what
is currently easily implementable in ANGLE.
When a float add operator has both vector and scalar operands, the AST
transform turns the scalar operand into a vector operand. Example:
vec4 f;
f += 1.0;
gets turned into:
vec4 f;
f += vec4(1.0);
When a vector constructor contains a binary scalar float
multiplication or division operation as its only argument, the AST
transform turns both operands of the binary operation into vector
operands. Example:
float f, g;
vec4(f * g);
gets turned into:
float f, g;
vec4(vec4(f) * vec4(g));
Another example with compound assignment:
float f, g;
vec4(f *= g);
gets turned into:
float f, g;
vec4 s0 = vec4(f);
(s0 *= g, f = s0.x), s0;
This latter transformation only works in case the compound assignment
left hand expression doesn't have side effects.
BUG=chromium:772651
TEST=angle_end2end_tests
Change-Id: I84ec04287793c56a94845a725785439565debdaf
Reviewed-on: https://chromium-review.googlesource.com/721321
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | c1f14fbe | 2017-10-28T19:17:23 |  | Remove empty switch statements from translated shaders
The native HLSL compiler does not accept switch statements with an
empty statement list. The simplest way to accommodate this is to
simply remove them from the AST after parsing and some initial
pruning.
This is done by the new RemoveEmptySwitchStatements traverser. It
preserves init statements of switch statements in case they have side
effects. So for example
switch(++i) {}
gets translated to
++i;
BUG=angleproject:2206
TEST=angle_end2end_tests
Change-Id: I550a3c9b010a3566016bdfd93344ac30fd860604
Reviewed-on: https://chromium-review.googlesource.com/742922
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 87c35883 | 2017-10-19T15:19:38 |  | Prune no-op statements with a single traverser
We put pruning literal statements and pruning empty declarations in
the same traverser, as some of the required logic is the same. This
pruning of no-ops is always done as one of the first processing steps
after parsing, so further processing of the AST is simpler.
Since we now prune pure literals before removing no-op cases from the
end of switch statements, we also don't need any sort of special
handling for switch statements in pruning pure literals.
BUG=angleproject:2181
TEST=angle_unittests
Change-Id: I2d86efaeb80baab63ac3cc803f3fd9e7ec02908a
Reviewed-on: https://chromium-review.googlesource.com/727803
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 711b7a12 | 2017-10-09T13:38:12 |  | ES31: Support images in the compiler on D3D backend.
BUG=angleproject:1987
TEST=angle_end2end_tests
Change-Id: I83f5f9ffda7e676a8f98b963d1f1c50e9463faf4
Reviewed-on: https://chromium-review.googlesource.com/706247
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 2d88e9bc | 2017-07-21T16:52:03 |  | Guarantee that symbol nodes get unique ids
The code is refactored so that symbol nodes can only be initialized
with an unique id object. This prevents accidentally forgetting to
create an id for a symbol node.
This opens up possibilities for future optimization: For example the
names and types of symbols could be stored in a central location
inside the SymbolTable, and TIntermSymbol nodes would only need to
store the symbol id. The symbol id could be used to look up the name
and type of the node.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ib8c8675d31493037a5a28c7b36bb9d1113cc10f6
Reviewed-on: https://chromium-review.googlesource.com/580955
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | f6d242ed | 2017-10-12T17:21:06 |  | Wrap switch statements in blocks in HLSL
If variables are declared inside a GLSL switch statement, they are
scoped until the end of the switch statement. This is not compatible
with HLSL rules, where the scoping is until the end of the case. To
work around this, wrap switch statements in a block that declares
the variables in HLSL.
This is done after most other transformations done to the AST are
complete, since some of the other transformations may introduce
temporary variables.
BUG=angleproject:2179
TEST=angle_end2end_tests
Change-Id: Id0bb89affe103177fd3d6a6b2f3619b5e1ada0a6
Reviewed-on: https://chromium-review.googlesource.com/716381
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 923ecef6 | 2017-10-11T12:01:38 |  | Fix switch statement validation corner cases
The grammar needs to generate AST nodes even for no-op statements,
since they might be the last statement in a switch statement that is
required for switch statement validity. Change the grammar to generate
nodes from empty blocks and empty declarations.
We also need to do some further processing of the AST. This is because
PruneEmptyDeclarations will still remove empty declarations, and at
least the NVIDIA driver GLSL compiler doesn't accept some types of
no-op statements as the last statement inside a switch statement. So
after parsing has finished we do rudimentary dead code elimination to
remove dead cases from the end of switch statements.
BUG=angleproject:2181
TEST=angle_unittests
Change-Id: I586f2e4a3ac2171e65f1f0ccb7a7de220e3cc225
Reviewed-on: https://chromium-review.googlesource.com/712574
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 4cc89e2b | 2017-08-31T14:25:54 |  | ES31: Enable 'location' layout qualifier on shader interfaces in compiler
This patch enables 'location' layout qualifier for vertex outputs and
fragment shader inputs when the shader version is 3.1 in ANGLE GLSL
compiler and adds the check on location conflicts for these varyings.
According to GLSL ES 3.1 SPEC (Chapter 4.4.1 and Chapter 4.4.2),
'location' layout qualifier is allowed on both inputs and outputs of
vertex and fragment shaders.
'location' layout qualifier on shader interfaces is only valid on shaders
whose version is 3.1 and above. According to GLSL ES 3.0 SPEC, vertex shader
cannot have output layout qualifiers (Chapter 4.3.8.2) and fragment shader
cannot have input layout qualifiers (Chapter 4.3.8.1).
The 'location' qualifier on varyings is used in the shader interface
matching defined in OpenGL ES 3.1. (OpenGL ES 3.1 SPEC Chapter 7.4.1). This
new link rule will be added to Program.cpp in another patch.
For the OpenGL ES 3.1 extension GL_OES_geometry_shader, according to
GL_OES_shader_io_blocks SPEC (Chapter 4.4.1 and Chapter 4.4.2), 'location'
layout qualifier is both valid on geometry shader inputs and outputs. This
feature will be implemented together with other rules on geometry shader
inputs and outputs.
BUG=angleproject:2144
TEST=angle_unittests
Change-Id: I62d85f7144c177448321c2db36ed7aaeaa1fb205
Reviewed-on: https://chromium-review.googlesource.com/645366
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | bb5a7e29 | 2017-08-30T13:03:12 |  | Allow length() on arbitrary array expressions
This is required to pass some dEQP GLES 3.1 tests for arrays of
arrays, and WebGL conformance tests were also recently fixed to
require this behavior. The intent of the GLSL ES spec was not to
restrict usage of length().
In practice GL drivers don't implement array length() on expressions
with side effects correctly in all cases. HLSL doesn't have an array
length operator either. Because of this we always remove array length
ops from the AST before output.
BUG=angleproject:2142
TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests
Change-Id: I863a92e83ac5315b013af9a5626348482bad72b3
Reviewed-on: https://chromium-review.googlesource.com/643190
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 2a1e8f95 | 2017-07-14T11:49:36 |  | Refer to GLSL extensions through TExtension enum
Extensions are now referred to by enum values instead of strings most
of the time. This gets rid of unnecessary copying of strings. The code
is easier to work with than before as typoing the extension enum names
will be caught by the compiler.
BUG=angleproject:2147
TEST=angle_unittests
Change-Id: Ifa61b9f86ef03211188fc23bc23a5ce4e4d8c390
Reviewed-on: https://chromium-review.googlesource.com/571002
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | ec3a9cbb | 2017-09-07T12:18:01 |  | Only support GL_OVR_multiview extension variant
The WebGL spec proposal was changed so that only GL_OVR_multiview
extension name is supported, instead of having two variants
OVR_multiview and OVR_multiview2. We're only supporting the WebGL
version of the shader extension, so we drop compiler support for
GL_OVR_multiview2. Shader restrictions were also removed from the
WebGL spec, so no special validation for how ViewID_OVR gets used is
needed.
Tests that were testing for the shader restrictions are either removed
or changed from negative tests to positive tests.
BUG=angleproject:1669
TEST=angle_unittests
Change-Id: I83f92b879376d41b727b5aca419fd75fb6f53477
Reviewed-on: https://chromium-review.googlesource.com/654608
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 78ed6cd9 | 2017-08-09T16:19:00 |  | Rename VariableInfo files to CollectVariables
Files that only have a single function should be named consistently
with the function. Unnecessary include in CallDAG.h is removed.
BUG=angleproject:2068
TEST=angle_unittests
Change-Id: I27d55a766b9eb66fcfd1e0a2341a2843bb9dc5bb
Reviewed-on: https://chromium-review.googlesource.com/608368
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | ab918821 | 2017-07-14T17:03:42 |  | Clamp point size to maximum point size from the API on NVIDIA
NVIDIA OpenGL drivers have a bug where the point size range is being
reported incorrectly - it appears the core GL driver incorrectly gives
the range for smooth points, when it should be giving the range for
aliased points. Clamp the actual point size to the maximum point size
reported from the API so that the GLES spec is followed.
The same workaround seems to be necessary also on Android. The issue
was revealed by the trybots, and has not been fully diagnosed though.
The newly added test fails on AMD OpenGL.
As a part of this change, the existing tests in PointSpritesTest are
refactored to use gl_raii.
BUG=chromium:740560
TEST=angle_end2end_tests
Change-Id: Ic4a66c9ea16f5ae76beb3bb6577716d10c3b226e
Reviewed-on: https://chromium-review.googlesource.com/574598
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | ffb35f64 | 2017-07-14T18:01:07 |  | Fix broadcasting gl_FragColor at the end of main
Previously, the broadcast step would not get run in case the main()
function returned before reaching its end. Now the broadcast step is
put in a separate function that wraps main() if needed, so that it
gets run even if the main() function in the original shader source
returns in the middle.
DrawBuffersTest is refactored to use ANGLETest::drawQuad() instead of
calling glDrawArrays directly.
BUG=angleproject:2109
TEST=WebGL conformance tests, angle_end2end_tests
Change-Id: Id5f05094e816df03bc9c8ca62b60de914072682c
Reviewed-on: https://chromium-review.googlesource.com/574597
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 3ec75686 | 2017-07-05T17:02:55 |  | Collect AST transform utilities to a separate file
Collect static functions that are used to create nodes in AST
transformations into a single file.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I6f87422988fa088f2f4b48986e378a2909705cb7 | 
            
              |   | cccf2b00 | 2017-07-05T14:50:54 |  | Reorganize AST traversal utility code
Define TIntermTraverser and TIntermLValueTrackingTraverser in a
separate header file. hash() function is moved out from
TIntermTraverser as it is not related to the core functionality
of traversing and transforming ASTs.
Also reorganize some traversers to follow common conventions:
- Intermediate output is now in OutputTree.h/.cpp
- Max tree depth check is now in IsASTDepthBelowLimit.h/.cpp
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Id4968aa9d4e24d0c5bac90dc147fc9f310de0184
Reviewed-on: https://chromium-review.googlesource.com/559531
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 69056a1e | 2017-05-18T11:14:50 |  | Declare and initialize ViewID_OVR and InstanceID
The patch modifies the vertex shader's AST to declare and initialize
the global variables ViewID_OVR and InstanceID. Every occurrence of
gl_ViewID_OVR gets replaced by ViewID_OVR and initialized in main
with a value dependent on gl_InstanceID and the number of views.
To guarantee correct results for instanced rendering, each occurrence
of gl_InstanceID is replaced with InstanceID and initialized similarly.
BUG=angleproject:2062
TEST=angle_unittests
Change-Id: I48be688605b5af869bc370758e70ccc209ea4419
Reviewed-on: https://chromium-review.googlesource.com/548596
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 35bcad42 | 2017-06-06T15:12:27 |  | Optimize builtin function emulator class.
This refactor uses a generator to produce static arrays instead of
using a bunch of std::map inserting statements. It speeds up shader
translation because every shader compile would create and tear down
this table.
Currently it is implemented as a flat array, but in the future we
could use compile-time hashing to implement faster lookup.
BUG=chromium:697758
Change-Id: I689f7de4d9b2c8c76095bb313f4c040116fc61d2
Reviewed-on: https://chromium-review.googlesource.com/521226
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 9733ceef | 2017-05-11T19:14:35 |  | Initialize uninitialized locals in GLSL output
Guarantee that local variables are initialized before they are used
in GLSL output. In HLSL output all variables were already being
initialized.
Locals are initialized using an AST transform. The local variable init
can only be run after some simplification of the AST, so that it is
able to handle complex cases like:
for (int i[2], j = i[0]; i[0] < 3; ++i[0]) {
}
If we're dealing with ESSL 1.00 which lacks array constructors, in
this kind of case the uninitialized array initialization code needs to
be hoisted out of the loop init statement, and the code also needs to
make sure that j's initializer is run after i is initialized.
Another complex case involves nameless structs. This can be an issue
also in ESSL 3.00 and above:
for (struct { float f; } s; s.f < 1.0; ++s.f) {
}
Since the struct doesn't have a name, its constructor can not be used.
We solve this by initializing the struct members individually,
similarly to how arrays are initialized in ESSL 1.00.
Initializing local variables is disabled on Mac and Android for now.
On Mac, invalid behavior was exposed in the WebGL 2.0 tests when
enabling it. On Android, the dEQP test runs failed for an unknown
reason. Bugs have been opened to resolve these issues later.
BUG=angleproject:1966
TEST=angle_end2end_tests, WebGL conformance tests
Change-Id: Ic06927f5b6cc9619bc82c647ee966605cd80bab2
Reviewed-on: https://chromium-review.googlesource.com/504728
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 9cbc07c3 | 2017-05-10T18:22:01 |  | Simplify AST transformations that need to find main
Share code for finding the main function from the AST between
InitializeVariables, DeferGlobalInitializers,
EmulateGLFragColorBroadcast and UseInterfaceBlockFields. This makes
InitializeVariables simpler in particular, as it doesn't need an AST
traverser anymore.
BUG=angleproject:2033
TEST=angle_unittests, WebGL conformance tests
Change-Id: I14c994bbde58a904f6684d2f0b72bd8004f70902
Reviewed-on: https://chromium-review.googlesource.com/501166
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | e839078e | 2017-04-06T14:34:43 |  | compiler: Prune literal statements when outputting ESSL
The ESSL output doesn't have a default precision for floats, this causes
float literal statements to not have any precision defined, which is an
error. We fix this by removing literal statements as they are dead code
anyway.
BUG=angleproject:1967
Change-Id: I498f4f8495f854240ee8a2182415bf982c5166a4
Reviewed-on: https://chromium-review.googlesource.com/470268
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 9ec79391 | 2017-03-31T23:04:23 |  | Use TLValueTrackingTraverser in ValidateLimitations
Use TLValueTrackingTraverser to determine whether a loop index is used
as an l-value. This replaces custom logic in ValidateLimitations,
greatly simplifying the code. Also pass the symbol table to
ValidateLimitations as a parameter, which removes the need to store a
global pointer to the current ParseContext.
BUG=angleproject:1960
TEST=angle_unittests, WebGL conformance tests
Change-Id: I122c85c78bbea05833d7c787cd184de568c5c45f
Reviewed-on: https://chromium-review.googlesource.com/465606
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | e794cd86 | 2017-01-13T17:29:51 |  | Vulkan: Implement new GLSL translator back-end.
The Vulkan GLSL translator back-end will handle validating and
translating our WebGL/ESSL shaders into Vulkan-specific GLSL.
glslang (the Vulkan one) accepts both GLSL and GLSL ES shaders
as inputs, and both the desktop and ESSL back-ends give
incompleteness warnings when used. For now, use the desktop GL
450 as a target for Vulkan GLSL.
The Vulkan-specific changes are currently only to add locations
to every vertex input and fragment output.
BUG=angleproject:1575
Change-Id: I7c3f32f522e9d18e5f8618eb7927336bf4fbdcf2
Reviewed-on: https://chromium-review.googlesource.com/412266
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 09b04a2f | 2016-12-15T13:30:26 |  | Add shader translator support for OVR_multiview
The OVR_multiview and OVR_multiview2 extensions add gl_ViewID_OVR to
shaders. gl_ViewID_OVR can be translated either as is in GLSL output
or as a uniform by setting the SH_TRANSLATE_VIEWID_OVR_AS_UNIFORM
compiler flag.
If WebGL output is selected, the shaders will be validated according
to proposed rules in the WEBGL_multiview spec.
BUG=angleproject:1669
TEST=angle_unittests
Change-Id: I19ea3a6c8b4edb78be03f1a50a96bfef018870d0
Reviewed-on: https://chromium-review.googlesource.com/422848
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 77ba408a | 2016-12-16T12:01:18 |  | Unify Diagnostics interface
Use the same kind of interface for reporting preprocessor errors as
for reporting regular compiler errors, and make global errors like
having too many uniforms also go through Diagnostics. Also don't
create std::string objects unnecessarily.
Includes cleanups of some dead code related to reporting errors.
BUG=angleproject:1670
TEST=angle_unittests
Change-Id: I3ee794d32ddeec1826bdf1b76b558f35259f82c0
Reviewed-on: https://chromium-review.googlesource.com/421527
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | f52fe93d | 2016-12-07T13:39:15 |  | Work around unary minus operator float issue on Intel Mac 10.11
Result of -float is wrong on Intel Mac 10.11 drivers. Replace -float
with 0.0 - float to work around this issue.
BUG=308366
BUG=672380
Change-Id: I53bc2eda7259fff5805bec39896fc7b7a6eaf665
Reviewed-on: https://chromium-review.googlesource.com/417169
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 1b896c62 | 2016-11-16T13:10:44 |  | translator: remove code related to for-loop unrolling
For loop unrolling is not used and causes the translator fuzzer to find
a hang when unrolling tons of nested loops (duh).
Also remove MMap.h which was unused.
This is essentially a revert of https://codereview.appspot.com/4331048
BUG=chromium:665255
Change-Id: Id6940f7e306d4ed53bc992f751e9ffe733190f17
Reviewed-on: https://chromium-review.googlesource.com/412023
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | dfd7fb2a | 2016-11-11T16:05:11 |  | Cleanup after merging translator_lib into translator
Rename a few references to translator_lib
BUG=angleproject:1596
Change-Id: Ib715fdd8a949dc46a5ef628ea2d7f71b1b771845
Reviewed-on: https://chromium-review.googlesource.com/410287
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org> | 
            
              |   | ea586549 | 2016-11-10T17:33:43 |  | Cleanup after translator component removal
- Unite translator with translator_lib
- Remove flags and defines for shared library exports
BUG=angleproject:1596
Change-Id: Icd145a4b79e2472766a2b56017bb0f36f244482e
Reviewed-on: https://chromium-review.googlesource.com/410261
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org> | 
            
              |   | 7f07caa9 | 2016-10-25T07:43:33 |  | Rename the build/ directory.
GYP related files went in gypfiles/, and the gni went in gni/ this
changes frees up the build/ directory name for Chromium's build/
directory.
BUG=angleproject:1569
Change-Id: I76fe343d569239c2732ba87986fcf7debc21d417
Reviewed-on: https://chromium-review.googlesource.com/403029
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | e653403b | 2016-11-01T18:19:06 |  | Remove component translator target and keep static_library.
Rename translator_static to translator and use it everywhere.
BUG=angleproject:1596
Change-Id: I36c990d54979d2460b1513a65cca0b82f8d65c80
Reviewed-on: https://chromium-review.googlesource.com/406668
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org> | 
            
              |   | 705a9194 | 2016-08-29T10:05:27 |  | Reland "Remove invariant qualifier for input in fragment shader"
This relands https://chromium-review.googlesource.com/#/c/400005/.
ESSL and GLSL are not consistent on invariant matching in vertex shader
and fragment shader. See the following rules:
ESSL 1.00 - input and output must match
ESSL 3.00 - only output, inputs cannot be declared as invariant.
GLSL 1.10.59 - does not exist
GLSL 1.20.8  - input and output must match
GLSL 1.30.10 - input and output must match
GLSL 1.40.8  - input and output must match
GLSL 1.50.11 - input and output must match
GLSL 3.30.6  - input and output must match
GLSL 4.00.9  - input and output must match
GLSL 4.10.6  - input and output must match
GLSL 4.20.11 - input can omit invariant
GLSL 4.30.8  - input can omit invariant
GLSL 4.40.9  - input can omit invariant
GLSL 4.50.5  - input can omit invariant
Since GLSL 4.20, invariant qualifier description were changed to:
"
Only variables output from a shader (including those that are then input
to a subsequent shader) can be candidates for invariance. This includes
user-defined output variables and the built-in output variables. As only
outputs need be declared with invariant, an output from one shader stage
will still match an input of a subsequent stage without the input being
declared as invariant.
"
It's not very clear if input in fragment can be declared as invariant.
Mesa driver disallows use of input declared as invariant in fragment
shader, while other drivers may allow it. This CL removes invariant
declaration for input in fragment shader except AMD driver in Linux.
AMD's driver obviously contradicts the spec by forcing invariance to
match between vertex and fragment shaders.
BUG=chromium:639760, chromium:659326
TEST=conformance/glsl/misc/shaders-with-invariance.html and
conformance/glsl/bugs/invariant-does-not-leak-across-shaders.html
Change-Id: I0aa9be14f0cee7a11a249c91fba27c570c52ca1b
Reviewed-on: https://chromium-review.googlesource.com/404228
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org> | 
            
              |   | c5fa0ad5 | 2016-10-25T21:36:54 |  | Revert "Remove invariant qualifier for input in fragment shader"
This reverts commit d842a6b2014447db0676c8a3f5a5e9ae4ce67d9a.
Because of WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders failure
BUG=chromium:659326
Change-Id: I0602e24f3d34ccf852cda865f673c5c7634f82a6
Reviewed-on: https://chromium-review.googlesource.com/403230
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org> | 
            
              |   | d842a6b2 | 2016-08-29T10:05:27 |  | Remove invariant qualifier for input in fragment shader
ESSL and GLSL are not consistent on invariant matching in vertex shader
and fragment shader. See the following rules:
ESSL 1.00 - input and output must match
ESSL 3.00 - only output, inputs cannot be declared as invariant.
GLSL 1.10.59 - does not exist
GLSL 1.20.8  - input and output must match
GLSL 1.30.10 - input and output must match
GLSL 1.40.8  - input and output must match
GLSL 1.50.11 - input and output must match
GLSL 3.30.6  - input and output must match
GLSL 4.00.9  - input and output must match
GLSL 4.10.6  - input and output must match
GLSL 4.20.11 - input can omit invariant
GLSL 4.30.8  - input can omit invariant
GLSL 4.40.9  - input can omit invariant
GLSL 4.50.5  - input can omit invariant
Since GLSL 4.20, invariant qualifier description were changed to:
"
Only variables output from a shader (including those that are then input
to a subsequent shader) can be candidates for invariance. This includes
user-defined output variables and the built-in output variables. As only
outputs need be declared with invariant, an output from one shader stage
will still match an input of a subsequent stage without the input being
declared as invariant.
"
It's not very clear if input in fragment can be declared as invariant.
Mesa driver disallows use of input declared as invariant in fragment
shader, while other drivers may allow it.
In ESSL 3.00, inputs cannot be declared as invariant. ANGLE should
follow this rule for GLSL >= 4.20.
BUG=chromium:639760
Change-Id: I7f7a07401381ac970488b69752f6d50d4f19d31f
Reviewed-on: https://chromium-review.googlesource.com/400005
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 7835b525 | 2016-10-08T11:20:17 |  | Reland "Add workaround for unused std140 and shared uniform blocks on MacOS"
On some Mac drivers with shader version 4.1, they will
treat unused std140 and shared uniform blocks' members as inactive. However,
WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block
declared with a shared or std140 layout qualifier to be considered active.
The uniform block itself is also considered active.
This workaround is to reference all members of unused std140 and shared uniform blocks
at the beginning of the vertex/fragment shader's main().
BUG=chromium:618464
TEST=UniformBufferTest.ActiveUniformBlockNumber
Change-Id: I18da4e2b61b0170068bf5ea38ce54667b0737780
Reviewed-on: https://chromium-review.googlesource.com/395648
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | c9e6026c | 2016-09-30T17:15:07 |  | Revert "Add workaround for unused std140 and shared uniform blocks on MacOS"
This reverts commit 9aa83fe302578d226f195fff5fb3f0e2fb723a4c.
The new test UniformBufferTest.ActiveUniformNumberAndName/ES3_OPENGL is failing on multiple platforms. Examples:
https://build.chromium.org/p/chromium.gpu.fyi/builders/Mac%2010.10%20Release%20%28ATI%29/builds/12285
https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20(ATI)
Change-Id: I78b1a4d58e9a291e40ad304eb32f990e0518f7ee
Reviewed-on: https://chromium-review.googlesource.com/391049
Reviewed-by: Kenneth Russell <kbr@chromium.org> | 
            
              |   | 9aa83fe3 | 2016-09-29T08:42:42 |  | Add workaround for unused std140 and shared uniform blocks on MacOS
On some Mac drivers with shader version 4.1, they will
treat unused std140 and shared uniform blocks' members as inactive. However,
WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block
declared with a shared or std140 layout qualifier to be considered active.
The uniform block itself is also considered active.
This workaround is to reference all members of unused std140 and shared uniform blocks
at the beginning of the vertex/fragment shader's main().
BUG=chromium:618464
TEST=UniformBufferTest.ActiveUniformBlockNumber
Change-Id: I1d2c5e3e8da04786ac6a37fd26f7bb9c14cd76ed
Reviewed-on: https://chromium-review.googlesource.com/387169
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 054f7ed0 | 2016-09-20T17:15:59 |  | preprocessor: Miscellaneous cleanups
- Use full header paths in includes
- Use ASSERT instead of assert
- Use angle::NonCopyable instead of PP_DISALLOW_COPY_AND_ASSIGN
- Use range-for in a couple places
- Remove pp_utils.h
BUG=angleproject:1522
Change-Id: If107fef89e8465bca65cf664926d1051c5d1e232
Reviewed-on: https://chromium-review.googlesource.com/387212
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | e292e902 | 2016-09-07T10:49:01 |  | Workaround the unary minus operator issue on Intel
On some Intel D3D drivers, evaluating unary minor operator on an
integer variable may get wrong answer in vertex shader.
This patch works around this bug by replacing -(int) with ~(int)+1
on Windows Intel.
BUG=chromium:644033
Change-Id: I0af719e84d618a33f25bcb33bde0c381fb462a31
Reviewed-on: https://chromium-review.googlesource.com/381675
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 09cfac60 | 2016-09-06T17:25:16 |  | Work around For and While loop bugs on Intel Mac OSX
Condition calculation in for and while loops has bug on Intel Mac. Work
around it by converting "CONDITION" to "CONDITION && true".
This CL also adds previous SH_EMULATE_ABS_INT_FUNCTION workaround to
the ANGLE GL back-end on OSX
BUG=chromium:644669
TEST=deqp/functional/gles3/shaderloop_for/while.html
Change-Id: I910f662b054f259fcb601b9938841b3a2d066840
Reviewed-on: https://chromium-review.googlesource.com/381678
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Qiankun Miao <qiankun.miao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 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> | 
            
              |   | 966456de | 2016-09-12T11:42:44 |  | Remove SH_TIMING_RESTRICTIONS compiler flag
The timing restrictions code is not in use and not updated for ESSL3,
so it is better to remove it to make refactoring the AST easier.
It can also be argued that perfect prevention of shader timing attacks
is not feasible due to factors that are not under control of ANGLE,
such as fixed function color compression in GPUs. Such color
compression may make the use of texture bandwidth and thus performance
dependent on the content of a texture regardless of whether a
compressed format is chosen through the API.
SH_DEPENDENCY_GRAPH flag that could only be active together with the
timing restrictions flag is also removed, along with all the code that
was supporting it. The newer CallDAG code is used for different
purposes and is kept.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I2cd10e18df366e8e43f7c3af1ca12d2a4bfb2007
Reviewed-on: https://chromium-review.googlesource.com/384511
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 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> | 
            
              |   | 70866b89 | 2016-07-22T15:27:42 |  | Change grammar to support features from es31
The grammar has been changed so that ES31 grammar is followed more
closely. The ES31 grammar is not fully supported, only functionality
related to qualifier enumeration is added.
The ParseContext is changed so that type qualifiers can be now joined
together (i.e. like layout qualifiers). This will allow enumeration of
multiple storage qualifiers (i.e. uniform readonly coherent) which is
essential for support of ES31 features.
Some of the error checks had to be moved closer to the root of the
parse tree since some of the information about the expression might be
missing.
Unfortunately, as there is no explicit ordering imposed by the
grammar, additional checks for proper order of qualifiers had to be
added. I also included unit tests which test against malformed
shaders.
BUG=angleproject:1442
TEST=angle_end2end_tests
TEST=angle_unittests
TEST=dEQP-GLES3.functional.shaders.*precision*
TEST=dEQP-GLES3.functional.shaders.*function*
TEST=dEQP-GLES2.functional.shaders.*
Change-Id: Ib3653a1ed1bfced099a6b2cbf35a7cd480c9100d
Reviewed-on: https://chromium-review.googlesource.com/362940
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | c2c5fc48 | 2016-08-31T15:24:22 |  | Remove CSS Shader related code
CSS shader has been removed from spec and chrome code base. Remove the
code in ANGLE.
BUG=chromium:233383
Change-Id: I93a35437f540e51ce7af9d49f21ca60d7c0b156a
Reviewed-on: https://chromium-review.googlesource.com/378739
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 11e43ece | 2016-08-11T09:54:08 |  | Add a workaround for Intel drivers on glsl function texelfetchoffset
GLSL function texelfetchoffset will be translated into texture.Load in
ANGLE. In D3D there is a note that When one or more of the coordinates
in Location exceeds the u, v, or w mipmap level dimensions of the
texture, Load returns zero in all components, but in glsl there is no
such restriction, which will cause the WebGL 2 dEQP test
deqp/functional/gles3/shadertexturefunction/texelfetchoffset.html fail
on Windows with Intel GPU.
Adapted from ExpandIntegerPowExpressions.cpp, this patch adds a
translation from texelFetchOffset into texelFetch to work around this
issue.
BUG=angleproject:1469
Change-Id: Iecfb9570472036acf5960789bdb1a63f191316be
Reviewed-on: https://chromium-review.googlesource.com/367883
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 4e94fea8 | 2016-08-09T14:31:37 |  | Emulate gl_FragColor broadcasting behavior when GL_EXT_draw_buffers is
enabled.
BUG=angleproject:1467,635433
TEST=WebGL conformance, angle_unittests
Change-Id: I9eb4ce715732087a3786da886f42243716f2b9b2
Reviewed-on: https://chromium-review.googlesource.com/367532
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 156d7197 | 2016-07-21T16:11:00 |  | HLSL: Insert return statements into functions that are missing them.
It's allowed to not have all code paths return a value in ESSL but the HLSL
compiler detects this and generates an error.  Work around this by adding
dummy return statements at the end of each function that doesn't have one.
TEST=deqp/data/gles2/shaders/functions.html
BUG=angleproject:1015
BUG=478572
Change-Id: I2913f90f0994d4caf25cc43b16b9fc4e9efb19a5
Reviewed-on: https://chromium-review.googlesource.com/362085
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org> | 
            
              |   | e1d199bb | 2016-07-19T17:14:27 |  | Split sequence operator when necessary
Split sequence operators if some of their operands generate statements
in subsequent AST transformations to guarantee the right order of
execution. For now, this is supported for expressions that return
arrays and unfolded short-circuiting operators, which is enough to get
WebGL 2 tests passing. A trickier corner case with dynamic indexing of
vectors as an l-value is left to be addressed later.
BUG=angleproject:1341
TEST=angle_end2end_tests, WebGL 2 conformance test:
     conformance2/glsl3/array-in-complex-expression.html
Change-Id: I9301edd3366be7607a8aa4c42a5ec13928749e10
Reviewed-on: https://chromium-review.googlesource.com/361694
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 00f6fbbe | 2016-07-20T16:32:29 |  | Add IntermNodePatternMatcher helper class
This will enable sharing code between different AST traversers that
apply transformations on similar node structures. This will make the
code more maintainable.
For now the helper class is used in UnfoldShortCircuitToIf and
SeparateExpressionsReturningArrays.
BUG=angleproject:1341
TEST=angle_end2end_tests, WebGL 2 conformance tests
Change-Id: Ib1e0d5a84fd05bcca983b34f18d47c53e86dc227
Reviewed-on: https://chromium-review.googlesource.com/361693
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 5858f7e3 | 2016-04-08T13:08:46 |  | Re-land "Refactor texture function handling in OutputHLSL"
This change is pure refactoring, it does not introduce any functional
changes.
Separate texture function output into a helper class and further into
different helper functions to make the code more maintainable.
Some of the logic is simplified slightly by eliminating duplicate
cases and limiting the scope of variables where possible, but care
has been taken to preserve the exact same functionality as before.
Re-land with a fix to typo in include guard.
BUG=angleproject:1349
TEST=dEQP-GLES3.functional.shaders.texture_functions.* (no regression)
     dEQP-GLES3.texture.* (no regression)
Change-Id: I57c1ec1950fa05bd16275ca578eb5ee99b34a5ae
Reviewed-on: https://chromium-review.googlesource.com/339180
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | c2ed9380 | 2016-04-15T13:29:25 |  | Revert "Refactor texture function handling in OutputHLSL"
It triggered an include guard warning on Windows Clang
This reverts commit 6f6c5580553d1f3c584df692823c2f5640e23d88.
Change-Id: Ibd4f2851f311a494f16376d8eed38f3119594761
Reviewed-on: https://chromium-review.googlesource.com/338933
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | 6f6c5580 | 2016-04-08T13:08:46 |  | Refactor texture function handling in OutputHLSL
This change is pure refactoring, it does not introduce any functional
changes.
Separate texture function output into a helper class and further into
different helper functions to make the code more maintainable.
Some of the logic is simplified slightly by eliminating duplicate
cases and limiting the scope of variables where possible, but care
has been taken to preserve the exact same functionality as before.
BUG=angleproject:1349
TEST=dEQP-GLES3.functional.shaders.texture_functions.* (no regression)
     dEQP-GLES3.texture.* (no regression)
Change-Id: I5d81b842d693c0055890d5724eae6c105e454cd8
Reviewed-on: https://chromium-review.googlesource.com/337931
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 3d932d83 | 2016-04-12T11:10:30 |  | Defer global initializers when necessary
Move global variable initializers that are not constant expressions to
a function that gets called at the start of main(). This is done
with an AST transformation. This needs to be done because global
variable initializers must be constant in native GL, but ANGLE is more
lenient with what can be put into ESSL 1.00 global initializers to
remain compatible with legacy WebGL content.
Non-constant global variable initializers also caused issues in HLSL
output, since in HLSL output some types of expressions get unfolded
into multiple statements. These include short-circuiting operators and
array initialization. To make sure that these cases are covered, any
initializers that can't be constant folded are deferred, even if they
have the const qualifier.
The old deferring mechanism in OutputHLSL is removed in favor of this
new AST transformation based approach.
BUG=angleproject:819
BUG=angleproject:1205
BUG=angleproject:1350
BUG=596616
TEST=WebGL conformance test
     conformance/glsl/misc/global-variable-init.html
Change-Id: I039cc05d6b8c284baeefbdf7f10062cae4bc5716
Reviewed-on: https://chromium-review.googlesource.com/338291
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 19d1dc99 | 2016-03-08T17:18:46 |  | Add option to limit the number of function parameters
Trying to compile user-defined functions that have thousands of
parameters introduces some instability in native compilers, so it is
better to reject shaders with large numbers of function parameters
in ANGLE.
The check is only enabled if the SH_LIMIT_EXPRESSION_COMPLEXITY flag
is turned on. The default limit for the number of parameters is 1024,
but it can also be configured.
BUG=angleproject:1338
TEST=angle_unittests
Change-Id: I5c9b7a4e97e67f36e77f969368336fa8fffba1c3
Reviewed-on: https://chromium-review.googlesource.com/331970
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> | 
            
              |   | 82b5ab60 | 2015-12-11T09:30:15 |  | Compile out GLSL/ESSL translator output code if it's not needed
In WinRT we only use the HLSL code, so the GLSL/ESSL output code
is not necessary and is only adding to our binary size.
BUG=angleproject:1250
Change-Id: I9363ca3981bde50a230f8353c1bcc09f6ea209cb
Reviewed-on: https://chromium-review.googlesource.com/317358
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Tryjob-Request: Austin Kinross <aukinros@microsoft.com>
Tested-by: Austin Kinross <aukinros@microsoft.com> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | d4b5054d | 2015-09-28T12:19:26 |  | compiler: Rewrite do-while loops as while loops
This works around a Mac driver shader compiler bug that makes many
do-while loops cause GPU-hangs when ran.
BUG=angleproject:891
Change-Id: I29828d6ea9e887ad0ed0c577f1deb41fb632a900
Reviewed-on: https://chromium-review.googlesource.com/302465
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org> | 
            
              |   | ee48376c | 2015-09-15T13:12:07 |  | Update to the latest versions of the GL and EGL headers.
Add GLES 3.1 and 3.2 headers.
Remove GLES 3.0 extension headers and entry point files.
Re-land fixes double define from different style defines in libGLESv2.gypi
and other projects.
Re-land fixes missing defines in angle_util project in gn.
Change-Id: I1952413cd4390e6f5450df809f8f5867bf6f49e2
Reviewed-on: https://chromium-review.googlesource.com/299771
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 0393310f | 2015-09-15T16:59:59 |  | Revert "Update to the latest versions of the GL and EGL headers."
Issues with GN build.
This reverts commit 8284436798dd184afe61cbb586185cb68e503d6f.
Change-Id: I99d186019135bbbe250e95c9567854108d31c556
Reviewed-on: https://chromium-review.googlesource.com/299870
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 82844367 | 2015-09-11T13:52:12 |  | Update to the latest versions of the GL and EGL headers.
Add GLES 3.1 and 3.2 headers.
Remove GLES 3.0 extension headers and entry point files.
Re-land fixes double define from different style defines in libGLESv2.gypi and
other projects.
Change-Id: I6204dc767bd83b7aa7e4d6e2fa338b2ce7f304d8
Reviewed-on: https://chromium-review.googlesource.com/299401
Tested-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | e12150fe | 2015-09-11T20:06:27 |  | Revert "Update to the latest versions of the GL and EGL headers."
Linux compile failures to do gyp defines.
This reverts commit 8bbeabc1795473f7b3141219be3970fea3b95a71.
Change-Id: Icb31dd817414b3a9ab36e88cedab9c725af26b6b
Reviewed-on: https://chromium-review.googlesource.com/299173
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 8bbeabc1 | 2015-09-11T13:52:12 |  | Update to the latest versions of the GL and EGL headers.
Add GLES 3.1 and 3.2 headers.
Remove GLES 3.0 extension headers and entry point files.
Change-Id: Icaa444efa52f3b9d1497189da92bc364545a6e3a
Reviewed-on: https://chromium-review.googlesource.com/299172
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 7aef6020 | 2015-09-11T19:04:00 |  | Revert "Update to the latest versions of the GL and EGL headers."
Broke the Clang compile.
In file included from ../../third_party/angle/include/GLSLANG/ShaderLang.h:28:
../../third_party/angle/include/KHR/khrplatform.h:282:30: error: no newline at end of file [-Werror,-Wnewline-eof]
#endif /* __khrplatform_h_ */
Several other similar errors.
BUG=None
This reverts commit aac2035d851fc92b159dc8e01cfd2ebb86e99e4a.
Change-Id: I407e7e65bb6a46d1d941c54cdf14a14758e22d96
Reviewed-on: https://chromium-review.googlesource.com/298834
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org> | 
            
              |   | aac2035d | 2015-09-11T13:52:12 |  | Update to the latest versions of the GL and EGL headers.
Add GLES 3.1 and 3.2 headers.
Remove GLES 3.0 extension headers and entry point files.
Change-Id: I8e9df6262dc1b2536a409c5791734e4a4d63b115
Reviewed-on: https://chromium-review.googlesource.com/299341
Tryjob-Request: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org> | 
            
              |   | 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> | 
            
              |   | 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> | 
            
              |   | 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> |