Basic UI quad, yay

This commit is contained in:
Dynamitos
2021-09-23 10:10:39 +02:00
parent df977110d3
commit 632d120f6d
51 changed files with 579 additions and 187 deletions
@@ -13,31 +13,39 @@ Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::PRende
FramebufferDescription description;
std::memset(&description, 0, sizeof(FramebufferDescription));
Array<VkImageView> attachments;
uint32 sizeX = 0;
uint32 sizeY = 0;
for (auto inputAttachment : layout->inputAttachments)
{
PTexture2D vkInputAttachment = inputAttachment->getTexture().cast<Texture2D>();
attachments.add(vkInputAttachment->getView());
description.inputAttachments[description.numInputAttachments++] = vkInputAttachment->getView();
sizeX = std::max(sizeX, vkInputAttachment->getSizeX());
sizeY = std::max(sizeY, vkInputAttachment->getSizeY());
}
for (auto colorAttachment : layout->colorAttachments)
{
PTexture2D vkColorAttachment = colorAttachment->getTexture().cast<Texture2D>();
attachments.add(vkColorAttachment->getView());
description.colorAttachments[description.numColorAttachments++] = vkColorAttachment->getView();
sizeX = std::max(sizeX, vkColorAttachment->getSizeX());
sizeY = std::max(sizeY, vkColorAttachment->getSizeY());
}
if (layout->depthAttachment != nullptr)
{
PTexture2D vkDepthAttachment = layout->depthAttachment->getTexture().cast<Texture2D>();
attachments.add(vkDepthAttachment->getView());
description.depthAttachment = vkDepthAttachment->getView();
sizeX = std::max(sizeX, vkDepthAttachment->getSizeX());
sizeY = std::max(sizeY, vkDepthAttachment->getSizeY());
}
VkFramebufferCreateInfo createInfo =
init::FramebufferCreateInfo(
renderPass->getHandle(),
(uint32)attachments.size(),
attachments.data(),
renderPass->getRenderArea().extent.width,
renderPass->getRenderArea().extent.height,
sizeX,
sizeY,
1);
VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle));