Commit f97b8193 by Geoff Lang Committed by Angle LUCI CQ

Make ANGLE's program hash key deterministic.

ANGLE's program hash iterates over hash maps which do not guarantee a determinisitic iteration order. Copy these maps to std::map before iteration. It's unclear what must change to make these maps iterate differently, EGLBlobCacheTest.Functional does cover this path but doesn't trigger any issues. Bug: angleproject:5913 Change-Id: Ib5f2c0a0a4e05cbaeeec5d9c889718d53c5fcf1c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2892254Reviewed-by: 's avatarSunny Sun <sunny.sun@arm.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent cf243705
......@@ -57,7 +57,7 @@ HashStream &operator<<(HashStream &stream, Shader *shader)
HashStream &operator<<(HashStream &stream, const ProgramBindings &bindings)
{
for (const auto &binding : bindings)
for (const auto &binding : bindings.getStableIterationMap())
{
stream << binding.first << binding.second;
}
......@@ -66,7 +66,7 @@ HashStream &operator<<(HashStream &stream, const ProgramBindings &bindings)
HashStream &operator<<(HashStream &stream, const ProgramAliasedBindings &bindings)
{
for (const auto &binding : bindings)
for (const auto &binding : bindings.getStableIterationMap())
{
stream << binding.first << binding.second.location;
}
......
......@@ -1055,6 +1055,11 @@ ProgramBindings::const_iterator ProgramBindings::end() const
return mBindings.end();
}
std::map<std::string, GLuint> ProgramBindings::getStableIterationMap() const
{
return std::map<std::string, GLuint>(mBindings.begin(), mBindings.end());
}
// ProgramAliasedBindings implementation.
ProgramAliasedBindings::ProgramAliasedBindings() {}
......@@ -1148,6 +1153,11 @@ ProgramAliasedBindings::const_iterator ProgramAliasedBindings::end() const
return mBindings.end();
}
std::map<std::string, ProgramBinding> ProgramAliasedBindings::getStableIterationMap() const
{
return std::map<std::string, ProgramBinding>(mBindings.begin(), mBindings.end());
}
// ImageBinding implementation.
ImageBinding::ImageBinding(size_t count, TextureType textureTypeIn)
: textureType(textureTypeIn), boundImageUnits(count, 0)
......
......@@ -187,6 +187,8 @@ class ProgramBindings final : angle::NonCopyable
const_iterator begin() const;
const_iterator end() const;
std::map<std::string, GLuint> getStableIterationMap() const;
private:
angle::HashMap<std::string, GLuint> mBindings;
};
......@@ -207,6 +209,8 @@ class ProgramAliasedBindings final : angle::NonCopyable
const_iterator begin() const;
const_iterator end() const;
std::map<std::string, ProgramBinding> getStableIterationMap() const;
private:
angle::HashMap<std::string, ProgramBinding> mBindings;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment