Skip to content

Commit bce6bb0

Browse files
author
devsh
committed
semantic checks done
1 parent 8ad8f7e commit bce6bb0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

include/nbl/asset/material_compiler3/CFrontendIR.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,17 @@ class CFrontendIR : public CNodePool
310310
inline _TypedHandle<IExprNode> getChildHandle_impl(const uint8_t ix) const override {return {};}
311311
inline bool invalid(const SInvalidCheckArgs& args) const override
312312
{
313-
auto pWonky = reinterpret_cast<const SCreationParams<1>*>(this+1);
314-
for (auto i=0u; i<getKnotCount(); i++)
313+
const auto knotCount = getKnotCount();
314+
auto pWonky = reinterpret_cast<const SCreationParams<2>*>(this+1);
315+
// non-monochrome spectral variable
316+
if (const auto semantic=pWonky->getSemantics(); knotCount>1)
317+
switch (semantic)
318+
{
319+
default:
320+
args.logger.log("Semantic %d is only usable with 3 knots, this has %d knots",system::ILogger::ELL_ERROR,static_cast<uint8_t>(semantic),knotCount);
321+
return true;
322+
}
323+
for (auto i=0u; i<knotCount; i++)
315324
if (!pWonky->knots.params[i])
316325
{
317326
args.logger.log("Knot %u parameters invalid",system::ILogger::ELL_ERROR,i);

0 commit comments

Comments
 (0)