Removed "name" and "used" from variable location.
The used flag was redundant with the index (which used MAXUINT). The
name was redundant with the stored uniform. Removing these gives a
very minor performance speed up when iterating and retrieving
uniform locations.
BUG=angleproject:1390
Change-Id: Ieeccdff7c131e1359e754e246d3648b73aad5baf
Reviewed-on: https://chromium-review.googlesource.com/659224
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index 1a54d19..0b45f12 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -654,7 +654,7 @@
for (size_t uniformLocation = 0; uniformLocation < uniformLocations.size(); uniformLocation++)
{
const auto &entry = uniformLocations[uniformLocation];
- if (!entry.used)
+ if (!entry.used())
{
continue;
}
@@ -781,14 +781,21 @@
mFunctions->getUniformuiv(mProgramID, uniLoc(location), params);
}
-void ProgramGL::markUnusedUniformLocations(std::vector<gl::VariableLocation> *uniformLocations)
+void ProgramGL::markUnusedUniformLocations(std::vector<gl::VariableLocation> *uniformLocations,
+ std::vector<gl::SamplerBinding> *samplerBindings)
{
GLint maxLocation = static_cast<GLint>(uniformLocations->size());
for (GLint location = 0; location < maxLocation; ++location)
{
if (uniLoc(location) == -1)
{
- (*uniformLocations)[location].used = false;
+ auto &locationRef = (*uniformLocations)[location];
+ if (mState.isSamplerUniformIndex(locationRef.index))
+ {
+ GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(locationRef.index);
+ (*samplerBindings)[samplerIndex].unreferenced = true;
+ }
+ locationRef.markUnused();
}
}
}