Skip to content

Commit 8ad8f7e

Browse files
author
devsh
committed
fix abstract class OrenNayar problem and don't print UV Transforms for ParameterSets if no image view is used
1 parent 0e07ead commit 8ad8f7e

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

include/nbl/asset/material_compiler3/CFrontendIR.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,27 @@ class CFrontendIR : public CNodePool
9797
template<typename StringConstIterator=const core::string*>
9898
inline void printDot(const uint8_t _count, std::ostringstream& sstr, const core::string& selfID, StringConstIterator paramNameBegin={}) const
9999
{
100-
const auto uvTransformID = selfID+"_uvTransform";
101-
sstr << "\n\t" << uvTransformID << " [label=\"";
102-
printMatrix(sstr,*reinterpret_cast<const decltype(uvTransform)*>(params+_count));
103-
sstr << "\"]";
104-
sstr << "\n\t" << selfID << " -> " << uvTransformID << "[label=\"UV Transform\"]";
100+
bool imageUsed = false;
105101
for (uint8_t i=0; i<_count; i++)
106102
{
107103
const auto paramID = selfID+"_param"+std::to_string(i);
104+
if (params[i].view)
105+
imageUsed = true;
108106
params[i].printDot(sstr,paramID);
109107
sstr << "\n\t" << selfID << " -> " << paramID;
110108
if (paramNameBegin)
111109
sstr <<" [label=\"" << *(paramNameBegin++) << "\"]";
112110
else
113111
sstr <<" [label=\"Param " << std::to_string(i) <<"\"]";
114112
}
113+
if (imageUsed)
114+
{
115+
const auto uvTransformID = selfID+"_uvTransform";
116+
sstr << "\n\t" << uvTransformID << " [label=\"";
117+
printMatrix(sstr,*reinterpret_cast<const decltype(uvTransform)*>(params+_count));
118+
sstr << "\"]";
119+
sstr << "\n\t" << selfID << " -> " << uvTransformID << "[label=\"UV Transform\"]";
120+
}
115121
}
116122

117123
public:
@@ -541,17 +547,16 @@ class CFrontendIR : public CNodePool
541547
class COrenNayar final : public IBxDF
542548
{
543549
public:
550+
inline uint8_t getChildCount() const override {return 0;}
544551
inline const std::string_view getTypeName() const override {return "nbl::COrenNayar";}
545-
static inline uint32_t calc_size()
546-
{
547-
return sizeof(COrenNayar);
548-
}
552+
static inline uint32_t calc_size() {return sizeof(COrenNayar);}
549553
inline uint32_t getSize() const override {return calc_size();}
550554
inline COrenNayar() = default;
551555

552556
SBasicNDFParams ndParams = {};
553557

554558
protected:
559+
inline _TypedHandle<IExprNode> getChildHandle_impl(const uint8_t ix) const override {return {};}
555560
NBL_API bool invalid(const SInvalidCheckArgs& args) const override;
556561
NBL_API void printDot(std::ostringstream& sstr, const core::string& selfID) const override;
557562
};

0 commit comments

Comments
 (0)