Skip to content

Commit 0e07ead

Browse files
author
devsh
committed
correct printing bug
1 parent 9f22043 commit 0e07ead

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

include/nbl/asset/material_compiler3/CFrontendIR.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class CFrontendIR : public CNodePool
9999
{
100100
const auto uvTransformID = selfID+"_uvTransform";
101101
sstr << "\n\t" << uvTransformID << " [label=\"";
102-
printMatrix(sstr,uvTransform);
102+
printMatrix(sstr,*reinterpret_cast<const decltype(uvTransform)*>(params+_count));
103103
sstr << "\"]";
104104
sstr << "\n\t" << selfID << " -> " << uvTransformID << "[label=\"UV Transform\"]";
105105
for (uint8_t i=0; i<_count; i++)
@@ -140,6 +140,9 @@ class CFrontendIR : public CNodePool
140140
1,0,0,
141141
0,1,0
142142
);
143+
144+
// to make sure there will be no padding inbetween
145+
static_assert(alignof(SParameter)>=alignof(hlsl::float32_t2x3));
143146
};
144147

145148
// basic "built-in" nodes
@@ -306,9 +309,9 @@ class CFrontendIR : public CNodePool
306309
if (!pWonky->knots.params[i])
307310
{
308311
args.logger.log("Knot %u parameters invalid",system::ILogger::ELL_ERROR,i);
309-
return false;
312+
return true;
310313
}
311-
return true;
314+
return false;
312315
}
313316
NBL_API void printDot(std::ostringstream& sstr, const core::string& selfID) const override;
314317

@@ -462,10 +465,8 @@ class CFrontendIR : public CNodePool
462465
inline uint8_t getChildCount() const override {return 2;}
463466

464467
inline const std::string_view getTypeName() const override {return "nbl::CFresnel";}
465-
static inline uint32_t calc_size()
466-
{
467-
return sizeof(CFresnel);
468-
}
468+
static inline uint32_t calc_size() {return sizeof(CFresnel);}
469+
inline uint32_t getSize() const override {return calc_size();}
469470
inline CFresnel() = default;
470471

471472
// Already pre-divided Index of Refraction, e.g. exterior/interior since VdotG>0 the ray always arrives from the exterior.
@@ -604,7 +605,8 @@ class CFrontendIR : public CNodePool
604605
return CNodePool::_delete<T>(h);
605606
}
606607

607-
// Each material comes down to this
608+
// Each material comes down to this, YOU MUST NOT MODIFY THE NODES AFTER ADDING THEIR PARENT TO THE ROOT NODES!
609+
// TODO: shall we copy and hand out a new handle?
608610
inline std::span<const TypedHandle<const CLayer>> getMaterials() {return m_rootNodes;}
609611
inline bool addMaterial(const TypedHandle<const CLayer> rootNode, system::logger_opt_ptr logger)
610612
{
@@ -653,6 +655,7 @@ class CFrontendIR : public CNodePool
653655
}
654656

655657
core::vector<TypedHandle<const CLayer>> m_rootNodes;
658+
// TODO: named material Fresnels
656659
};
657660

658661
inline bool CFrontendIR::valid(const TypedHandle<const CLayer> rootHandle, system::logger_opt_ptr logger) const

0 commit comments

Comments
 (0)