Shader: Attribute can now have expressions as values and struct fields can be conditionally supported

This commit is contained in:
Jérôme Leclercq
2021-07-07 11:41:58 +02:00
parent 749b40cb31
commit f9af35b489
36 changed files with 945 additions and 600 deletions

View File

@@ -16,10 +16,8 @@ namespace Nz
UberShader::UberShader(ShaderStageType shaderStage, const ShaderAst::StatementPtr& shaderAst) :
m_shaderStage(shaderStage)
{
ShaderAst::SanitizeVisitor::Options options;
options.removeOptionDeclaration = false;
m_shaderAst = ShaderAst::Sanitize(*shaderAst, options);
//TODO: Try to partially sanitize shader?
m_shaderAst = ShaderAst::Clone(*shaderAst);
std::size_t optionCount = 0;
@@ -59,7 +57,6 @@ namespace Nz
{
ShaderWriter::States states;
states.enabledOptions = combination;
states.sanitized = true;
std::shared_ptr<ShaderModule> stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStage, *m_shaderAst, std::move(states));