From fc783b7d5469376d2bde6ab3598c5afcfdcbf432 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Tue, 20 Aug 2024 22:33:51 -0700 Subject: [PATCH] Add error handling for KRRenderGraphBlackFrame::Initialize failure --- kraken/KRRenderGraphBlackFrame.cpp | 4 +++- kraken/KRRenderGraphBlackFrame.h | 2 +- kraken/KRSurface.cpp | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kraken/KRRenderGraphBlackFrame.cpp b/kraken/KRRenderGraphBlackFrame.cpp index 8ee0378..3b65281 100644 --- a/kraken/KRRenderGraphBlackFrame.cpp +++ b/kraken/KRRenderGraphBlackFrame.cpp @@ -44,7 +44,7 @@ KRRenderGraphBlackFrame::~KRRenderGraphBlackFrame() { } -void KRRenderGraphBlackFrame::initialize(KRSurface &surface) +KrResult KRRenderGraphBlackFrame::initialize(KRSurface &surface) { VkFormat depthImageFormat = VK_FORMAT_UNDEFINED; KrResult res = KR_SUCCESS; @@ -64,4 +64,6 @@ void KRRenderGraphBlackFrame::initialize(KRSurface &surface) info.finalPass = true; info.type = RenderPassType::RENDER_PASS_BLACK_FRAME; addRenderPass(*surface.getDevice(), info); + + return KR_SUCCESS; } diff --git a/kraken/KRRenderGraphBlackFrame.h b/kraken/KRRenderGraphBlackFrame.h index e71528c..d3a4d49 100644 --- a/kraken/KRRenderGraphBlackFrame.h +++ b/kraken/KRRenderGraphBlackFrame.h @@ -39,6 +39,6 @@ public: KRRenderGraphBlackFrame(KRContext& context); ~KRRenderGraphBlackFrame(); - void initialize(KRSurface& surface); + KrResult initialize(KRSurface& surface); }; diff --git a/kraken/KRSurface.cpp b/kraken/KRSurface.cpp index 9b36ba9..2c3e888 100644 --- a/kraken/KRSurface.cpp +++ b/kraken/KRSurface.cpp @@ -293,7 +293,10 @@ KrResult KRSurface::createSwapChain() m_renderGraph->addRenderPass(*device, info); - m_blackFrameRenderGraph->initialize(*this); + res = m_blackFrameRenderGraph->initialize(*this); + if (res != KR_SUCCESS) { + return res; + } m_swapChain->create(*device, m_surface, m_surfaceFormat, depthImageFormat, swapExtent, imageCount, *m_renderGraph->getRenderPass(RenderPassType::RENDER_PASS_FORWARD_OPAQUE));