Kale
Loading...
Searching...
No Matches
SwapChain.hpp
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#pragma once
18
19#ifdef KALE_VULKAN
20
25
26#include <vulkan/vulkan.hpp>
27#include <vector>
28
29namespace Kale::Vulkan {
30
34 class Renderer;
35
39 class SwapChain : public ParentResource<SwapChain>, public ChildResource<Device> {
40 private:
41
45 void createSwapChain();
46
50 void createImageViews();
51
52 public:
53
57 vk::UniqueSwapchainKHR swapchain;
58
62 vk::Extent2D extent;
63
67 vk::Format format;
68
73
77 std::vector<vk::UniqueImageView> imageViews;
78
82 std::vector<vk::Image> images;
83
87 std::vector<vk::UniqueFramebuffer> frameBuffers;
88
93 SwapChain(Device& device);
94
98 SwapChain();
99
104 void init(Device& device) override;
105
110 void createFrameBuffers(Renderer& renderer);
111
115 void freeResources(bool remove = true) override;
116 };
117}
118
119#endif
std::vector< vk::UniqueImageView > imageViews
Definition SwapChain.hpp:77
vk::UniqueSwapchainKHR swapchain
Definition SwapChain.hpp:57
SwapChainSupportDetails support
Definition SwapChain.hpp:72
std::vector< vk::Image > images
Definition SwapChain.hpp:82
void freeResources(bool remove=true) override
std::vector< vk::UniqueFramebuffer > frameBuffers
Definition SwapChain.hpp:87
void init(Device &device) override
Definition SwapChain.cpp:41
void createFrameBuffers(Renderer &renderer)