46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
/// =============================================
|
|
// Aster: swapchain.h
|
|
// Copyright (c) 2020-2024 Anish Bhobe
|
|
// ==============================================
|
|
|
|
#pragma once
|
|
|
|
#include "global.h"
|
|
|
|
#include <EASTL/fixed_vector.h>
|
|
|
|
struct PhysicalDevice;
|
|
struct Window;
|
|
struct Device;
|
|
|
|
struct Swapchain final
|
|
{
|
|
using FnResizeCallback = eastl::function<void(vk::Extent2D)>;
|
|
|
|
const Device *m_Device;
|
|
vk::SwapchainKHR m_Swapchain;
|
|
NameString m_Name;
|
|
vk::Extent2D m_Extent;
|
|
vk::Format m_Format;
|
|
eastl::fixed_vector<vk::Image, 4> m_Images;
|
|
eastl::fixed_vector<vk::ImageView, 4> m_ImageViews;
|
|
|
|
eastl::vector<FnResizeCallback> m_ResizeCallbacks;
|
|
|
|
void Create(const Window *window);
|
|
void RegisterResizeCallback(FnResizeCallback &&callback);
|
|
|
|
// Ctor/Dtor
|
|
Swapchain(const Window *window, const Device *device, NameString &&name);
|
|
~Swapchain();
|
|
|
|
// Move
|
|
Swapchain(Swapchain &&other) noexcept;
|
|
Swapchain &operator=(Swapchain &&other) noexcept;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Swapchain);
|
|
|
|
private:
|
|
void Cleanup();
|
|
};
|