Interface Class for vulkan backend. More...
#include <Interface.hpp>
Public Member Functions | |
| Interface (SDL_Window *window, glm::uvec2 initialResolution, GameInfo gInfo, VirtualFileSystem *vfs) | |
| Constructor for Interface class. | |
| ~Interface () | |
| Simple destructor cleaning up resources. | |
| void | bindWindow (SDL_Window *window) |
| Binds the backend to a window. | |
| void | unbindWindow () |
| Unbinds the current window. | |
| void | createDefaultTexture () |
| Creates the default texture. | |
| VulkanContext * | getContext () |
| Getter for VulkanContext. | |
| VulkanResources * | getResources () |
| Getter for VulkanResources. | |
| MeshManager & | getMeshManager () |
| Getter for MeshManager. | |
| Renderer & | getRenderer () |
| Getter for Renderer. | |
| void | setEnvironment (environment env) |
| Allows to update Enviroment settings at runtime. | |
| environment | getEnvironment () |
| Getter for Enviroment settings. | |
| void | WaitForGPUToFinish () |
| Helper function to wait for GPU to finish. | |
| void | setVSync (bool enabled) |
| Sets VSync (Vertical Synchronization). | |
Private Member Functions | |
| uint32_t | GetBestDeviceVersion () |
| bool | CheckValidationLayerSupport () |
Private Attributes | |
| VulkanContext | m_context |
| SDL_Window * | m_p_window |
| VirtualFileSystem * | m_vfs |
| std::unique_ptr< VulkanSwapchainManager > | m_p_swapchainManager |
| std::unique_ptr< VulkanResources > | m_p_resources |
| std::unique_ptr< VulkanPipeline > | m_p_pipeline |
| std::unique_ptr< VulkanPipeline > | m_p_transPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_maskPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_billboardMaskedPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_billboardTransPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_particleMaskedPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_particleTransPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_uiPipeline |
| std::unique_ptr< VulkanPipeline > | m_p_compositePipeline |
| std::unique_ptr< VulkanPipeline > | m_p_fullscreenPipeline |
| std::unique_ptr< MeshManager > | m_p_meshManager |
| std::unique_ptr< Renderer > | m_p_renderer |
Interface Class for vulkan backend.
This class manages the entire Vulkan backend lifecycle. It handles:
Definition at line 34 of file Interface.hpp.
| vex::Interface::Interface | ( | SDL_Window * | window, |
| glm::uvec2 | initialResolution, | ||
| GameInfo | gInfo, | ||
| VirtualFileSystem * | vfs ) |
Constructor for Interface class.
Initializes the Vulkan loader, creates an Instance with required extensions (including Portability for macOS), picks a physical device, creates a logical device with VMA allocator, and initializes all subsystems (Resources, MeshManager, Pipelines, Renderer).
| SDL_Window* | window - Pointer to the SDL_Window to bind to. |
| glm::uvec2 | initialResolution - Initial rendering resolution. |
| GameInfo | gInfo - Game metadata used for application info in Vulkan. |
| VirtualFileSystem* | vfs - Pointer to the virtual file system for asset loading. |
Definition at line 74 of file Interface.cpp.
| vex::Interface::~Interface | ( | ) |
Simple destructor cleaning up resources.
Waits for the device to idle, then destroys subsystems in reverse dependency order (Renderer -> Pipelines -> Resources -> Swapchain -> Device -> Instance).
Definition at line 730 of file Interface.cpp.
| void vex::Interface::bindWindow | ( | SDL_Window * | window | ) |
Binds the backend to a window.
Creates a Vulkan surface using SDL_Vulkan_CreateSurface and initializes the swapchain.
| SDL_Window* | window - Pointer to the SDL_Window. |
Definition at line 799 of file Interface.cpp.
|
private |
Definition at line 17 of file Interface.cpp.
| void vex::Interface::createDefaultTexture | ( | ) |
Creates the default texture.
Delegates to VulkanResources::createDefaultTexture to generate a 1x1 white fallback texture.
Definition at line 785 of file Interface.cpp.
|
private |
Definition at line 31 of file Interface.cpp.
|
inline |
Getter for VulkanContext.
Definition at line 63 of file Interface.hpp.
|
inline |
Getter for Enviroment settings.
Definition at line 84 of file Interface.hpp.
|
inline |
Getter for MeshManager.
Definition at line 71 of file Interface.hpp.
|
inline |
Getter for Renderer.
Definition at line 75 of file Interface.hpp.
|
inline |
Getter for VulkanResources.
Definition at line 67 of file Interface.hpp.
|
inline |
Allows to update Enviroment settings at runtime.
Updates the internal environment struct in the context, which the Renderer later pushes to the Scene UBO (e.g., Lighting, PS1 effects).
| environment | env - The new environment settings. |
Definition at line 80 of file Interface.hpp.
| void vex::Interface::setVSync | ( | bool | enabled | ) |
Sets VSync (Vertical Synchronization).
Updates the swapchain manager settings and requests a swapchain recreation on the next frame.
| bool | enabled - True to enable VSync (FIFO), false to disable (IMMEDIATE/MAILBOX). |
Definition at line 793 of file Interface.cpp.
| void vex::Interface::unbindWindow | ( | ) |
Unbinds the current window.
Waits for the GPU to idle, cleans up the swapchain, and destroys the window surface.
Definition at line 813 of file Interface.cpp.
| void vex::Interface::WaitForGPUToFinish | ( | ) |
Helper function to wait for GPU to finish.
Calls vkDeviceWaitIdle. Should be used before resizing or shutting down to prevent resource hazards.
Definition at line 789 of file Interface.cpp.
|
private |
Definition at line 101 of file Interface.hpp.
|
private |
Definition at line 109 of file Interface.hpp.
|
private |
Definition at line 110 of file Interface.hpp.
|
private |
Definition at line 114 of file Interface.hpp.
|
private |
Definition at line 115 of file Interface.hpp.
|
private |
Definition at line 108 of file Interface.hpp.
|
private |
Definition at line 116 of file Interface.hpp.
|
private |
Definition at line 111 of file Interface.hpp.
|
private |
Definition at line 112 of file Interface.hpp.
|
private |
Definition at line 106 of file Interface.hpp.
|
private |
Definition at line 117 of file Interface.hpp.
|
private |
Definition at line 105 of file Interface.hpp.
|
private |
Definition at line 104 of file Interface.hpp.
|
private |
Definition at line 107 of file Interface.hpp.
|
private |
Definition at line 113 of file Interface.hpp.
|
private |
Definition at line 102 of file Interface.hpp.
|
private |
Definition at line 103 of file Interface.hpp.