Fixed skipping over internal uniforms in getActiveUniform.
TRAC #14390
Signed-off-by: Daniel Koch
git-svn-id: https://angleproject.googlecode.com/svn/trunk@483 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index a4d05c0..ef0fe64 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1658,6 +1658,9 @@
D3DSURFACE_DESC desc;
renderTarget->GetDesc(&desc);
+ float zNear = clamp01(mState.zNear);
+ float zFar = clamp01(mState.zFar);
+
if (ignoreViewport)
{
viewport.X = 0;
@@ -1673,8 +1676,8 @@
viewport.Y = std::max(mState.viewportY, 0);
viewport.Width = std::min(mState.viewportWidth, (int)desc.Width - (int)viewport.X);
viewport.Height = std::min(mState.viewportHeight, (int)desc.Height - (int)viewport.Y);
- viewport.MinZ = clamp01(mState.zNear);
- viewport.MaxZ = clamp01(mState.zFar);
+ viewport.MinZ = zNear;
+ viewport.MaxZ = zFar;
}
if (viewport.Width <= 0 || viewport.Height <= 0)
@@ -1720,17 +1723,17 @@
programObject->setUniform4fv(window, 1, (GLfloat*)&whxy);
GLint depth = programObject->getDxDepthLocation();
- GLfloat dz[2] = {(mState.zFar - mState.zNear) / 2.0f, (mState.zNear + mState.zFar) / 2.0f};
+ GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
programObject->setUniform2fv(depth, 1, (GLfloat*)&dz);
GLint near = programObject->getDepthRangeNearLocation();
- programObject->setUniform1fv(near, 1, &mState.zNear);
+ programObject->setUniform1fv(near, 1, &zNear);
GLint far = programObject->getDepthRangeFarLocation();
- programObject->setUniform1fv(far, 1, &mState.zFar);
+ programObject->setUniform1fv(far, 1, &zFar);
GLint diff = programObject->getDepthRangeDiffLocation();
- GLfloat zDiff = mState.zFar - mState.zNear;
+ GLfloat zDiff = zFar - zNear;
programObject->setUniform1fv(diff, 1, &zDiff);
}
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index c5e7505..45f5c07 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -1374,7 +1374,7 @@
{
mPixelHLSL += " float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
if (sm3) {
- mPixelHLSL += " float4 dx_VPos : VPOS;\n";
+ mPixelHLSL += " float2 dx_VPos : VPOS;\n";
}
}
@@ -2641,18 +2641,26 @@
void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
{
- unsigned int uniform = 0;
- for (unsigned int i = 0; i < index; i++)
+ // Skip over internal uniforms
+ unsigned int activeUniform = 0;
+ unsigned int uniform;
+ for (uniform = 0; uniform < mUniforms.size(); uniform++)
{
- do
+ while (mUniforms[uniform]->name.substr(0, 3) == "dx_")
{
uniform++;
-
- ASSERT(uniform < mUniforms.size()); // index must be smaller than getActiveUniformCount()
}
- while (mUniforms[uniform]->name.substr(0, 3) == "dx_");
+
+ if (activeUniform == index)
+ {
+ break;
+ }
+
+ activeUniform++;
}
+ ASSERT(uniform < mUniforms.size()); // index must be smaller than getActiveUniformCount()
+
if (bufsize > 0)
{
std::string string = undecorate(mUniforms[uniform]->name);