Use a map to store uniform locations instead of a vector.
Some intel drivers use seemingly arbitrary integers as uniform locations.
This causes the location vector to be resized to arbitrarily large sizes.
BUG=angleproject:882
Change-Id: I8db89178907dd6206eb8e646a0b426aa9bac0832
Reviewed-on: https://chromium-review.googlesource.com/274816
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 05b9691..23a414e 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -831,8 +831,9 @@
bool Program::isValidUniformLocation(GLint location) const
{
- ASSERT(rx::IsIntegerCastSafe<GLint>(mProgram->getUniformIndices().size()));
- return (location >= 0 && location < static_cast<GLint>(mProgram->getUniformIndices().size()));
+ const auto &uniformIndices = mProgram->getUniformIndices();
+ ASSERT(rx::IsIntegerCastSafe<GLint>(uniformIndices.size()));
+ return (location >= 0 && uniformIndices.find(location) != uniformIndices.end());
}
LinkedUniform *Program::getUniformByLocation(GLint location) const