Shader: Add sanitization of identifiers (fixes GLSL generation)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Shader/Config.hpp>
|
||||
#include <Nazara/Shader/Ast/AstCloner.hpp>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz::ShaderAst
|
||||
@@ -32,6 +33,7 @@ namespace Nz::ShaderAst
|
||||
|
||||
struct Options
|
||||
{
|
||||
std::unordered_set<std::string> reservedIdentifiers;
|
||||
bool removeOptionDeclaration = true;
|
||||
};
|
||||
|
||||
@@ -84,6 +86,8 @@ namespace Nz::ShaderAst
|
||||
std::size_t ResolveStruct(const UniformType& uniformType);
|
||||
ExpressionType ResolveType(const ExpressionType& exprType);
|
||||
|
||||
void SanitizeIdentifier(std::string& identifier);
|
||||
|
||||
struct Alias
|
||||
{
|
||||
std::variant<ExpressionType> value;
|
||||
|
||||
Reference in New Issue
Block a user