-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderPass.cpp
More file actions
30 lines (22 loc) · 996 Bytes
/
RenderPass.cpp
File metadata and controls
30 lines (22 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "RenderPass.hpp"
RenderPass::RenderPass(Device& device, Surface& surface)
: m_RenderPass(CreateRenderPass(device, surface))
{
}
vk::raii::RenderPass& RenderPass::Get()
{
return m_RenderPass;
}
vk::raii::RenderPass RenderPass::CreateRenderPass(Device& device, Surface& surface)
{
vk::AttachmentDescription colorAttachment(
{}, surface.surfaceFormat.format, vk::SampleCountFlagBits::e1,
vk::AttachmentLoadOp::eClear, vk::AttachmentStoreOp::eStore,
vk::AttachmentLoadOp::eDontCare, vk::AttachmentStoreOp::eDontCare,
vk::ImageLayout::eUndefined, vk::ImageLayout::ePresentSrcKHR);
vk::AttachmentReference colorAttachmentReference(
0, vk::ImageLayout::eColorAttachmentOptimal);
vk::SubpassDescription subpass({}, vk::PipelineBindPoint::eGraphics, {}, colorAttachmentReference);
vk::RenderPassCreateInfo renderPassCreateInfo({}, colorAttachment, subpass);
return device.Get().createRenderPass(renderPassCreateInfo);
}