Handle shader options of any type

This commit is contained in:
Jérôme Leclercq
2021-09-03 19:33:41 +02:00
parent 2f9e495739
commit 02a12d9328
38 changed files with 236 additions and 1118 deletions

View File

@@ -11,6 +11,38 @@ namespace Nz
{
return m_shaderStages;
}
inline bool UberShader::HasOption(const std::string& optionName, Pointer<const Option>* option) const
{
auto it = m_optionIndexByName.find(optionName);
if (it == m_optionIndexByName.end())
return false;
if (option)
*option = &it->second;
return true;
}
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;
}
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]);
return hash;
}
}
#include <Nazara/Graphics/DebugOff.hpp>