Caches the location of generic uniforms
TRAC #12215
Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

Author:    Shannon Woods

git-svn-id: https://angleproject.googlecode.com/svn/trunk@298 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index 9fc5ed6..7e99fe5 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -1494,6 +1494,15 @@
                 return;
             }
 
+            mDepthRangeNearLocation = getUniformLocation("gl_DepthRange.near");
+            mDepthRangeFarLocation = getUniformLocation("gl_DepthRange.far");
+            mDepthRangeDiffLocation = getUniformLocation("gl_DepthRange.diff");
+            mDxDepthLocation = getUniformLocation("dx_Depth");
+            mDxWindowLocation = getUniformLocation("dx_Window");
+            mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize");
+            mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW");
+            mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines");
+
             mLinked = true;   // Success
         }
     }
@@ -2394,6 +2403,15 @@
         mUniforms.pop_back();
     }
 
+    mDepthRangeDiffLocation = -1;
+    mDepthRangeNearLocation = -1;
+    mDepthRangeFarLocation = -1;
+    mDxDepthLocation = -1;
+    mDxWindowLocation = -1;
+    mDxHalfPixelSizeLocation = -1;
+    mDxFrontCCWLocation = -1;
+    mDxPointsOrLinesLocation = -1;
+
     mUniformIndex.clear();
 
     mPixelHLSL.clear();
@@ -2693,4 +2711,45 @@
     *constantPS = targetUniform->psHandle;
     *constantVS = targetUniform->vsHandle;
 }
+
+GLint Program::getDepthRangeDiffLocation() const
+{
+    return mDepthRangeDiffLocation;
+}
+
+GLint Program::getDepthRangeNearLocation() const
+{
+    return mDepthRangeFarLocation;
+}
+
+GLint Program::getDepthRangeFarLocation() const
+{
+    return mDepthRangeFarLocation;
+}
+
+GLint Program::getDxDepthLocation() const
+{
+    return mDxDepthLocation;
+}
+
+GLint Program::getDxWindowLocation() const
+{
+    return mDxWindowLocation;
+}
+
+GLint Program::getDxHalfPixelSizeLocation() const
+{
+    return mDxHalfPixelSizeLocation;
+}
+
+GLint Program::getDxFrontCCWLocation() const
+{
+    return mDxFrontCCWLocation;
+}
+
+GLint Program::getDxPointsOrLinesLocation() const
+{
+    return mDxPointsOrLinesLocation;
+}
+
 }