Fix support for arrays of sampler uniforms.
TRAC #14840
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@510 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index eaa88f2..780c3e3 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -203,7 +203,7 @@
logicalTextureUnit = mSamplers[samplerIndex].logicalTextureUnit;
}
- if (logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS)
+ if (logicalTextureUnit >= 0 && logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS)
{
return logicalTextureUnit;
}
@@ -2226,14 +2226,14 @@
{
unsigned int firstIndex = mConstantTablePS->GetSamplerIndex(constantPS);
- for (unsigned int samplerIndex = firstIndex; samplerIndex < firstIndex + count; samplerIndex++)
+ for (int i = 0; i < count; i++)
{
- GLint mappedSampler = v[0];
+ unsigned int samplerIndex = firstIndex + i;
- if (samplerIndex >= 0 && samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
+ if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
{
ASSERT(mSamplers[samplerIndex].active);
- mSamplers[samplerIndex].logicalTextureUnit = mappedSampler;
+ mSamplers[samplerIndex].logicalTextureUnit = v[i];
mSamplers[samplerIndex].dirty = true;
}
}