Compiler - implement gl_FragCoord
TRAC #11381
Signed-off-by: Daniel Koch
git-svn-id: https://angleproject.googlecode.com/svn/trunk@21 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/libGLESv2/Context.cpp b/libGLESv2/Context.cpp
index 9aada33..dfdae60 100644
--- a/libGLESv2/Context.cpp
+++ b/libGLESv2/Context.cpp
@@ -796,6 +796,14 @@
GLfloat xy[2] = {1.0f / description.Width, 1.0f / description.Height};
programObject->setUniform2fv(halfPixelSize, 1, (GLfloat*)&xy);
+ GLuint window = programObject->getUniformLocation("gl_Window");
+ GLfloat whxy[4] = {viewportWidth / 2.0f, viewportHeight / 2.0f, (float)viewportX + viewportWidth / 2.0f, (float)viewportY + viewportHeight / 2.0f};
+ programObject->setUniform4fv(window, 1, (GLfloat*)&whxy);
+
+ GLuint depth = programObject->getUniformLocation("gl_Depth");
+ GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
+ programObject->setUniform2fv(depth, 1, (GLfloat*)&dz);
+
GLuint near = programObject->getUniformLocation("gl_DepthRange.near");
programObject->setUniform1fv(near, 1, &zNear);