Graphics: rework ubershaders to prevent duplicate shaders modules
Also rename all remaining conditions to options
This commit is contained in:
@@ -14,6 +14,18 @@ namespace Nz::ShaderAst
|
||||
statement.Visit(*this);
|
||||
}
|
||||
|
||||
void AstReflect::Visit(DeclareFunctionStatement& node)
|
||||
{
|
||||
assert(m_callbacks);
|
||||
if (m_callbacks->onEntryPointDeclaration)
|
||||
{
|
||||
if (!node.entryStage.HasValue())
|
||||
return;
|
||||
|
||||
m_callbacks->onEntryPointDeclaration(node.entryStage.GetResultingValue(), node.name);
|
||||
}
|
||||
}
|
||||
|
||||
void AstReflect::Visit(DeclareOptionStatement& node)
|
||||
{
|
||||
assert(m_callbacks);
|
||||
|
||||
@@ -203,11 +203,11 @@ namespace Nz
|
||||
return s_flipYUniformName;
|
||||
}
|
||||
|
||||
ShaderAst::StatementPtr GlslWriter::Sanitize(ShaderAst::Statement& ast, UInt64 enabledConditions, std::string* error)
|
||||
ShaderAst::StatementPtr GlslWriter::Sanitize(ShaderAst::Statement& ast, UInt64 enabledOptions, std::string* error)
|
||||
{
|
||||
// Always sanitize for reserved identifiers
|
||||
ShaderAst::SanitizeVisitor::Options options;
|
||||
options.enabledOptions = enabledConditions;
|
||||
options.enabledOptions = enabledOptions;
|
||||
options.makeVariableNameUnique = true;
|
||||
options.reservedIdentifiers = {
|
||||
// All reserved GLSL keywords as of GLSL ES 3.2
|
||||
|
||||
Reference in New Issue
Block a user