Handle shader options of any type

This commit is contained in:
Jérôme Leclercq
2021-09-03 19:33:41 +02:00
parent 2f9e495739
commit 02a12d9328
38 changed files with 236 additions and 1118 deletions

View File

@@ -11,6 +11,7 @@
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/Ast/AstCloner.hpp>
#include <optional>
#include <unordered_map>
#include <vector>
namespace Nz::ShaderAst
@@ -36,7 +37,6 @@ namespace Nz::ShaderAst
struct Options
{
std::function<const ConstantValue&(std::size_t constantId)> constantQueryCallback;
std::optional<UInt64> enabledOptions = 0;
};
protected:

View File

@@ -18,7 +18,10 @@
namespace Nz::ShaderAst
{
using NoValue = std::monostate;
using ConstantTypes = TypeList<
NoValue,
bool,
float,
Int32,

View File

@@ -302,7 +302,7 @@ namespace Nz::ShaderAst
std::optional<std::size_t> optIndex;
std::string optName;
ExpressionPtr initialValue;
ExpressionPtr defaultValue;
ExpressionType optType;
};

View File

@@ -36,7 +36,7 @@ namespace Nz::ShaderAst
struct Options
{
std::unordered_set<std::string> reservedIdentifiers;
UInt64 enabledOptions = 0;
std::unordered_map<std::size_t, ConstantValue> optionValues;
bool makeVariableNameUnique = false;
bool removeOptionDeclaration = true;
};