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
parent eea70793
...@@ -203,7 +203,7 @@ GLint Program::getSamplerMapping(unsigned int samplerIndex) ...@@ -203,7 +203,7 @@ GLint Program::getSamplerMapping(unsigned int samplerIndex)
logicalTextureUnit = mSamplers[samplerIndex].logicalTextureUnit; logicalTextureUnit = mSamplers[samplerIndex].logicalTextureUnit;
} }
if (logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS) if (logicalTextureUnit >= 0 && logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS)
{ {
return logicalTextureUnit; return logicalTextureUnit;
} }
...@@ -2226,14 +2226,14 @@ bool Program::applyUniform1iv(GLint location, GLsizei count, const GLint *v) ...@@ -2226,14 +2226,14 @@ bool Program::applyUniform1iv(GLint location, GLsizei count, const GLint *v)
{ {
unsigned int firstIndex = mConstantTablePS->GetSamplerIndex(constantPS); 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); ASSERT(mSamplers[samplerIndex].active);
mSamplers[samplerIndex].logicalTextureUnit = mappedSampler; mSamplers[samplerIndex].logicalTextureUnit = v[i];
mSamplers[samplerIndex].dirty = true; mSamplers[samplerIndex].dirty = true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment