Micro-optimize Uniform updates.
This saves a few re-computations of the same stuff.
BUG=angleproject:1671
Change-Id: I28f955cd880366a86c0bb22285a119e97661e2cb
Reviewed-on: https://chromium-review.googlesource.com/427326
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 106923c..5baf191 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2700,19 +2700,34 @@
return false;
}
- if (program->isIgnoredUniformLocation(location))
+ if (location == -1)
{
// Silently ignore the uniform command
return false;
}
- if (!program->isValidUniformLocation(location))
+ const auto &uniformLocations = program->getUniformLocations();
+ size_t castedLocation = static_cast<size_t>(location);
+ if (castedLocation >= uniformLocations.size())
+ {
+ context->handleError(Error(GL_INVALID_OPERATION, "Invalid uniform location"));
+ return false;
+ }
+
+ const auto &uniformLocation = uniformLocations[castedLocation];
+ if (uniformLocation.ignored)
+ {
+ // Silently ignore the uniform command
+ return false;
+ }
+
+ if (!uniformLocation.used)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
- const LinkedUniform &uniform = program->getUniformByLocation(location);
+ const auto &uniform = program->getUniformByIndex(uniformLocation.index);
// attempting to write an array to a non-array uniform is an INVALID_OPERATION
if (!uniform.isArray() && count > 1)