Add a compiler option to rewrite vec/mat constructors
If one of the parameters is a vec/mat, expand it into scalars.
This is to work around Linux NVIDIA/AMD and Mac NVIDIA driver bugs.
BUG=angle:695
TEST=webgl conformance test
Change-Id: I35e1e25167d99f873dcb03bfb57a30e84b1aeed5
Reviewed-on: https://chromium-review.googlesource.com/207479
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 86ef6c3..0606c72 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -13,6 +13,7 @@
#include "compiler/translator/InitializeVariables.h"
#include "compiler/translator/ParseContext.h"
#include "compiler/translator/RenameFunction.h"
+#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
#include "compiler/translator/UnfoldShortCircuitAST.h"
#include "compiler/translator/ValidateLimitations.h"
#include "compiler/translator/ValidateOutputs.h"
@@ -254,6 +255,12 @@
initializeVaryingsWithoutStaticUse(root);
}
+ if (success && (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS))
+ {
+ ScalarizeVecAndMatConstructorArgs scalarizer;
+ root->traverse(&scalarizer);
+ }
+
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
intermediate.outputTree(root);