diff --git a/kraken/KRRenderPass.cpp b/kraken/KRRenderPass.cpp index a0133af..c311ba6 100644 --- a/kraken/KRRenderPass.cpp +++ b/kraken/KRRenderPass.cpp @@ -38,6 +38,7 @@ using namespace hydra; KRRenderPass::KRRenderPass(KRContext& context) : KRContextObject(context) , m_renderPass(VK_NULL_HANDLE) + , m_info{} { } @@ -52,6 +53,7 @@ void KRRenderPass::create(KRDevice& device, VkFormat swapChainImageFormat, VkFor if (m_renderPass) { return; } + m_info = info; VkAttachmentDescription colorAttachment{}; colorAttachment.format = swapChainImageFormat; @@ -124,13 +126,13 @@ void KRRenderPass::destroy(KRDevice& device) } } -void KRRenderPass::begin(VkCommandBuffer& commandBuffer, KRSurface& surface, const Vector4& clearColor) +void KRRenderPass::begin(VkCommandBuffer& commandBuffer, KRSurface& surface) { std::array clearValues{}; - clearValues[0].color.float32[0] = clearColor[0]; - clearValues[0].color.float32[1] = clearColor[1]; - clearValues[0].color.float32[2] = clearColor[2]; - clearValues[0].color.float32[3] = clearColor[3]; + clearValues[0].color.float32[0] = m_info.clearColorValue[0]; + clearValues[0].color.float32[1] = m_info.clearColorValue[1]; + clearValues[0].color.float32[2] = m_info.clearColorValue[2]; + clearValues[0].color.float32[3] = m_info.clearColorValue[3]; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassInfo{}; diff --git a/kraken/KRSurface.cpp b/kraken/KRSurface.cpp index f363d5f..33df9bd 100644 --- a/kraken/KRSurface.cpp +++ b/kraken/KRSurface.cpp @@ -204,6 +204,7 @@ KrResult KRSurface::createSwapChain() info.clearDepth = true; info.keepDepth = false; info.finalPass = false; + info.clearColorValue = Vector4::Zero(); m_forwardOpaquePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info); info.clearColor = true; @@ -332,6 +333,6 @@ void KRSurface::endFrame() void KRSurface::renderBlackFrame(VkCommandBuffer &commandBuffer) { - m_blackFramePass->begin(commandBuffer, *this, Vector4::Create(0.0f, 0.0f, 0.0f, 1.0f)); + m_blackFramePass->begin(commandBuffer, *this); m_blackFramePass->end(commandBuffer); }