@@ -514,10 +514,20 @@ namespace nbl::ext::imgui
514
514
UI::UI (S_CREATION_PARAMETERS&& params)
515
515
: m_creationParams(std::move(params))
516
516
{
517
- // TODO: could validate & log
518
- assert (m_creationParams.utilities );
519
- assert (m_creationParams.transfer ); // and check if proper capability enabled
520
- assert (m_creationParams.renderpass );
517
+ const auto validation = std::to_array
518
+ ({
519
+ std::make_pair (bool (m_creationParams.utilities ), " Invalid `m_creationParams.utilities` is nullptr!" ),
520
+ std::make_pair (bool (m_creationParams.transfer ), " Invalid `m_creationParams.transfer` is nullptr!" ),
521
+ std::make_pair (bool (m_creationParams.renderpass ), " Invalid `m_creationParams.renderpass` is nullptr!" ),
522
+ (m_creationParams.utilities && m_creationParams.transfer && m_creationParams.renderpass ) ? std::make_pair (bool (m_creationParams.utilities ->getLogicalDevice ()->getPhysicalDevice ()->getQueueFamilyProperties ()[m_creationParams.transfer ->getFamilyIndex ()].queueFlags .hasFlags (IQueue::FAMILY_FLAGS::TRANSFER_BIT)), " Invalid `m_creationParams.transfer` is not capable of transfer operations!" ) : std::make_pair (false , " Pass valid required UI::S_CREATION_PARAMETERS!" )
523
+ });
524
+
525
+ for (const auto & [ok, error] : validation)
526
+ if (!ok)
527
+ {
528
+ m_creationParams.utilities ->getLogger ()->log (error, system::ILogger::ELL_ERROR);
529
+ assert (false );
530
+ }
521
531
522
532
smart_refctd_ptr<nbl::video::IGPUCommandBuffer> transistentCMD;
523
533
{
@@ -609,13 +619,11 @@ namespace nbl::ext::imgui
609
619
});
610
620
611
621
for (const auto & [ok, error] : validation)
612
- {
613
622
if (!ok)
614
623
{
615
624
m_creationParams.utilities ->getLogger ()->log (error, system::ILogger::ELL_ERROR);
616
625
assert (false );
617
626
}
618
- }
619
627
}
620
628
621
629
bool UI::render (SIntendedSubmitInfo& info, const IGPUDescriptorSet* const descriptorSet, const std::span<const VkRect2D> scissors)
0 commit comments