38 lines
951 B
C
38 lines
951 B
C
/// =============================================
|
|
// Aster: swapchain.h
|
|
// Copyright (c) 2020-2024 Anish Bhobe
|
|
// ==============================================
|
|
|
|
#pragma once
|
|
|
|
#include "global.h"
|
|
|
|
#include "size.h"
|
|
|
|
#include <EASTL/fixed_vector.h>
|
|
|
|
struct Surface;
|
|
struct PhysicalDevice;
|
|
struct Window;
|
|
struct Device;
|
|
|
|
struct Swapchain final
|
|
{
|
|
using FnResizeCallback = eastl::function<void(vk::Extent2D)>;
|
|
|
|
vk::SwapchainKHR m_Swapchain;
|
|
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 Surface *surface, const Device *device, Size size, cstr name);
|
|
void RegisterResizeCallback(FnResizeCallback &&callback);
|
|
|
|
// Ctor/Dtor
|
|
void Init(const Surface *surface, const Device *device, Size size, cstr name);
|
|
void Destroy(const Device *device);
|
|
};
|