Fix compilation
This commit is contained in:
parent
837b72f68e
commit
e497faabaf
|
|
@ -39,13 +39,13 @@ Nz::ShaderAst::NodePtr CastVec<ToComponentCount>::BuildNode(Nz::ShaderAst::Expre
|
|||
}
|
||||
else if (ToComponentCount < fromComponentCount)
|
||||
{
|
||||
std::array<Nz::ShaderAst::SwizzleComponent, ToComponentCount> swizzleComponents;
|
||||
std::array<Nz::UInt32, ToComponentCount> swizzleComponents;
|
||||
for (std::size_t i = 0; i < ToComponentCount; ++i)
|
||||
swizzleComponents[i] = static_cast<Nz::ShaderAst::SwizzleComponent>(static_cast<std::size_t>(Nz::ShaderAst::SwizzleComponent::First) + i);
|
||||
swizzleComponents[i] = Nz::SafeCast<Nz::UInt32>(i);
|
||||
|
||||
return std::apply([&](auto... components)
|
||||
{
|
||||
std::initializer_list<Nz::ShaderAst::SwizzleComponent> componentList{ components... };
|
||||
std::initializer_list<Nz::UInt32> componentList{ components... };
|
||||
return Nz::ShaderBuilder::Swizzle(std::move(expressions[0]), componentList);
|
||||
}, swizzleComponents);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ Nz::ShaderAst::NodePtr VecDecomposition::BuildNode(Nz::ShaderAst::ExpressionPtr*
|
|||
assert(count == 1);
|
||||
assert(outputIndex < m_outputs.size());
|
||||
|
||||
using namespace Nz;
|
||||
|
||||
ShaderAst::SwizzleComponent swizzleComponent = static_cast<ShaderAst::SwizzleComponent>(Nz::UnderlyingCast(ShaderAst::SwizzleComponent::First) + outputIndex);
|
||||
return ShaderBuilder::Swizzle(std::move(expressions[0]), { swizzleComponent });
|
||||
return Nz::ShaderBuilder::Swizzle(std::move(expressions[0]), { Nz::SafeCast<Nz::UInt32>(outputIndex) });
|
||||
}
|
||||
|
||||
QString VecDecomposition::caption() const
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ SCENARIO("Shader generation", "[Shader]")
|
|||
auto firstAccess = Nz::ShaderBuilder::AccessMember(std::move(ubo), { "s" });
|
||||
auto secondAccess = Nz::ShaderBuilder::AccessMember(std::move(firstAccess), { "field" });
|
||||
|
||||
auto swizzle = Nz::ShaderBuilder::Swizzle(std::move(secondAccess), { Nz::ShaderAst::SwizzleComponent::Third });
|
||||
auto swizzle = Nz::ShaderBuilder::Swizzle(std::move(secondAccess), { 2u });
|
||||
auto varDecl = Nz::ShaderBuilder::DeclareVariable("result", Nz::ShaderAst::PrimitiveType::Float32, std::move(swizzle));
|
||||
|
||||
statements.push_back(Nz::ShaderBuilder::DeclareFunction("main", std::move(varDecl)));
|
||||
|
|
@ -113,7 +113,7 @@ OpFunctionEnd)");
|
|||
auto ubo = Nz::ShaderBuilder::Identifier("ubo");
|
||||
auto access = Nz::ShaderBuilder::AccessMember(std::move(ubo), { "s", "field" });
|
||||
|
||||
auto swizzle = Nz::ShaderBuilder::Swizzle(std::move(access), { Nz::ShaderAst::SwizzleComponent::Third });
|
||||
auto swizzle = Nz::ShaderBuilder::Swizzle(std::move(access), { 2u });
|
||||
auto varDecl = Nz::ShaderBuilder::DeclareVariable("result", Nz::ShaderAst::PrimitiveType::Float32, std::move(swizzle));
|
||||
|
||||
statements.push_back(Nz::ShaderBuilder::DeclareFunction("main", std::move(varDecl)));
|
||||
|
|
|
|||
Loading…
Reference in New Issue