Shader: Change module system (no longer based on path)
This commit is contained in:
@@ -56,6 +56,9 @@ namespace Nz::ShaderAst
|
||||
if (!Compare(lhs.moduleId, rhs.moduleId))
|
||||
return false;
|
||||
|
||||
if (!Compare(lhs.moduleName, rhs.moduleName))
|
||||
return false;
|
||||
|
||||
if (!Compare(lhs.shaderLangVersion, rhs.shaderLangVersion))
|
||||
return false;
|
||||
|
||||
@@ -601,7 +604,7 @@ namespace Nz::ShaderAst
|
||||
|
||||
bool Compare(const ImportStatement& lhs, const ImportStatement& rhs)
|
||||
{
|
||||
if (!Compare(lhs.modulePath, rhs.modulePath))
|
||||
if (!Compare(lhs.moduleName, rhs.moduleName))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Nz::ShaderAst
|
||||
struct ImportedModule;
|
||||
struct Metadata;
|
||||
|
||||
inline Module(UInt32 shaderLangVersion, const Uuid& moduleId = Uuid::Generate());
|
||||
inline Module(UInt32 shaderLangVersion, std::string moduleName, const Uuid& moduleId = Uuid::Generate());
|
||||
inline Module(std::shared_ptr<const Metadata> metadata, std::vector<ImportedModule> importedModules = {});
|
||||
inline Module(std::shared_ptr<const Metadata> metadata, MultiStatementPtr rootNode, std::vector<ImportedModule> importedModules = {});
|
||||
Module(const Module&) = default;
|
||||
@@ -43,6 +43,7 @@ namespace Nz::ShaderAst
|
||||
|
||||
struct Metadata
|
||||
{
|
||||
std::string moduleName;
|
||||
UInt32 shaderLangVersion;
|
||||
Uuid moduleId;
|
||||
};
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
namespace Nz::ShaderAst
|
||||
{
|
||||
inline Module::Module(UInt32 shaderLangVersion, const Uuid& uuid)
|
||||
inline Module::Module(UInt32 shaderLangVersion, std::string moduleName, const Uuid& uuid)
|
||||
{
|
||||
auto mutMetadata = std::make_shared<Metadata>();
|
||||
mutMetadata->moduleId = uuid;
|
||||
mutMetadata->moduleName = std::move(moduleName);
|
||||
mutMetadata->shaderLangVersion = shaderLangVersion;
|
||||
|
||||
metadata = std::move(mutMetadata);
|
||||
|
||||
@@ -414,7 +414,7 @@ namespace Nz::ShaderAst
|
||||
NodeType GetType() const override;
|
||||
void Visit(AstStatementVisitor& visitor) override;
|
||||
|
||||
std::vector<std::string> modulePath;
|
||||
std::string moduleName;
|
||||
};
|
||||
|
||||
struct NAZARA_SHADER_API MultiStatement : Statement
|
||||
|
||||
Reference in New Issue
Block a user