Temp fix for NZSL update

This commit is contained in:
SirLynix
2022-06-15 20:26:14 +02:00
parent b10e0a7408
commit 8e8bee7037
8 changed files with 19 additions and 11 deletions

View File

@@ -49,10 +49,11 @@ namespace Nz
renderPipelineInfo.pipelineLayout = m_pipelineInfo.settings->GetRenderPipelineLayout();
std::unordered_map<UInt32, nzsl::Ast::ConstantValue> optionValues;
std::unordered_map<UInt32, nzsl::Ast::ConstantSingleValue> optionValues;
for (std::size_t i = 0; i < m_pipelineInfo.optionCount; ++i)
{
const auto& option = m_pipelineInfo.optionValues[i];
optionValues[option.hash] = option.value;
}

View File

@@ -71,7 +71,14 @@ namespace Nz
if (it == m_combinations.end())
{
nzsl::ShaderWriter::States states;
states.optionValues = config.optionValues;
// TODO: Remove this when arrays are accepted as config values
for (const auto& [optionHash, optionValue] : config.optionValues)
{
std::visit([&](auto&& arg)
{
states.optionValues[optionHash] = arg;
}, optionValue);
}
states.shaderModuleResolver = Graphics::Instance()->GetShaderModuleResolver();
std::shared_ptr<ShaderModule> stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStages, *m_shaderModule, std::move(states));