Created swapchain object.
Manages most of the present-related stuff. Still need to move some queue submits inside of it though
This commit is contained in:
40
include/vulkan/basalt_swapchain.h
Normal file
40
include/vulkan/basalt_swapchain.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include "vulkan/basalt_device.h"
|
||||
|
||||
|
||||
namespace basalt
|
||||
{
|
||||
class Swapchain
|
||||
{
|
||||
public:
|
||||
Swapchain(const Swapchain& src) = delete;
|
||||
Swapchain& operator =(const Swapchain& src) = delete;
|
||||
Swapchain(Swapchain&& src) = delete;
|
||||
Swapchain& operator =(Swapchain&& src) = delete;
|
||||
|
||||
|
||||
Swapchain(basalt::Device& device, basalt::Window& window,
|
||||
const std::initializer_list<VkSurfaceFormatKHR>& allowed_formats,
|
||||
const std::initializer_list<VkPresentModeKHR> allowed_present_modes);
|
||||
~Swapchain();
|
||||
|
||||
void create_framebuffers(VkRenderPass render_pass);
|
||||
void wait_and_reset(bool wait_all=VK_TRUE, u64 timeout=UINT64_MAX);
|
||||
u32 acquire_next_image(VkFence fence=VK_NULL_HANDLE, u64 timeout=UINT64_MAX);
|
||||
|
||||
basalt::darray<VkSemaphore> semaphores_image_available;
|
||||
basalt::darray<VkSemaphore> semaphores_render_finished;
|
||||
basalt::darray<VkFence> fences_in_flight;
|
||||
basalt::SwapchainSupportDetails details;
|
||||
basalt::darray<VkImage> swapchain_images;
|
||||
basalt::darray<VkImageView> swapchain_image_views;
|
||||
basalt::darray<VkFramebuffer> framebuffers;
|
||||
basalt::Device* device = nullptr;
|
||||
basalt::Window* window = nullptr;
|
||||
VkSwapchainKHR swapchain = VK_NULL_HANDLE;
|
||||
VkExtent2D swapchain_extent;
|
||||
u32 image_count = -1;
|
||||
u32 max_frames_in_flight = 2;
|
||||
u32 current_frame = 0;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user