@@ -80,7 +80,7 @@ class CFrontendIR : public CNodePool
8080 NBL_API void printDot (std::ostringstream& sstr, const core::string& selfID) const ;
8181
8282 // at this stage we store the multipliers in highest precision
83- float scale = 1 .f ;
83+ float scale = std::numeric_limits< float >::infinity() ;
8484 // rest are ignored if the view is null
8585 uint8_t viewChannel : 2 = 0 ;
8686 uint8_t padding[3 ] = {0 ,0 ,0 };
@@ -230,7 +230,8 @@ class CFrontendIR : public CNodePool
230230 };
231231 virtual inline bool invalid (const SInvalidCheckArgs&) const {return false ;}
232232 virtual _TypedHandle<IExprNode> getChildHandle_impl (const uint8_t ix) const = 0;
233-
233+
234+ virtual inline core::string getLabelSuffix () const {return " " ;}
234235 virtual inline void printDot (std::ostringstream& sstr, const core::string& selfID) const {}
235236 };
236237
@@ -316,8 +317,19 @@ class CFrontendIR : public CNodePool
316317 if (const auto semantic=pWonky->getSemantics (); knotCount>1 )
317318 switch (semantic)
318319 {
320+ case Semantics::Fixed3_SRGB: [[fallthrough]];
321+ case Semantics::Fixed3_DCI_P3: [[fallthrough]];
322+ case Semantics::Fixed3_BT2020: [[fallthrough]];
323+ case Semantics::Fixed3_AdobeRGB: [[fallthrough]];
324+ case Semantics::Fixed3_AcesCG:
325+ if (knotCount!=3 )
326+ {
327+ 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);
328+ return false ;
329+ }
330+ break ;
319331 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 );
332+ args.logger .log (" Invalid Semantic %d" ,system::ILogger::ELL_ERROR,static_cast <uint8_t >(semantic));
321333 return true ;
322334 }
323335 for (auto i=0u ; i<knotCount; i++)
@@ -328,6 +340,8 @@ class CFrontendIR : public CNodePool
328340 }
329341 return false ;
330342 }
343+
344+ NBL_API core::string getLabelSuffix () const override ;
331345 NBL_API void printDot (std::ostringstream& sstr, const core::string& selfID) const override ;
332346
333347 private:
@@ -418,20 +432,20 @@ class CFrontendIR : public CNodePool
418432 uint8_t computeTransmittance : 1 = false ;
419433 };
420434 // Emission nodes are only allowed in BRDF expressions, not BTDF. To allow different emission on both sides, expressed unambigously.
421- // Basic Emitter
435+ // Basic Emitter - note that it is of unit radiance so its easier to importance sample
422436 class CEmitter final : public IContributor
423437 {
424438 public:
425439 inline const std::string_view getTypeName () const override {return " nbl::CEmitter" ;}
426- inline uint8_t getChildCount () const override {return 1 ;}
440+ inline uint8_t getChildCount () const override {return 0 ;}
427441
428442 // you can set the members later
429443 static inline uint32_t calc_size () {return sizeof (CEmitter);}
430444 inline uint32_t getSize () const override {return calc_size ();}
431445 inline CEmitter () = default;
432446
433- TypedHandle<CSpectralVariable> radiance = {};
434447 // This can be anything like an IES profile, if invalid, there's no directionality to the emission
448+ // `profile.scale` can still be used to influence the light strength without influencing NEE light picking probabilities
435449 SParameter profile = {};
436450 hlsl::float32_t3x3 profileTransform = hlsl::float32_t3x3(
437451 1 ,0 ,0 ,
@@ -441,7 +455,7 @@ class CFrontendIR : public CNodePool
441455 // TODO: semantic flags/metadata (symmetries of the profile)
442456
443457 protected:
444- inline TypedHandle<IExprNode> getChildHandle_impl (const uint8_t ix) const override {return radiance ;}
458+ inline TypedHandle<IExprNode> getChildHandle_impl (const uint8_t ix) const override {return {} ;}
445459 NBL_API bool invalid (const SInvalidCheckArgs& args) const override ;
446460 NBL_API void printDot (std::ostringstream& sstr, const core::string& selfID) const override ;
447461 };
@@ -602,6 +616,8 @@ class CFrontendIR : public CNodePool
602616 protected:
603617 inline TypedHandle<IExprNode> getChildHandle_impl (const uint8_t ix) const override {return orientedRealEta;}
604618 NBL_API bool invalid (const SInvalidCheckArgs& args) const override ;
619+
620+ inline core::string getLabelSuffix () const override {return ndf!=NDF::GGX ? " \\ nNDF = Beckmann" :" \\ nNDF = GGX" ;}
605621 NBL_API void printDot (std::ostringstream& sstr, const core::string& selfID) const override ;
606622 };
607623
@@ -664,6 +680,8 @@ class CFrontendIR : public CNodePool
664680 retval += " \\ n" ;
665681 retval += std::string_view (reinterpret_cast <const char *>(debug->data ().data ()),debug->data ().size ()-1 );
666682 }
683+ if (const auto * expr=deref<const IExprNode>({.untyped =handle.untyped }); expr)
684+ retval += expr->getLabelSuffix ();
667685 retval += " \" ]" ;
668686 return retval;
669687 }
0 commit comments