-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathVKViewport.h
More file actions
59 lines (53 loc) · 1.83 KB
/
VKViewport.h
File metadata and controls
59 lines (53 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
class VKViewport :public BearRHI::BearRHIViewport
{
public:
//BEAR_CLASS_WITHOUT_COPY(VKViewport);
VKViewport(void * handle, size_t width, size_t height, bool fullscreen, bool vsync, const BearViewportDescription&description);
virtual ~VKViewport();
virtual void SetVSync(bool sync);
virtual void SetFullScreen(bool fullscreen);
virtual void Resize(size_t width, size_t height);
void Swap();
virtual BearRenderTargetFormat GetFormat();
VkSemaphore Semaphore;
VkSwapchainKHR SwapChain;
BearVector<VkImage> SwapChainImages;
BearVector<VkImageView> SwapChainImageViews;
BearVector<VkFramebuffer> Framebuffers;
VkFormat SwapChainImageFormat;
VkExtent2D SwapChainExtent;
VkRenderPass RenderPass;
BearColor ClearColor;
uint32_t FrameIndex;
size_t Width;
size_t Height;
bool VSync;
VkQueue PresentQueue;
VkRenderPassBeginInfo GetRenderPass();
VkFence PresentFence;
private:
BearViewportDescription Description;
uint32_t m_PresentQueueFamilyIndex;
struct SwapChainSupportDetails
{
VkSurfaceCapabilitiesKHR capabilities;
BearVector<VkSurfaceFormatKHR> formats;
BearVector<VkPresentModeKHR> presentModes;
};
VkClearValue m_ClearValues[1];
SwapChainSupportDetails QuerySwapChainSupport();
VkSurfaceFormatKHR ChooseSwapSurfaceFormat(const BearVector<VkSurfaceFormatKHR>& available_formats);
VkPresentModeKHR ChooseSwapPresentMode(const BearVector<VkPresentModeKHR>& available_present_modes,bool vsync);
VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, size_t width, size_t height);
VkSurfaceKHR Surface;
uint32_t FindQueueFamilies();
void CreateSwapChain(size_t width, size_t height,bool vsync);
void CreateImageView();
void DestroyImageView();
void DestroySwapChain(VkSwapchainKHR swap_chain);
void CreateFrameBuffers();
void DestroyFrameBuffers();
bool m_FullScreen;
HWND m_WindowHandle;
};