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/Program.h b/src/libANGLE/Program.h
index ca9e8e0..e6d22c4 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -135,17 +135,20 @@
// Struct used for correlating uniforms/elements of uniform arrays to handles
struct VariableLocation
{
- VariableLocation();
- VariableLocation(const std::string &name, unsigned int element, unsigned int index);
+ static constexpr unsigned int kUnused = GL_INVALID_INDEX;
- std::string name;
- unsigned int element;
- unsigned int index;
+ VariableLocation();
+ VariableLocation(unsigned int element, unsigned int index);
// If used is false, it means this location is only used to fill an empty space in an array,
// and there is no corresponding uniform variable for this location. It can also mean the
// uniform was optimized out by the implementation.
- bool used;
+ bool used() const { return (index != kUnused); }
+ void markUnused() { index = kUnused; }
+ void markIgnored() { ignored = true; }
+
+ unsigned int element;
+ unsigned int index;
// If this location was bound to an unreferenced uniform. Setting data on this uniform is a
// no-op.
@@ -342,7 +345,6 @@
std::vector<gl::ImageBinding> mImageBindings;
std::vector<sh::OutputVariable> mOutputVariables;
- // TODO(jmadill): use unordered/hash map when available
std::map<int, VariableLocation> mOutputLocations;
DrawBufferMask mActiveOutputVariables;