#include "VulkanFramebuffer.h" #include "VulkanGraphicsEnums.h" #include "VulkanInitializer.h" #include "VulkanRenderPass.h" #include "VulkanGraphics.h" using namespace Seele; using namespace Seele::Vulkan; Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::PRenderTargetLayout renderTargetLayout) : graphics(graphics) , layout(renderTargetLayout) , renderPass(renderPass) { Array attachments; for(auto inputAttachment : layout->inputAttachments) { PTexture2D vkInputAttachment = inputAttachment.cast(); attachments.add(vkInputAttachment->getView()); } for(auto colorAttachment : layout->colorAttachments) { PTexture2D vkColorAttachment = colorAttachment.cast(); attachments.add(vkColorAttachment->getView()); } if(layout->depthAttachment != nullptr) { PTexture2D vkDepthAttachment = layout->depthAttachment.cast(); attachments.add(vkDepthAttachment->getView()); } VkFramebufferCreateInfo createInfo = init::FramebufferCreateInfo( renderPass->getHandle(), attachments.size(), attachments.data(), renderPass->getRenderArea().extent.width, renderPass->getRenderArea().extent.height, 1 ); VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle)); } Framebuffer::~Framebuffer() { vkDestroyFramebuffer(graphics->getDevice(), handle, nullptr); }