Consider out-of-range texture units to be incomplete.
TRAC #12224
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Andrew Lewycky
git-svn-id: https://angleproject.googlecode.com/svn/trunk@271 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index 71960b3..160eb86 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -190,9 +190,16 @@
{
assert(samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]));
+ GLint logicalTextureUnit = -1;
+
if (mSamplers[samplerIndex].active)
{
- return mSamplers[samplerIndex].logicalTextureUnit;
+ logicalTextureUnit = mSamplers[samplerIndex].logicalTextureUnit;
+ }
+
+ if (logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS)
+ {
+ return logicalTextureUnit;
}
return -1;
@@ -1816,14 +1823,11 @@
{
GLint mappedSampler = v[0];
- if (mappedSampler >= 0 && mappedSampler < MAX_TEXTURE_IMAGE_UNITS)
+ if (samplerIndex >= 0 && samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
{
- if (samplerIndex >= 0 && samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
- {
- ASSERT(mSamplers[samplerIndex].active);
- mSamplers[samplerIndex].logicalTextureUnit = mappedSampler;
- mSamplers[samplerIndex].dirty = true;
- }
+ ASSERT(mSamplers[samplerIndex].active);
+ mSamplers[samplerIndex].logicalTextureUnit = mappedSampler;
+ mSamplers[samplerIndex].dirty = true;
}
}