Add/remove more functions to use shims.

Remove normalize and add cos instead to avoid a crash in Mac with ATI cards (angle bug 193, 202).

Also add atan and mod as it's also buggy on Mac/Win with NVIDIA cards.

Also, trying to minimize emulated functions by adding masks for fragment/vertex shaders.

ANGLEBUG=196
Review URL: http://codereview.appspot.com/4992047

git-svn-id: https://angleproject.googlecode.com/svn/trunk@748 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/intermediate.h b/src/compiler/intermediate.h
index 9618ed5..5441557 100644
--- a/src/compiler/intermediate.h
+++ b/src/compiler/intermediate.h
@@ -425,7 +425,10 @@
 
 protected:
     TIntermTyped* operand;
-    bool useEmulatedFunction; // if set to true, replace the function call by an emulated one.
+
+    // If set to true, replace the built-in function call with an emulated one
+    // to work around driver bugs.
+    bool useEmulatedFunction;
 };
 
 typedef TVector<TIntermNode*> TIntermSequence;
@@ -436,8 +439,8 @@
 //
 class TIntermAggregate : public TIntermOperator {
 public:
-    TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0), endLine(0) { }
-    TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
+    TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0), endLine(0), useEmulatedFunction(false) { }
+    TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0), useEmulatedFunction(false) { }
     ~TIntermAggregate() { delete pragmaTable; }
 
     virtual TIntermAggregate* getAsAggregate() { return this; }
@@ -460,6 +463,9 @@
     void setEndLine(TSourceLoc line) { endLine = line; }
     TSourceLoc getEndLine() const { return endLine; }
 
+    void setUseEmulatedFunction() { useEmulatedFunction = true; }
+    bool getUseEmulatedFunction() { return useEmulatedFunction; }
+
 protected:
     TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
     TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
@@ -471,6 +477,10 @@
     bool debug;
     TPragmaTable *pragmaTable;
     TSourceLoc endLine;
+
+    // If set to true, replace the built-in function call with an emulated one
+    // to work around driver bugs.
+    bool useEmulatedFunction;
 };
 
 //