Add an option in ANGLE shader translator to initialize gl_Position to vec4(0.0, 0.0, 0.0, 1.0).
This is to work around driver bugs where shader compile or program link would fail incorrectly if gl_Position is not set in vertex shader.
At the moment at least Linux NVIDIA driver has this bug.
ANGLEBUG=472
R=alokp@chromium.org, kbr@chromium.org
Review URL: https://codereview.appspot.com/13509043
diff --git a/src/compiler/Compiler.cpp b/src/compiler/Compiler.cpp
index 0a91f9b..4afa73d 100644
--- a/src/compiler/Compiler.cpp
+++ b/src/compiler/Compiler.cpp
@@ -8,6 +8,7 @@
#include "compiler/DetectCallDepth.h"
#include "compiler/ForLoopUnroll.h"
#include "compiler/Initialize.h"
+#include "compiler/InitializeGLPosition.h"
#include "compiler/InitializeParseContext.h"
#include "compiler/MapLongVariableNames.h"
#include "compiler/ParseHelper.h"
@@ -196,6 +197,11 @@
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
mapLongVariableNames(root);
+ if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) {
+ InitializeGLPosition initGLPosition;
+ root->traverse(&initGLPosition);
+ }
+
if (success && (compileOptions & SH_VARIABLES)) {
collectVariables(root);
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {