Surface initialization and destruction moved to KRSurface

This commit is contained in:
2021-08-16 19:51:15 -07:00
parent 61a83dd28d
commit 0e2bd45b7f
5 changed files with 286 additions and 224 deletions

View File

@@ -30,26 +30,41 @@
//
#include "KREngine-common.h"
#include "KRContext.h"
#ifndef KRSURFACE_H
#define KRSURFACE_H
class KRSurface
class KRSurface : public KRContextObject
{
public:
KrDeviceHandle deviceHandle;
VkSurfaceKHR surface;
VkSwapchainKHR swapChain;
std::vector<VkImage> swapChainImages;
VkFormat swapChainImageFormat;
VkExtent2D swapChainExtent;
std::vector<VkImageView> swapChainImageViews;
std::vector<VkFramebuffer> swapChainFramebuffers;
VkSemaphore imageAvailableSemaphore;
VkSemaphore renderFinishedSemaphore;
#ifdef WIN32
HWND hWnd;
KRSurface(KRContext& context, HWND hWnd);
#else
KRSurface(KRContext& context);
#endif
~KRSurface();
void destroy();
KRSurface(const KRSurface&) = delete;
KRSurface& operator=(const KRSurface&) = delete;
KrResult initialize();
#ifdef WIN32
HWND m_hWnd;
#endif
KrDeviceHandle m_deviceHandle;
VkSurfaceKHR m_surface;
VkSwapchainKHR m_swapChain;
std::vector<VkImage> m_swapChainImages;
VkFormat m_swapChainImageFormat;
VkExtent2D m_swapChainExtent;
std::vector<VkImageView> m_swapChainImageViews;
std::vector<VkFramebuffer> m_swapChainFramebuffers;
VkSemaphore m_imageAvailableSemaphore;
VkSemaphore m_renderFinishedSemaphore;
private:
};