|
1ecd14b8
|
2017-01-26T13:54:15
|
|
Fold user-definedness of function nodes into TOperator
Whether a function call is user-defined is not orthogonal to TOperator
associated with the call node - other ops than function calls can't be
user-defined. Because of this it makes sense to store the user-
definedness by having different TOperator enums for different types of
calls.
This patch also tags internal helper functions that have a raw
definition outside the AST with a separate TOperator enum. This way
they can be handled with logic that is easy to understand. Before this,
function calls like this left the user-defined bit unset, despite not
really being built-ins either. The EmulatePrecision traverser uses
this. This is also something that could be used to clean up built-in
emulation in the future.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I597fcd9789d0cc22b689ef3ce5a0cc3f621d4859
Reviewed-on: https://chromium-review.googlesource.com/433443
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
01d0ad08
|
2017-01-22T14:51:23
|
|
Add symbol table function to get TFunction for a built-in op
Built-in function parameter qualifiers are stored in the symbol table.
Some AST traversers need the qualifier information for ops to
determine whether a node is being written to. Add an utility function
that maps a TIntermAggregate node to a symbol table entry, so that the
traversers can get to this information in a convenient way.
This will be necessary for adding more built-ins that have out
parameters from ESSL 3.10.
BUG=angleproject:1730
TEST=angle_unittests
Change-Id: I4bc622d70b2326a04cc858ff1258c22320c590dc
Reviewed-on: https://chromium-review.googlesource.com/431109
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
1d9dcc24
|
2017-01-19T11:25:32
|
|
Make AST path always include the current node being traversed
AST traversers tend to sometimes call traverse() functions manually
during PreVisit. Change TIntermTraverser so that even if this happens,
all the nodes are automatically added to the traversal path, instead
of having to add them manually in each individual AST traverser.
This also makes calling getParentNode() return the correct node during
InVisit.
This does cause the same node being added to the traversal path twice
in some cases, where nodes are repeatedly traversed, like in
OutputHLSL, but this should not have adverse side effects. The more
common case is that the traverse() function is called on the children
of the node being currently traversed.
This fixes a bug in OVR_multiview validation, which did not previously
call incrementDepth and decrementDepth when it should have.
BUG=angleproject:1725
TEST=angle_unittests, angle_end2end_tests
Change-Id: I6ae762eef760509ebe853eefa37dac28c16e7a9b
Reviewed-on: https://chromium-review.googlesource.com/430732
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
8ad9e757
|
2017-01-16T19:55:20
|
|
Always store function headers in TIntermFunctionPrototype nodes
TIntermFunctionDefinition nodes now have a TIntermFunctionPrototype
child that stores the function signature, instead of having a separate
type and an aggregate child that stores the parameters.
This makes parsing functions simpler, and paves the way for further
simplifications of function parsing, like reducing conversions between
symbol table structures and AST structures.
TIntermAggregate is now only used for function calls.
BUG=angleproject:1490
TEST=angle_unittests, angle_end2end_tests
Change-Id: Ib56a77b5ef5123b142963a18499690bf37fed987
Reviewed-on: https://chromium-review.googlesource.com/427945
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
16c745a3
|
2017-01-16T17:02:27
|
|
Split TIntermFunctionPrototype from TIntermAggregate
Function prototypes now have their own class TIntermFunctionPrototype.
It's only used for prototypes, not function parameter lists.
TIntermAggregate is still used for parameter lists and function calls.
BUGS=angleproject:1490
TEST=angle_unittests
Change-Id: I6e246ad00a29c2335bd2ab7f61cf73fe463b74bb
Reviewed-on: https://chromium-review.googlesource.com/427944
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
bf4e1b73
|
2016-12-09T11:30:15
|
|
Split TIntermInvariantDeclaration from TIntermAggregate
This change is pure refactoring and doesn't fix bugs related to
invariant declarations. Invariant declarations are supposed to accept
a list of identifiers, but this refactoring keeps the current behavior
of only accepting a single identifier in an invariant declaration.
When the bug will be fixed, the new TIntermInvariantDeclaration class
that now has only a single child node can be changed so that it may
have multiple children.
TIntermAggregate is still used for function calls, function
prototypes and function parameter lists.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I3e22092c87e1c06445fd7e123d9922c2fcb59428
Reviewed-on: https://chromium-review.googlesource.com/419415
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
d7b1ab58
|
2016-12-12T14:42:19
|
|
Fix up translator style.
Using git cl format.
BUG=angleproject:650
Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761
Reviewed-on: https://chromium-review.googlesource.com/419059
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
|
45bcc784
|
2016-11-07T13:58:48
|
|
translator: Scope all classes with "sh".
I was seeing an odd problem with our PoolAlloc conflicting with the
glslang/Vulkan TIntermNode, so the fix was to move everything to a
separate namespace.
The bison grammars are also regenerated. No functional changes.
BUG=angleproject:1576
Change-Id: I959c7afe4c092f0d458432c07b4dcee4d39513f3
Reviewed-on: https://chromium-review.googlesource.com/408267
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
|
b990b55e
|
2016-10-27T12:29:17
|
|
Clean up temporary variable usage in ScalarizeVecAndMatConstructorArgs
Use common helper functions instead of manually creating temporary
variable nodes. Also clean up the interface provided by the traverser.
BUG=angleproject:1597
Test=WebGL conformance tests
Change-Id: Ifd8d3815ff9e75e1a2040d65db9d4b3d6a9a9273
Reviewed-on: https://chromium-review.googlesource.com/403950
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
13389b66
|
2016-10-16T11:48:18
|
|
Split TIntermDeclaration from TIntermAggregate
The new class TIntermDeclaration is now used for struct, interface
block and variable declarations. TIntermDeclaration nodes do not have
a type - rather the type is stored in each child node. The types may
differ in case the declaration is a series of array declarators with
mismatching sizes.
TIntermAggregate is still used for function calls, function
prototypes, function parameter lists and invariant declarations.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I0457188f354481470855f61ac1c878fc2579b1d1
Reviewed-on: https://chromium-review.googlesource.com/400023
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
|
|
336b1470
|
2016-10-05T16:37:55
|
|
Split TIntermFunctionDefinition from TIntermAggregate
This makes the code easier to understand. Function definition nodes
always have just two children, the parameters node and the function
body node, so there was no proper reason why they should be aggregate
nodes.
As a part of this change, intermediate output is modified to print
symbol table ids of functions so that debugging function id related
functionality will be easier in the future.
After this patch, TIntermAggregate is still used for function
prototypes, function parameter lists, function calls, variable and
invariant declarations and the comma (sequence) operator.
BUG=angleproject:1490
TEST=angle_unittests, angle_end2end_tests
Change-Id: Ib88b4ca5d21abd5f126836ca5900d0baecabd19e
Reviewed-on: https://chromium-review.googlesource.com/394707
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
|
bd674557
|
2016-10-06T13:28:42
|
|
Separate function info from TIntermAggregate
This change will make it easier to split types of TIntermAggregate
nodes representing functions and function calls into different node
classes.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I730aa7858fe31fda86218fc685980c6ad486f5e0
Reviewed-on: https://chromium-review.googlesource.com/394706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
6d40bbdd
|
2016-09-30T13:49:38
|
|
Split TIntermBlock from TIntermAggregate
The new TIntermBlock node class replaces TIntermAggregate nodes with
the EOpSequence op. It represents the root node of the tree which is
a list of declarations and function definitions, and any code blocks
that can be denoted by curly braces. These include function and loop
bodies, and if-else branches.
This change enables a bunch of more compile-time type checking, and
makes the AST code easier to understand and less error-prone.
The PostProcess step that used to be done to ensure that the root node
is TIntermAggregate is removed in favor of making sure that the root
node is a TIntermBlock in the glslang.y parsing code.
Intermediate output formatting is improved to print the EOpNull error
in a clearer way.
After this patch, TIntermAggregate is still used for function
definitions, function prototypes, function parameter lists, function
calls, variable and invariant declarations and the comma (sequence)
operator.
BUG=angleproject:1490
TEST=angle_unittests, angle_end2end_tests
Change-Id: I04044affff979a11577bc1fe75d747e538b799c8
Reviewed-on: https://chromium-review.googlesource.com/393726
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
|
|
65c79dbc
|
2016-10-06T17:11:28
|
|
Clean up RecordConstantPrecision interaction with switch/case
There were two bugs here that were masking each other:
1. Case nodes were not being added to AST traversal path.
2. RecordConstantPrecision did not check if a constant was a child of
a case node.
Fix these.
BUG=angleproject:1490
TEST=WebGL 2 conformance tests
Change-Id: Ic6cb7942bf57870fa26eb6a011919a2d7951cc85
Reviewed-on: https://chromium-review.googlesource.com/394588
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
b6fa043d
|
2016-09-28T16:28:05
|
|
Split vector swizzle AST nodes into a different node class
This avoids creating a weird aggregate node with a sequence of
constant union nodes to store the offsets. They're stored neatly
inside a vector instead. This makes code that needs to iterate
over the swizzle offsets much simpler.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I156b95723529ee05a94d30295ffb6d0952a98564
Reviewed-on: https://chromium-review.googlesource.com/390832
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
5796127e
|
2016-09-14T13:57:46
|
|
Rename TIntermSelection to TIntermIfElse
Now that ternary nodes are not represented by TIntermSelection any
more, TIntermIfElse is an easier name to understand for newcomers to
the code.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ia1e04e356ab93409400245092a84533d7dfd129d
Reviewed-on: https://chromium-review.googlesource.com/385416
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
d0bad2c7
|
2016-09-09T18:01:16
|
|
Split ternary node class from TIntermSelection
Ternary operator nodes are typed parts of expressions, they always
have two children and the children are also guaranteed to be
TIntermTyped. "If" selection nodes can't be a part of an expression,
they can have either one or two children and the children are code
blocks. Due to all of these differences it makes sense to store these
using two different AST node classes.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I913ab1d806e3cdb5c21106f078cc9c0b6c72ac54
Reviewed-on: https://chromium-review.googlesource.com/384512
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
|
|
3272a6d3
|
2016-08-29T17:54:50
|
|
Promote and fold indexing nodes similarly to other binary ops
Indexing nodes now get their type set in TIntermBinary::promote, same
as math and logic ops. They are also constant folded through
TIntermBinary::fold() instead of having special functions for constant
folding them in ParseContext.
Index nodes for struct and interface block member access now always
have integer type, instead of sometimes having the type of the field
they were used to access.
Usage of TIntermBinary constructor is cleaned up so only the
constructor that takes in left and right operands is used. The type
of TIntermBinary nodes is always determined automatically.
Together these changes make the code considerably cleaner.
Note that the code for constant folding for array indexing is actually
never hit because constant folding array constructors is still
intentionally disabled in the code.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ifcec45257476cdb0d495c7d72e3cf2f83388e8c5
Reviewed-on: https://chromium-review.googlesource.com/377961
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
03d863c8
|
2016-07-27T18:15:53
|
|
translator: Refactor node replacement APIs.
BUG=angleproject:851
Change-Id: I50c3b3a4f00b27fed85f09509738513a441c7b5b
Reviewed-on: https://chromium-review.googlesource.com/363990
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
|
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>
|
|
d4f4c11b
|
2016-04-15T15:11:24
|
|
Fix deferring global array initialization
The initial implementation of DeferGlobalInitializers did not take
HLSL corner cases into account. In particular, in case there was a
const-qualified array variable with an initializer that contained
elements that weren't constant folded, initialization would not be
deferred and the global scope of HLSL output would contain a call to
angle_construct_into_*().
On the other hand, deferring global initializers was also done in
cases where it wasn't necessary. Initializers of non-const qualified
array variables that could be written as HLSL literals by HLSL output
were unnecessarily deferred.
This patch fixes both of these issues: Now all global initializers are
potential candidates for deferral instead of just those where the
symbol has the EvqGlobal qualifier, and initializers that are
constructors taking only constant unions as parameters are not
unnecessarily deferred.
BUG=angleproject:1205
BUG=541551
TEST=angle_end2end_tests
Change-Id: I4027059e0e5f39c8a5a48b5c97a3fceaac6b6f8a
Reviewed-on: https://chromium-review.googlesource.com/339201
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
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>
|
|
5f579b1b
|
2015-08-14T17:44:43
|
|
Improve handling of internal function calls
Many parts of the shader translator that deal with function calls have
been written without internal function calls in mind. Fix some of these
so that they can handle internal function calls.
-Fix TLValueTrackingTraverser handling a shader where there are an
internal and non-internal function of the same name.
-Maintain internalness when shallow copying function calls in
SeparateExpressionReturningArrays and ArrayReturnValueToOutParameter
AST transformations.
-Output function internalness in intermOut.
BUG=angleproject:1116
TEST=angle_unittests
Change-Id: Ic65e2803062b807651f1b3952409face6aceb780
Reviewed-on: https://chromium-review.googlesource.com/303353
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@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>
|
|
59f9a641
|
2015-08-06T20:38:26
|
|
Remove EOpInternalFunctionCall
It's cleaner to mark internal functions by using the TName class,
similarly to TIntermSymbol.
TEST=angle_unittests
BUG=angleproject:1116
Change-Id: I12a03a3dea42b3fc571fa25a1b11d0161f24de72
Reviewed-on: https://chromium-review.googlesource.com/291621
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
217fe6ec
|
2015-08-05T13:25:08
|
|
Detect when built-in modf requires an l-value in AST traversal
This fixes an omission that out parameter tracking had inherited from
EmulatePrecision. Accurate tracking of when values are written is
required for converting dynamic indexing of vectors and matrices to
function calls.
A new test covering this is added to angle_unittests.
TEST=angle_unittests
BUG=angleproject:1116
Change-Id: I05c5fd60355117d0053b84110748ae221375a790
Reviewed-on: https://chromium-review.googlesource.com/290562
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
3fc9337f
|
2015-08-11T14:50:59
|
|
Refactor l-value tracking to a separate traverser parent class
This makes TIntermTraverser implementation easier to understand and
removes the overhead of maintaining the user-defined GLSL function table
from the traversers that don't need it.
Some logic is duplicated between TIntermTraverser and its new subclass
TLValueTrackingTraverser, but duplication is hard to eliminate completely
since there are some differences scattered throughout the code.
BUG=angleproject:1116
TEST=angle_unittests
Change-Id: Iab4a0c1d4320ecfafaf18ea3a45824d756890774
Reviewed-on: https://chromium-review.googlesource.com/292721
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
27446bda
|
2015-08-10T14:59:53
|
|
Move traverse functions under TIntermTraverser
This enables implementing specialized variants of TIntermTraverser.
Intermediate subclasses of TIntermTraverser are expected to maintain
contextual information in their traverse* functions, which is then used
by the visit* functions in the actual traversers.
This approach is better than adding a flag to TIntermTraverser, since
it will make the code cleaner and easier to understand.
Traverse() functions in TIntermNode subclasses are still kept around to
redirect calls to TIntermTraverser traversal functions. This is less
hacky than choosing the function with switch/case in TIntermTraverser
would be, and if new TIntermNode subclasses get added, it's not as likely
that adding the traversal support would be forgotten.
TEST=angle_unittests
BUG=angleproject:1116
Change-Id: Ie6889be1d7e955518f13cd3390dce17871ba49b5
Reviewed-on: https://chromium-review.googlesource.com/292720
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
|
|
8afe1e1b
|
2015-08-05T18:00:01
|
|
Track that indices of l-values are not required to be l-values
In an expression like a[ind]++, a[ind] is required to be an l-value but
ind is not. Reset the l-value required flags before traversing the index
of an indexing operation, so that this is accurately tracked. After the
index has been traversed, the previous state of the l-value required
flags is restored.
New tests are added to angle_unittests cover this functionality.
TEST=angle_unittests
BUG=angleproject:1116
Change-Id: I8929ec01e85e672c83ef7d385e455b7df8682f4b
Reviewed-on: https://chromium-review.googlesource.com/290561
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
a26ad58d
|
2015-08-04T13:51:47
|
|
Track where l-values are required in AST traversal
This functionality is refactored out of EmulatePrecision to be a common
feature of TIntermTraverser. This is done since tracking where l-values
are required will be useful for other traversers. For example, it will
be needed for converting dynamic indexing of matrices and vectors to
function calls. This change adds some overhead to all tree traversers,
but the overhead is expected to be small for typical shaders which don't
contain too many user-defined functions.
BUG=angleproject:1116
TEST=angle_unittests
Change-Id: I54d34c2b5093ef028f2b24d854c11c0195dc1dbb
Reviewed-on: https://chromium-review.googlesource.com/290514
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
a4aa4e30
|
2015-06-04T15:54:30
|
|
Record precision of constant variables when needed
Add a traverser that checks precision qualifiers of folded constants and
hoists them to separate precision qualified variables if needed.
Fixes sdk/tests/conformance/glsl/bugs/constant-precision-qualifier.html
TEST=WebGL conformance tests, angle_unittests
BUG=angleproject:817
Change-Id: I1639595e0e49470736be93274f0af07ee732e1fe
Reviewed-on: https://chromium-review.googlesource.com/275095
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
64f0be91
|
2015-06-03T17:38:34
|
|
Remove unused right-to-left AST traversal support
No code actually uses the right-to-left traversal. All it does is add
unnecessary complexity.
TEST=angle_unittests, angle_end2end_tests
BUG=angleproject:1037
Change-Id: Id15498343538c02c252ef0852f9a00c85ac3c4bb
Reviewed-on: https://chromium-review.googlesource.com/275183
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
4f1af784
|
2015-05-25T11:55:07
|
|
Handle function calls where returned array is not used
This is done by declaring a temporary variable which is passed as the
array out parameter defined by ArrayReturnValueToOutParameter.
SeparateExpressionsReturningArrays takes care of transforming the rest of
the cases where a function call returns an array into form that
ArrayReturnValueToOutParameter can handle.
BUG=angleproject:971
TEST=WebGL 2 conformance tests, dEQP-GLES3.functional.shaders.arrays.*
Change-Id: I70c07712ba5cd91efb4c2e575ecc49b9ef71bfd7
Reviewed-on: https://chromium-review.googlesource.com/273111
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
d4f303ee
|
2015-05-20T17:09:06
|
|
Refactoring: Make creating temporary symbols in AST traversal reusable
Temporary symbols will also be needed to store temporary arrays when complex
array expressions are unfolded.
Also clear tree update related structures at the end of updateTree(), so that
the traverser can be reused for several rounds of replacement more easily, and
remove unnecessary InVisit step from UnfoldShortCircuitToIf.
BUG=angleproject:971
TEST=angle_end2end_tests, WebGL conformance tests
Change-Id: Iecdd3008d43f01b02fe344ccde8614f70e6c0c65
Reviewed-on: https://chromium-review.googlesource.com/272121
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
56eea884
|
2015-05-18T12:41:03
|
|
Refactoring: make tracking parent block position in AST traversal reusable
Add a helper function to make it easier for traverser classes to insert
statements, and use it in UnfoldShortCircuitToIf.
BUG=angleproject:971
TEST=angle_end2end_tests, WebGL conformance tests
Change-Id: I141bdd8abf4b01988581e6cb27c2320bf38370ac
Reviewed-on: https://chromium-review.googlesource.com/272140
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
a3a36664
|
2015-02-17T13:46:51
|
|
Implement parsing switch statements
Put in some groundwork for parsing switch statements and case labels in
the parser, including definitions for IntermNode classes. Intermediate
functions for adding the statements are stubbed to only generate errors
for now.
Tested by manually disabling shading language version checks for switch
in a Chromium build and checking that the expected errors are generated.
BUG=angle:921
Change-Id: I064b3e0c4c1b724a083cf5bc78eebfdd3794eb1b
Reviewed-on: https://chromium-review.googlesource.com/250380
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
b1a85f48
|
2014-08-19T15:23:24
|
|
Rename compiler intermediate source files.
This prevents confusion between "TIntermediate" and "TIntermNode".
BUG=angle:711
Change-Id: Ib7a086382a479db3f77bf2ab06ce321aa7b35d13
Reviewed-on: https://chromium-review.googlesource.com/212936
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
e40d1e9c
|
2014-07-16T17:40:36
|
|
Fix style violations.
BUG=angle:650
TEST=no behavior change
Change-Id: I3096615a181b1ec2c18ce60566c3d6249975b84e
Reviewed-on: https://chromium-review.googlesource.com/208569
Tested-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
4cfb1e89
|
2014-07-07T12:49:23
|
|
Add a new TIntermRaw node type to translator.
This raw node stores text strings that we directly copy to the
output. This allows for more tricky substitutions that don't fit
in to the HLSL/GLSL shared parsing model.
BUG=346463
BUG=391697
Change-Id: Ibbde6db4fc98ef6d892f219631ca1a258a902a86
Reviewed-on: https://chromium-review.googlesource.com/206823
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
|
|
7cab38b5
|
2013-10-15T12:59:30
|
|
Add an option to unfold short circuiting in AST.
We replace "a || b" with "a ? true : b",
"a && b" with "a ? b : false".
This is to work around short circuiting bug in Mac drivers.
ANGLEBUG=482
TEST=webgl conformance tests
R=alokp@chromium.org, kbr@chromium.org
Review URL: https://codereview.appspot.com/14529048
Conflicts:
src/build_angle.gypi
src/compiler/translator/Compiler.cpp
Change-Id: Ic2384a97d58f54294efcb3a012deb2007a9fc658
Reviewed-on: https://chromium-review.googlesource.com/178996
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
|
|
6cb95f3a
|
2013-10-03T17:01:52
|
|
Fix a traverse bug.
In loop node, the init part was skipped in traversing.
BUG=
TEST=
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/14366043
Change-Id: If3200f1dbcafda1147820b2d47b758b897de0fc6
Reviewed-on: https://chromium-review.googlesource.com/178992
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
|
|
e88dcaf3
|
2013-10-03T16:55:19
|
|
Style violation cleanup for IntermTraverse.cpp
Per suggested by kbr in https://codereview.appspot.com/14366043/, we clean up the stype violation in a separate CL.
BUG=
TEST=no behavioral change
TBR=kbr@chromium.org
Review URL: https://codereview.appspot.com/14371043
Change-Id: I27e15f632eff3a9d0d22ae955b5a952793128661
Reviewed-on: https://chromium-review.googlesource.com/178991
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
|
|
17732823
|
2013-08-29T13:46:49
|
|
Moved the compiler source files into directories based on their project and added a compiler.gypi to generate the compiler projects.
|