Fix ShaderNode compilation

This commit is contained in:
SirLynix 2023-05-14 18:51:46 +02:00
parent 383e905b3f
commit f1cd5ad048
12 changed files with 17 additions and 17 deletions

View File

@ -49,7 +49,7 @@ ShaderNode(graph)
UpdatePreview(); UpdatePreview();
} }
nzsl::Ast::NodePtr BufferField::BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const nzsl::Ast::NodePtr BufferField::BuildNode(nzsl::Ast::ExpressionPtr* /*expressions*/, std::size_t count, std::size_t outputIndex) const
{ {
assert(count == 0); assert(count == 0);
assert(outputIndex == 0); assert(outputIndex == 0);

View File

@ -17,7 +17,7 @@ class CastVec : public ShaderNode
CastVec(ShaderGraph& graph); CastVec(ShaderGraph& graph);
~CastVec() = default; ~CastVec() = default;
nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const; nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const override;
void BuildNodeEdition(QFormLayout* layout) override; void BuildNodeEdition(QFormLayout* layout) override;
QString caption() const override; QString caption() const override;

View File

@ -54,7 +54,7 @@ unsigned int Discard::nPorts(QtNodes::PortType portType) const
return 0; return 0;
} }
std::shared_ptr<QtNodes::NodeData> Discard::outData(QtNodes::PortIndex port) std::shared_ptr<QtNodes::NodeData> Discard::outData(QtNodes::PortIndex /*port*/)
{ {
return {}; return {};
} }

View File

@ -15,7 +15,7 @@ class Discard : public ShaderNode
Discard(ShaderGraph& graph); Discard(ShaderGraph& graph);
nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const override; nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const override;
int GetOutputOrder() const; int GetOutputOrder() const override;
QString caption() const override { return "Discard"; } QString caption() const override { return "Discard"; }
QString name() const override { return "Discard"; } QString name() const override { return "Discard"; }

View File

@ -89,7 +89,7 @@ void FloatValue::BuildNodeEdition(QFormLayout* layout)
layout->addRow(tr("Value"), spinbox); layout->addRow(tr("Value"), spinbox);
} }
nzsl::Ast::NodePtr FloatValue::BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const nzsl::Ast::NodePtr FloatValue::BuildNode(nzsl::Ast::ExpressionPtr* /*expressions*/, std::size_t count, std::size_t outputIndex) const
{ {
assert(count == 0); assert(count == 0);
assert(outputIndex == 0); assert(outputIndex == 0);

View File

@ -13,7 +13,7 @@ class Mat4BinOp : public ShaderNode
Mat4BinOp(ShaderGraph& graph); Mat4BinOp(ShaderGraph& graph);
~Mat4BinOp() = default; ~Mat4BinOp() = default;
nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const; nzsl::Ast::NodePtr BuildNode(nzsl::Ast::ExpressionPtr* expressions, std::size_t count, std::size_t outputIndex) const override;
unsigned int nPorts(QtNodes::PortType portType) const override; unsigned int nPorts(QtNodes::PortType portType) const override;

View File

@ -170,7 +170,7 @@ std::shared_ptr<QtNodes::NodeData> TextureValue::outData(QtNodes::PortIndex port
return textureData; return textureData;
} }
QString TextureValue::portCaption(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const QString TextureValue::portCaption(QtNodes::PortType portType, QtNodes::PortIndex /*portIndex*/) const
{ {
assert(portType == QtNodes::PortType::Out); assert(portType == QtNodes::PortType::Out);
@ -181,7 +181,7 @@ QString TextureValue::portCaption(QtNodes::PortType portType, QtNodes::PortIndex
return QString::fromStdString(textureEntry.name); return QString::fromStdString(textureEntry.name);
} }
bool TextureValue::portCaptionVisible(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const bool TextureValue::portCaptionVisible(QtNodes::PortType portType, QtNodes::PortIndex /*portIndex*/) const
{ {
switch (portType) switch (portType)
{ {

View File

@ -63,7 +63,7 @@ unsigned int VecDecomposition::nPorts(QtNodes::PortType portType) const
switch (portType) switch (portType)
{ {
case QtNodes::PortType::In: return 1; case QtNodes::PortType::In: return 1;
case QtNodes::PortType::Out: return m_outputs.size(); case QtNodes::PortType::Out: return static_cast<unsigned int>(m_outputs.size());
default: default:
break; break;

View File

@ -488,8 +488,8 @@ nzsl::Ast::ModulePtr ShaderGraph::ToModule() const
const auto& structInfo = m_structs[buffer.structIndex]; const auto& structInfo = m_structs[buffer.structIndex];
auto& extVar = external->externalVars.emplace_back(); auto& extVar = external->externalVars.emplace_back();
extVar.bindingIndex = buffer.bindingIndex; extVar.bindingIndex = Nz::SafeCast<Nz::UInt32>(buffer.bindingIndex);
extVar.bindingSet = buffer.setIndex; extVar.bindingSet = Nz::SafeCast<Nz::UInt32>(buffer.setIndex);
extVar.name = buffer.name; extVar.name = buffer.name;
extVar.type = nzsl::Ast::ExpressionPtr{ nzsl::ShaderBuilder::Identifier(structInfo.name) }; extVar.type = nzsl::Ast::ExpressionPtr{ nzsl::ShaderBuilder::Identifier(structInfo.name) };
} }
@ -497,8 +497,8 @@ nzsl::Ast::ModulePtr ShaderGraph::ToModule() const
for (const auto& texture : m_textures) for (const auto& texture : m_textures)
{ {
auto& extVar = external->externalVars.emplace_back(); auto& extVar = external->externalVars.emplace_back();
extVar.bindingIndex = texture.bindingIndex; extVar.bindingIndex = Nz::SafeCast<Nz::UInt32>(texture.bindingIndex);
extVar.bindingSet = texture.setIndex; extVar.bindingSet = Nz::SafeCast<Nz::UInt32>(texture.setIndex);
extVar.name = texture.name; extVar.name = texture.name;
extVar.type = ToShaderExpressionType(texture.type); extVar.type = ToShaderExpressionType(texture.type);
} }

View File

@ -52,7 +52,7 @@ BufferEditDialog(shaderGraph, parent)
m_bindingIndex->setValue(int(buffer.bindingIndex)); m_bindingIndex->setValue(int(buffer.bindingIndex));
m_setIndex->setValue(int(buffer.setIndex)); m_setIndex->setValue(int(buffer.setIndex));
m_outputName->setText(QString::fromStdString(buffer.name)); m_outputName->setText(QString::fromStdString(buffer.name));
m_structList->setCurrentIndex(buffer.structIndex); m_structList->setCurrentIndex(int(buffer.structIndex));
m_typeList->setCurrentIndex(int(buffer.type)); m_typeList->setCurrentIndex(int(buffer.type));
} }

View File

@ -95,7 +95,7 @@ int main()
Nz::ElementRendererRegistry elementRegistry; Nz::ElementRendererRegistry elementRegistry;
Nz::ForwardFramePipeline framePipeline(elementRegistry); Nz::ForwardFramePipeline framePipeline(elementRegistry);
std::size_t cameraIndex = framePipeline.RegisterViewer(&camera, 0); [[maybe_unused]] std::size_t cameraIndex = framePipeline.RegisterViewer(&camera, 0);
std::size_t worldInstanceIndex1 = framePipeline.RegisterWorldInstance(modelInstance); std::size_t worldInstanceIndex1 = framePipeline.RegisterWorldInstance(modelInstance);
std::size_t worldInstanceIndex2 = framePipeline.RegisterWorldInstance(modelInstance2); std::size_t worldInstanceIndex2 = framePipeline.RegisterWorldInstance(modelInstance2);
framePipeline.RegisterRenderable(worldInstanceIndex1, Nz::FramePipeline::NoSkeletonInstance, &model, 0xFFFFFFFF, scissorBox); framePipeline.RegisterRenderable(worldInstanceIndex1, Nz::FramePipeline::NoSkeletonInstance, &model, 0xFFFFFFFF, scissorBox);

View File

@ -106,8 +106,8 @@ SCENARIO("ParameterList", "[CORE][PARAMETERLIST]")
THEN("Conversion from bool to int should also work if strict mode is disabled") THEN("Conversion from bool to int should also work if strict mode is disabled")
{ {
CHECK(parameterList.GetIntegerParameter("trueInt", false).GetValue() == trueInt); CHECK(parameterList.GetIntegerParameter("trueInt", false).GetValue() == +trueInt);
CHECK(parameterList.GetIntegerParameter("falseInt", false).GetValue() == falseInt); CHECK(parameterList.GetIntegerParameter("falseInt", false).GetValue() == +falseInt);
} }
THEN("Conversion from double to int should also work if strict mode is disabled") THEN("Conversion from double to int should also work if strict mode is disabled")