Shader: Replace indices-based option keys by CRC32

This commit is contained in:
Jérôme Leclercq
2022-03-06 19:13:38 +01:00
parent 505d996c88
commit a7acf32886
18 changed files with 92 additions and 152 deletions

View File

@@ -37,20 +37,17 @@ namespace Nz
inline bool UberShader::ConfigEqual::operator()(const Config& lhs, const Config& rhs) const
{
for (std::size_t i = 0; i < lhs.optionValues.size(); ++i)
{
if (lhs.optionValues[i] != rhs.optionValues[i])
return false;
}
return true;
return lhs.optionValues == rhs.optionValues;
}
inline std::size_t UberShader::ConfigHasher::operator()(const Config& config) const
{
std::size_t hash = 0;
for (std::size_t i = 0; i < config.optionValues.size(); ++i)
HashCombine(hash, config.optionValues[i]);
for (auto&& [key, value] : config.optionValues)
{
HashCombine(hash, key);
HashCombine(hash, value);
}
return hash;
}