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

@@ -49,11 +49,18 @@ namespace Nz
renderPipelineInfo.pipelineLayout = m_pipelineInfo.settings->GetRenderPipelineLayout();
std::unordered_map<UInt32, ShaderAst::ConstantValue> optionValues;
for (std::size_t i = 0; i < m_pipelineInfo.optionCount; ++i)
{
const auto& option = m_pipelineInfo.optionValues[i];
optionValues[option.hash] = option.value;
}
for (const auto& shader : m_pipelineInfo.shaders)
{
if (shader.uberShader)
{
UberShader::Config config{ shader.optionValues };
UberShader::Config config{ optionValues };
shader.uberShader->UpdateConfig(config, vertexBuffers);
renderPipelineInfo.shaderModules.push_back(shader.uberShader->Get(config));