Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Private Member Functions | Private Attributes
Fling::VulkanApp Class Reference

Core rendering functionality of the Fling Engine. More...

#include <VulkanApp.h>

Inherits Fling::Singleton< VulkanApp >.

Public Member Functions

void Init (PipelineFlags t_Conf, entt::registry &t_Reg, std::shared_ptr< Fling::BaseEditor > t_Editor)
 
void Shutdown (entt::registry &t_Reg)
 
 VulkanApp ()=default
 Specify default constructible so that we have more explicit control with Init and Shutdown. More...
 
 ~VulkanApp ()=default
 
void Update (float DeltaTime, entt::registry &t_Reg)
 Updates all rendering buffers and sends commands to draw a frame. More...
 
FlingWindowGetCurrentWindow () const
 
LogicalDeviceGetLogicalDevice () const
 
PhysicalDeviceGetPhysicalDevice () const
 
const VkCommandPool GetCommandPool () const
 
FirstPersonCameraGetCamera () const
 
- Public Member Functions inherited from Fling::Singleton< VulkanApp >
virtual FLING_API void Init ()
 
virtual FLING_API void Shutdown ()
 

Private Member Functions

void Prepare ()
 Prepare logical, physical and swap chain devices. More...
 
void CreateFrameSyncResources ()
 Create semaphores for available swap chain images and fences for the current frame in flight More...
 
void CreateGameWindow (const UINT32 t_width, const UINT32 t_height)
 Creates a window and preps the VkSurfaceKHR. More...
 
VkExtent2D ChooseSwapExtent ()
 Returns the current extents needed to render based on the physical device and surface. More...
 
void BuildRenderPipelines (PipelineFlags t_Conf, entt::registry &t_Reg, std::shared_ptr< Fling::BaseEditor > t_Editor)
 Builds any render pipelines with their specific set of sub passes and shaders. More...
 
void BuildSwapChainResources ()
 Build the frame buffers for each swap chain image along with the render pass for it to use. More...
 
void BuildGlobalRenderPass ()
 
void BuildSwapChainFrameBuffer ()
 

Private Attributes

Instancem_Instance = nullptr
 Vulkan Devices that need to get created. More...
 
LogicalDevicem_LogicalDevice = nullptr
 
PhysicalDevicem_PhysicalDevice = nullptr
 
FlingWindowm_CurrentWindow = nullptr
 
Swapchainm_SwapChain = nullptr
 
DepthBufferm_DepthBuffer = nullptr
 
VkRenderPass m_RenderPass = VK_NULL_HANDLE
 
std::vector< VkFramebuffer > m_SwapChainFrameBuffers
 
std::vector< VkClearValue > m_SwapChainClearVals = std::vector<VkClearValue>(2)
 The clear values that will be used when building the command buffer to run this subpass. More...
 
VkPipelineStageFlags m_WaitStages = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT }
 
std::vector< CommandBuffer * > m_DrawCmdBuffers
 Keep a vector of command buffers that we want to use so that we can have one for each active frame. More...
 
std::vector< VkSemaphore > m_PresentCompleteSemaphores
 Synchronization primitives for drawing the frame. More...
 
std::vector< VkSemaphore > m_RenderFinishedSemaphores
 
std::vector< VkFence > m_InFlightFences
 
VkSurfaceKHR m_Surface = VK_NULL_HANDLE
 Handle to the surface extension used to interact with the windows system. More...
 
size_t CurrentFrameIndex = 0
 The index of the current frame in flight. More...
 
VkCommandPool m_CommandPool = VK_NULL_HANDLE
 
std::vector< RenderPipeline * > m_RenderPipelines
 
FirstPersonCameram_Camera = nullptr
 The Vulkan app will specify the current camera and be limited to one for now. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Fling::Singleton< VulkanApp >
static VulkanAppGet ()
 
- Protected Member Functions inherited from Fling::Singleton< VulkanApp >
 Singleton ()=default
 Every singleton must have a default constructor so that explicit creation and destruction of them is maintained. More...
 

Detailed Description

Core rendering functionality of the Fling Engine.

Controls what Render pipelines are available

Constructor & Destructor Documentation

◆ VulkanApp()

Fling::VulkanApp::VulkanApp ( )
default

Specify default constructible so that we have more explicit control with Init and Shutdown.

◆ ~VulkanApp()

Fling::VulkanApp::~VulkanApp ( )
default

Member Function Documentation

◆ BuildGlobalRenderPass()

void Fling::VulkanApp::BuildGlobalRenderPass ( )
private

◆ BuildRenderPipelines()

void Fling::VulkanApp::BuildRenderPipelines ( PipelineFlags  t_Conf,
entt::registry &  t_Reg,
std::shared_ptr< Fling::BaseEditor t_Editor 
)
private

Builds any render pipelines with their specific set of sub passes and shaders.

◆ BuildSwapChainFrameBuffer()

void Fling::VulkanApp::BuildSwapChainFrameBuffer ( )
private

◆ BuildSwapChainResources()

void Fling::VulkanApp::BuildSwapChainResources ( )
private

Build the frame buffers for each swap chain image along with the render pass for it to use.

◆ ChooseSwapExtent()

VkExtent2D Fling::VulkanApp::ChooseSwapExtent ( )
private

Returns the current extents needed to render based on the physical device and surface.

◆ CreateFrameSyncResources()

void Fling::VulkanApp::CreateFrameSyncResources ( )
private

Create semaphores for available swap chain images and fences for the current frame in flight

◆ CreateGameWindow()

void Fling::VulkanApp::CreateGameWindow ( const UINT32  t_width,
const UINT32  t_height 
)
private

Creates a window and preps the VkSurfaceKHR.

◆ GetCamera()

FirstPersonCamera* Fling::VulkanApp::GetCamera ( ) const
inline

◆ GetCommandPool()

const VkCommandPool Fling::VulkanApp::GetCommandPool ( ) const
inline

◆ GetCurrentWindow()

FlingWindow* Fling::VulkanApp::GetCurrentWindow ( ) const
inline

◆ GetLogicalDevice()

LogicalDevice* Fling::VulkanApp::GetLogicalDevice ( ) const
inline

◆ GetPhysicalDevice()

PhysicalDevice* Fling::VulkanApp::GetPhysicalDevice ( ) const
inline

◆ Init()

void Fling::VulkanApp::Init ( PipelineFlags  t_Conf,
entt::registry &  t_Reg,
std::shared_ptr< Fling::BaseEditor t_Editor 
)

◆ Prepare()

void Fling::VulkanApp::Prepare ( )
private

Prepare logical, physical and swap chain devices.

Prepares window based on the Fling Config

◆ Shutdown()

void Fling::VulkanApp::Shutdown ( entt::registry &  t_Reg)

◆ Update()

void Fling::VulkanApp::Update ( float  DeltaTime,
entt::registry &  t_Reg 
)

Updates all rendering buffers and sends commands to draw a frame.

offsetX

offsetY

Field Documentation

◆ CurrentFrameIndex

size_t Fling::VulkanApp::CurrentFrameIndex = 0
private

The index of the current frame in flight.

This is controlled with the in flight fences and is updated every Update of the vulkan app.

◆ m_Camera

FirstPersonCamera* Fling::VulkanApp::m_Camera = nullptr
private

The Vulkan app will specify the current camera and be limited to one for now.

◆ m_CommandPool

VkCommandPool Fling::VulkanApp::m_CommandPool = VK_NULL_HANDLE
private

◆ m_CurrentWindow

FlingWindow* Fling::VulkanApp::m_CurrentWindow = nullptr
private

◆ m_DepthBuffer

DepthBuffer* Fling::VulkanApp::m_DepthBuffer = nullptr
private

◆ m_DrawCmdBuffers

std::vector<CommandBuffer*> Fling::VulkanApp::m_DrawCmdBuffers
private

Keep a vector of command buffers that we want to use so that we can have one for each active frame.

◆ m_InFlightFences

std::vector<VkFence> Fling::VulkanApp::m_InFlightFences
private

◆ m_Instance

Instance* Fling::VulkanApp::m_Instance = nullptr
private

Vulkan Devices that need to get created.

VulkanApp::Prepare

◆ m_LogicalDevice

LogicalDevice* Fling::VulkanApp::m_LogicalDevice = nullptr
private

◆ m_PhysicalDevice

PhysicalDevice* Fling::VulkanApp::m_PhysicalDevice = nullptr
private

◆ m_PresentCompleteSemaphores

std::vector<VkSemaphore> Fling::VulkanApp::m_PresentCompleteSemaphores
private

Synchronization primitives for drawing the frame.

See also
VulkanApp::CreateFrameSyncResources

◆ m_RenderFinishedSemaphores

std::vector<VkSemaphore> Fling::VulkanApp::m_RenderFinishedSemaphores
private

◆ m_RenderPass

VkRenderPass Fling::VulkanApp::m_RenderPass = VK_NULL_HANDLE
private

◆ m_RenderPipelines

std::vector<RenderPipeline*> Fling::VulkanApp::m_RenderPipelines
private

◆ m_Surface

VkSurfaceKHR Fling::VulkanApp::m_Surface = VK_NULL_HANDLE
private

Handle to the surface extension used to interact with the windows system.

◆ m_SwapChain

Swapchain* Fling::VulkanApp::m_SwapChain = nullptr
private

◆ m_SwapChainClearVals

std::vector<VkClearValue> Fling::VulkanApp::m_SwapChainClearVals = std::vector<VkClearValue>(2)
private

The clear values that will be used when building the command buffer to run this subpass.

◆ m_SwapChainFrameBuffers

std::vector<VkFramebuffer> Fling::VulkanApp::m_SwapChainFrameBuffers
private

◆ m_WaitStages

VkPipelineStageFlags Fling::VulkanApp::m_WaitStages = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT }
private

The documentation for this class was generated from the following files: