Clean up unary and aggregate math folding
Prefer asserts instead of adding internal errors to the compiler log
when types of arguments are not as expected or the folding function
runs into an operation it can't handle. Neither of these cases should
be possible, the checks for correct argument types are solid at this
point.
In the future, when new built-in functions are added, constant folding
support for them should be added as well.
foldUnaryWithDifferentReturnType and foldUnaryWithSameReturnType are
renamed to foldUnaryNonComponentWise and foldUnaryComponentWise
respectively. These names better reflect what these functions are
doing.
The info sink member is removed from TIntermediate, since TDiagnostics
is now passed into the functions that may generate warnings instead.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I6a08abbe29cf23f3a318032fdc46dd3dbaf4410e
Reviewed-on: https://chromium-review.googlesource.com/377959
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index aba357c..1f1f831 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -219,8 +219,7 @@
++firstSource;
}
- TIntermediate intermediate(infoSink);
- TParseContext parseContext(symbolTable, extensionBehavior, intermediate, shaderType, shaderSpec,
+ TParseContext parseContext(symbolTable, extensionBehavior, shaderType, shaderSpec,
compileOptions, true, infoSink, getResources());
parseContext.setFragmentPrecisionHighOnESSL1(fragmentPrecisionHigh);
@@ -254,7 +253,7 @@
mComputeShaderLocalSize = parseContext.getComputeShaderLocalSize();
root = parseContext.getTreeRoot();
- root = intermediate.postProcess(root);
+ root = TIntermediate::PostProcess(root);
// Highp might have been auto-enabled based on shader version
fragmentPrecisionHigh = parseContext.getFragmentPrecisionHigh();