Graphics v0.0.0
A simple abstraction layer for the modern graphics APIs.
载入中...
搜索中...
未找到
VKSwapchain.h
1// Copyright 2022 ShenMian
2// License(Apache-2.0)
3
4#pragma once
5
6#include "VKDevice.h"
7#include <vector>
8#include <vulkan/vulkan.h>
9
10class VKSwapchain final
11{
12public:
13 VKSwapchain() = default;
14 VKSwapchain(VkSwapchainKHR swapchain, VKDevice& device, VkFormat imageFormat, VkExtent2D extent);
15
16 const VkExtent2D& get_size() const;
17
18 const std::vector<VkImage>& get_images() const;
19 const std::vector<VkImageView>& get_image_views() const;
20 VkRenderPass get_render_pass() const;
21 const std::vector<VkFramebuffer>& get_framebuffers() const;
22 const std::vector<VkSemaphore>& get_image_available_semaphores() const;
23 const std::vector<VkSemaphore>& get_render_finished_semaphores() const;
24
25 void destroy();
26
27 operator VkSwapchainKHR();
28 operator VkSwapchainKHR() const;
29
30private:
31 void create_image_views();
32 void create_render_pass();
33 void create_framebuffers();
34 void create_sync_objects();
35 void destroy_image_views();
36 void destroy_framebuffers();
37 void destroy_sync_objects();
38
39 VkSwapchainKHR handle_;
40 VKDevice device_;
41 VkExtent2D size_;
42 VkFormat image_format_;
43
44 std::vector<VkImage> images_;
45 std::vector<VkImageView> image_views_;
46
47 VkRenderPass render_pass_;
48 std::vector<VkFramebuffer> framebuffers_;
49
50 std::vector<VkSemaphore> image_available_semaphores_;
51 std::vector<VkSemaphore> render_finished_semaphores_;
52};
Vulkan 逻辑设备.
Definition: VKDevice.h:14
Definition: VKSwapchain.h:11