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>
diff --git a/src/compiler/translator/ValidateMultiviewWebGL.cpp b/src/compiler/translator/ValidateMultiviewWebGL.cpp
index 08ae816..fa6cf02 100644
--- a/src/compiler/translator/ValidateMultiviewWebGL.cpp
+++ b/src/compiler/translator/ValidateMultiviewWebGL.cpp
@@ -354,27 +354,24 @@
{
// Check if the node is an user-defined function call or if an l-value is required, or if
// there are possible visible side effects, such as image writes.
- if (node->getOp() == EOpFunctionCall)
+ if (node->getOp() == EOpCallFunctionInAST)
{
- if (node->isUserDefined())
- {
- mDiagnostics->error(node->getLine(),
- "Disallowed user defined function call inside assignment to "
- "gl_Position.x when using OVR_multiview",
- GetOperatorString(node->getOp()));
- mValid = false;
- }
- else if (TFunction::unmangleName(node->getFunctionSymbolInfo()->getName()) ==
- "imageStore")
- {
- // TODO(oetuaho@nvidia.com): Record which built-in functions have side effects in
- // the symbol info instead.
- mDiagnostics->error(node->getLine(),
- "Disallowed function call with side effects inside assignment "
- "to gl_Position.x when using OVR_multiview",
- GetOperatorString(node->getOp()));
- mValid = false;
- }
+ mDiagnostics->error(node->getLine(),
+ "Disallowed user defined function call inside assignment to "
+ "gl_Position.x when using OVR_multiview",
+ GetOperatorString(node->getOp()));
+ mValid = false;
+ }
+ else if (node->getOp() == EOpCallBuiltInFunction &&
+ TFunction::unmangleName(node->getFunctionSymbolInfo()->getName()) == "imageStore")
+ {
+ // TODO(oetuaho@nvidia.com): Record which built-in functions have side effects in
+ // the symbol info instead.
+ mDiagnostics->error(node->getLine(),
+ "Disallowed function call with side effects inside assignment "
+ "to gl_Position.x when using OVR_multiview",
+ GetOperatorString(node->getOp()));
+ mValid = false;
}
else if (!node->isConstructor())
{