VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
SwapchainManager.hpp
Go to the documentation of this file.
1
6
7
#pragma once
8
9
#include <volk.h>
10
#include <vk_mem_alloc.h>
11
#include <SDL3/SDL.h>
12
#include <SDL3/SDL_vulkan.h>
13
#include <vector>
14
#include <memory>
15
16
#include "
context.hpp
"
17
#include "components/ErrorUtils.hpp"
18
19
namespace
vex
{
21
class
VulkanSwapchainManager
{
22
public
:
26
VulkanSwapchainManager
(
VulkanContext
& context, SDL_Window* window);
27
29
~VulkanSwapchainManager
();
30
33
void
createSwapchain
();
34
37
void
cleanupSwapchain
();
38
41
void
cleanupSyncObjects
();
42
45
void
recreateSwapchain
();
46
50
void
setVSync
(
bool
enabled);
51
private
:
53
void
createImageViews
();
54
56
void
createCommandPool
();
57
59
void
createCommandBuffers
();
60
62
void
createSyncObjects
();
63
65
void
createDepthResources
();
66
68
void
createLowResResources
();
69
72
void
cleanupLowResResources
();
73
77
VkSurfaceFormatKHR
chooseSwapSurfaceFormat
(
const
std::vector<VkSurfaceFormatKHR>& availableFormats);
78
82
VkPresentModeKHR
chooseSwapPresentMode
(
const
std::vector<VkPresentModeKHR>& availablePresentModes);
83
87
VkExtent2D
chooseSwapExtent
(
const
VkSurfaceCapabilitiesKHR& capabilities);
88
91
VkFormat
findDepthFormat
();
92
93
VulkanContext
& m_r_context;
94
SDL_Window *m_p_window;
95
bool
m_vsyncEnabled =
false
;
96
};
97
}
vex::VulkanSwapchainManager::cleanupSwapchain
void cleanupSwapchain()
Cleans up swapchain resources.
Definition
SwapchainManager.cpp:527
vex::VulkanSwapchainManager::createDepthResources
void createDepthResources()
Helper function to create depth resources for swapchain creation.
Definition
SwapchainManager.cpp:146
vex::VulkanSwapchainManager::~VulkanSwapchainManager
~VulkanSwapchainManager()
Simple destructor.
Definition
SwapchainManager.cpp:15
vex::VulkanSwapchainManager::setVSync
void setVSync(bool enabled)
Sets the vsync enabled state.
Definition
SwapchainManager.cpp:619
vex::VulkanSwapchainManager::cleanupSyncObjects
void cleanupSyncObjects()
Cleans up synchronization objects.
Definition
SwapchainManager.cpp:551
vex::VulkanSwapchainManager::VulkanSwapchainManager
VulkanSwapchainManager(VulkanContext &context, SDL_Window *window)
Constructor for VulkanSwapchainManager.
Definition
SwapchainManager.cpp:12
vex::VulkanSwapchainManager::chooseSwapSurfaceFormat
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector< VkSurfaceFormatKHR > &availableFormats)
Helper function choosing SwapSurfaceFormat based on hardware capabilities.
Definition
SwapchainManager.cpp:608
vex::VulkanSwapchainManager::chooseSwapPresentMode
VkPresentModeKHR chooseSwapPresentMode(const std::vector< VkPresentModeKHR > &availablePresentModes)
Helper function choosing SwapPresentMode based on hardware capabilities.
Definition
SwapchainManager.cpp:623
vex::VulkanSwapchainManager::cleanupLowResResources
void cleanupLowResResources()
Helper function to cleanup low resolution resources, since low res resources can be changed without c...
Definition
SwapchainManager.cpp:463
vex::VulkanSwapchainManager::chooseSwapExtent
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR &capabilities)
Helper function choosing SwapExtent based on hardware capabilities.
Definition
SwapchainManager.cpp:639
vex::VulkanSwapchainManager::createImageViews
void createImageViews()
Helper function to create image views for swapchain images.
Definition
SwapchainManager.cpp:200
vex::VulkanSwapchainManager::recreateSwapchain
void recreateSwapchain()
Recreates the swapchain.
Definition
SwapchainManager.cpp:575
vex::VulkanSwapchainManager::createSyncObjects
void createSyncObjects()
Helper function to create synchronization objects for swapchain creation.
Definition
SwapchainManager.cpp:281
vex::VulkanSwapchainManager::createCommandPool
void createCommandPool()
Helper function to create command pool for swapchain creation.
Definition
SwapchainManager.cpp:228
vex::VulkanSwapchainManager::createLowResResources
void createLowResResources()
Helper function to create low resolution resources for low res rendering.
Definition
SwapchainManager.cpp:328
vex::VulkanSwapchainManager::findDepthFormat
VkFormat findDepthFormat()
Helper function to find depth format based on hardware capabilities.
Definition
SwapchainManager.cpp:665
vex::VulkanSwapchainManager::createCommandBuffers
void createCommandBuffers()
Helper function to create command buffers for swapchain creation.
Definition
SwapchainManager.cpp:259
vex::VulkanSwapchainManager::createSwapchain
void createSwapchain()
Creates or recreates the swapchain.
Definition
SwapchainManager.cpp:20
context.hpp
This file defines struct holding all vulkan data, like device, surface, swapchain,...
vex
Definition
AssetTypes.hpp:10
vex::VulkanContext
Struct holding all vulkan data, like device, surface, swapchain, images, views, and more.
Definition
context.hpp:26
Core
src
components
backends
vulkan
SwapchainManager.hpp
Generated by
1.16.1