Shader: Add types to error messages (and remove ID)

This commit is contained in:
SirLynix
2022-04-01 13:36:24 +02:00
committed by Jérôme Leclercq
parent 16cf75440b
commit 7c640f5c00
18 changed files with 501 additions and 320 deletions

View File

@@ -491,7 +491,7 @@ Nz::ShaderAst::ModulePtr ShaderGraph::ToModule() const
extVar.bindingIndex = buffer.bindingIndex;
extVar.bindingSet = buffer.setIndex;
extVar.name = buffer.name;
extVar.type = Nz::ShaderAst::ExpressionType{ Nz::ShaderAst::IdentifierType{ structInfo.name } };
extVar.type = Nz::ShaderAst::ExpressionPtr{ Nz::ShaderBuilder::Identifier(structInfo.name) };
}
for (const auto& texture : m_textures)
@@ -553,9 +553,9 @@ Nz::ShaderAst::ModulePtr ShaderGraph::ToModule() const
return shaderModule;
}
Nz::ShaderAst::ExpressionType ShaderGraph::ToShaderExpressionType(const std::variant<PrimitiveType, std::size_t>& type) const
Nz::ShaderAst::ExpressionValue<Nz::ShaderAst::ExpressionType> ShaderGraph::ToShaderExpressionType(const std::variant<PrimitiveType, std::size_t>& type) const
{
return std::visit([&](auto&& arg) -> Nz::ShaderAst::ExpressionType
return std::visit([&](auto&& arg) -> Nz::ShaderAst::ExpressionValue<Nz::ShaderAst::ExpressionType>
{
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, PrimitiveType>)
@@ -564,7 +564,7 @@ Nz::ShaderAst::ExpressionType ShaderGraph::ToShaderExpressionType(const std::var
{
assert(arg < m_structs.size());
const auto& s = m_structs[arg];
return Nz::ShaderAst::IdentifierType{ s.name };
return Nz::ShaderAst::ExpressionPtr{ Nz::ShaderBuilder::Identifier(s.name) };
}
else
static_assert(Nz::AlwaysFalse<T>::value, "non-exhaustive visitor");

View File

@@ -68,7 +68,7 @@ class ShaderGraph
QJsonObject Save();
Nz::ShaderAst::ModulePtr ToModule() const;
Nz::ShaderAst::ExpressionType ToShaderExpressionType(const std::variant<PrimitiveType, std::size_t>& type) const;
Nz::ShaderAst::ExpressionValue<Nz::ShaderAst::ExpressionType> ToShaderExpressionType(const std::variant<PrimitiveType, std::size_t>& type) const;
void UpdateBuffer(std::size_t bufferIndex, std::string name, BufferType bufferType, std::size_t structIndex, std::size_t setIndex, std::size_t bindingIndex);
void UpdateOption(std::size_t optionIndex, std::string option);