-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwapchainManager.hpp
60 lines (48 loc) · 1.78 KB
/
SwapchainManager.hpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "RendererCommon.h"
#include "DepthBuffer.hpp"
#include "Msaa.hpp"
#include "Framebuffer.hpp"
class SwapchainManager {
public:
SwapchainManager() = default;
~SwapchainManager() = default;
SwapchainManager(const VkPhysicalDevice& phyDevice, const VkDevice& device,
const std::vector<const char*>& deviceExtensions, const QueueFamilyIndices& indices,
VkSurfaceKHR& surface, uint32_t frameBufferWidth, uint32_t frameBufferHeight,
VkSampleCountFlagBits sampleCount);
void create();
void cleanup();
void recreate(uint32_t frameBufferWidth, uint32_t frameBufferHeight);
const VkFormat& getImageFormat();
const VkExtent2D getImageExtent();
const std::vector<VkImageView> getImageViews();
const VkSwapchainKHR& getSwapchain();
Msaa& getMsaa();
DepthBuffer& getDepthBuffer();
RenderPass& getRenderPass();
Framebuffer& getFramebuffer();
private:
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& avaiableFormats);
VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR>& avaiablePresentModes);
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
void createImages(uint32_t& imageCount, VkSurfaceFormatKHR& surfaceFormat);
void createImageViews();
VkSwapchainKHR swapChain;
std::unique_ptr<Framebuffer> framebuffer;
std::unique_ptr<DepthBuffer> depthBuffer;
std::unique_ptr<Msaa> msaa;
std::unique_ptr<RenderPass> renderpass;
std::vector<VkImage> images;
VkFormat imageFormat;
VkExtent2D imageExtent;
std::vector<VkImageView> imageViews;
uint32_t imagesCount;
VkSurfaceKHR surface;
VkPhysicalDevice physicalDevice;
VkDevice device;
VkSampleCountFlagBits sampleCount;
std::vector<const char*> extensions;
QueueFamilyIndices indices;
uint32_t framebufferWidth, framebufferHeight;
};