Compiler - implement gl_DepthRange
TRAC #11380
Signed-off-by: Daniel Koch

Author:    Nicolas Capens <nicolas@transgaming.com>

git-svn-id: https://angleproject.googlecode.com/svn/trunk@16 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/Compiler/OutputHLSL.cpp b/Compiler/OutputHLSL.cpp
index 4870a6f..99a747c 100644
--- a/Compiler/OutputHLSL.cpp
+++ b/Compiler/OutputHLSL.cpp
@@ -57,8 +57,8 @@
         }
 
         out <<  uniforms;
-        out << "\n";
-        out << "struct PS_INPUT\n"   // FIXME: Prevent name clashes
+        out << "\n"
+               "struct PS_INPUT\n"   // FIXME: Prevent name clashes
                "{\n";
         out <<        varyingInput;
         out << "};\n"
@@ -167,7 +167,16 @@
         out << "\n";
     }
 
-    out << "float vec1(float x)\n"   // FIXME: Prevent name clashes
+    out << "struct gl_DepthRangeParameters\n"
+           "{\n"
+           "    float near;\n"
+           "    float far;\n"
+           "    float diff;\n"
+           "};\n"
+           "\n"
+           "uniform gl_DepthRangeParameters gl_DepthRange;\n"
+           "\n"
+           "float vec1(float x)\n"   // FIXME: Prevent name clashes
            "{\n"
            "    return x;\n"
            "}\n"
@@ -387,10 +396,10 @@
 
     switch (node->getOp())
     {
-      case EOpAssign:                  outputTriplet(visit, "(", " = ", ")");     break;

-      case EOpInitialize:              outputTriplet(visit, NULL, " = ", NULL);   break;

-      case EOpAddAssign:               outputTriplet(visit, NULL, " += ", NULL);  break;

-      case EOpSubAssign:               outputTriplet(visit, NULL, " -= ", NULL);  break;

+      case EOpAssign:                  outputTriplet(visit, "(", " = ", ")");     break;
+      case EOpInitialize:              outputTriplet(visit, NULL, " = ", NULL);   break;
+      case EOpAddAssign:               outputTriplet(visit, NULL, " += ", NULL);  break;
+      case EOpSubAssign:               outputTriplet(visit, NULL, " -= ", NULL);  break;
       case EOpMulAssign:               outputTriplet(visit, NULL, " *= ", NULL);  break;
       case EOpVectorTimesMatrixAssign: UNIMPLEMENTED(); /* FIXME */ out << "matrix mult second child into first child";  break;
       case EOpVectorTimesScalarAssign: outputTriplet(visit, NULL, " *= ", NULL);  break;
@@ -921,17 +930,17 @@
     
     TType &type = node->getType();
 
-    if(type.isField())

-    {

-        out << type.getFieldName();

-    }

-    else

-    {

-        int size = type.getObjectSize();

-        bool matrix = type.isMatrix();

-        TBasicType basicType = node->getUnionArrayPointer()[0].getType();

-

-        switch (basicType)

+    if (type.isField())
+    {
+        out << type.getFieldName();
+    }
+    else
+    {
+        int size = type.getObjectSize();
+        bool matrix = type.isMatrix();
+        TBasicType basicType = node->getUnionArrayPointer()[0].getType();
+
+        switch (basicType)
         {
           case EbtBool:
             if (!matrix)
@@ -1023,9 +1032,9 @@
                 out << ", ";
             }
         }
-    }
 
-    out << ")";
+        out << ")";
+    }
 }
 
 bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)