Kale
Loading...
Searching...
No Matches
Renderer.cpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Rishi Challa
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifdef KALE_VULKAN
18
19#include "Renderer.hpp"
20
22
23using namespace Kale;
24using namespace Kale::Vulkan;
25
32
40
45 vk::AttachmentDescription colorAttachment(vk::AttachmentDescriptionFlags(), Core::swapchain.format,
46 vk::SampleCountFlagBits::e1, vk::AttachmentLoadOp::eClear, vk::AttachmentStoreOp::eStore,
47 vk::AttachmentLoadOp::eDontCare, vk::AttachmentStoreOp::eDontCare, vk::ImageLayout::eUndefined,
48 vk::ImageLayout::ePresentSrcKHR);
49
50 vk::AttachmentReference colorAttachmentRef(0, vk::ImageLayout::eColorAttachmentOptimal);
51 vk::SubpassDescription subpass(vk::SubpassDescriptionFlags(), vk::PipelineBindPoint::eGraphics);
52 subpass.colorAttachmentCount = 1;
53 subpass.pColorAttachments = &colorAttachmentRef;
54
55 vk::RenderPassCreateInfo createInfo(vk::RenderPassCreateFlags(), 1, &colorAttachment, 1, &subpass);
56 renderPass = Core::device.logicalDevice->createRenderPassUnique(createInfo);
57}
58
67
68#ifdef KALE_DEBUG
69
73const SwapChain* Renderer::getSwapChain() const {
74 return parentPtr;
75}
76
77#endif
78
79#endif
virtual void freeResources(bool remove=true)
virtual void init(Parent &parent)
static Device device
Definition Core.hpp:99
static SwapChain swapchain
Definition Core.hpp:104
vk::UniqueDevice logicalDevice
Definition Device.hpp:59
vk::UniqueRenderPass renderPass
Definition Renderer.hpp:59
void freeResources(bool remove=true) override
Definition Renderer.cpp:62