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

#include <OffscreenSubpass.h>

Inherits Fling::Subpass.

Public Member Functions

 OffscreenSubpass (const LogicalDevice *t_Dev, const Swapchain *t_Swap, entt::registry &t_reg, FirstPersonCamera *t_Cam, std::shared_ptr< Fling::Shader > t_Vert, std::shared_ptr< Fling::Shader > t_Frag)
 
virtual ~OffscreenSubpass ()
 
FrameBufferGetOffscreenFrameBuffer () const
 
void Draw (CommandBuffer &t_CmdBuf, VkFramebuffer t_PresentFrameBuf, UINT32 t_ActiveSwapImage, entt::registry &t_reg, float DeltaTime) override
 
void CreateDescriptorSets (VkDescriptorPool t_Pool, entt::registry &t_reg) override
 Given the frame buffers and the registry, create any descriptor sets that we may need Assumes that the frame buffer has been prepared with it's attachments already. More...
 
void PrepareAttachments () override
 Add any attachments to a frame buffer that this subpass may need. More...
 
void CreateGraphicsPipeline () override
 
void GatherPresentDependencies (std::vector< CommandBuffer *> &t_CmdBuffs, std::vector< VkSemaphore > &t_Deps, UINT32 t_ActiveFrameIndex, UINT32 t_CurrentFrameInFlight) override
 If a subpass has a command buffer that the final swap chain presentation is dependent on, then add it this vector. More...
 
void CleanUp (entt::registry &t_reg) override
 Cleanup any allocated resources that you may need a registry for. More...
 
- Public Member Functions inherited from Fling::Subpass
 Subpass (const LogicalDevice *t_Dev, const Swapchain *t_Swap, std::shared_ptr< Fling::Shader > t_Vert, std::shared_ptr< Fling::Shader > t_Frag)
 
virtual ~Subpass ()
 
virtual void GatherPresentBuffers (std::vector< CommandBuffer *> &t_CmdBuffs, UINT32 t_ActiveFrameIndex)
 If a subpass has an additional command buffer to add to the final swap chain draw submission but it is not dependent on it, then add it here. More...
 
GraphicsPipelineGetGraphicsPipeline () const noexcept
 
const std::vector< VkClearValue > & GetClearValues () const
 
- Public Member Functions inherited from Fling::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=default
 

Private Member Functions

void OnMeshRendererAdded (entt::entity t_Ent, entt::registry &t_Reg, MeshRenderer &t_MeshRend)
 
void CreateMeshDescriptorSet (MeshRenderer &t_MeshRend, VkDescriptorPool t_Pool, FrameBuffer &t_FrameBuf)
 
void BuildOffscreenCommandBuffer (entt::registry &t_reg, UINT32 t_ActiveFrameInFlight)
 

Private Attributes

std::vector< VkSemaphore > m_OffscreenSemaphores
 
VkCommandPool m_CommandPool = VK_NULL_HANDLE
 
std::vector< CommandBuffer * > m_OffscreenCmdBufs
 
FrameBufferm_OffscreenFrameBuf = nullptr
 
const FirstPersonCameram_Camera
 
VkDescriptorPool m_DescriptorPool = VK_NULL_HANDLE
 

Additional Inherited Members

- Protected Member Functions inherited from Fling::NonCopyable
 NonCopyable ()=default
 
virtual ~NonCopyable ()=default
 
- Protected Attributes inherited from Fling::Subpass
const LogicalDevicem_Device
 
const Swapchainm_SwapChain
 
std::shared_ptr< Fling::Shaderm_VertexShader
 
std::shared_ptr< Fling::Shaderm_FragShader
 
std::vector< VkClearValue > m_ClearValues = std::vector<VkClearValue>(2)
 The clear values that will be used when building the command buffer to run this subpass. More...
 
GraphicsPipelinem_GraphicsPipeline = nullptr
 Layouts created in the constructor via shader reflection. More...
 

Constructor & Destructor Documentation

◆ OffscreenSubpass()

Fling::OffscreenSubpass::OffscreenSubpass ( const LogicalDevice t_Dev,
const Swapchain t_Swap,
entt::registry &  t_reg,
FirstPersonCamera t_Cam,
std::shared_ptr< Fling::Shader t_Vert,
std::shared_ptr< Fling::Shader t_Frag 
)

◆ ~OffscreenSubpass()

Fling::OffscreenSubpass::~OffscreenSubpass ( )
virtual

Member Function Documentation

◆ BuildOffscreenCommandBuffer()

void Fling::OffscreenSubpass::BuildOffscreenCommandBuffer ( entt::registry &  t_reg,
UINT32  t_ActiveFrameInFlight 
)
private

◆ CleanUp()

void Fling::OffscreenSubpass::CleanUp ( entt::registry &  t_reg)
overridevirtual

Cleanup any allocated resources that you may need a registry for.

Reimplemented from Fling::Subpass.

◆ CreateDescriptorSets()

void Fling::OffscreenSubpass::CreateDescriptorSets ( VkDescriptorPool  t_Pool,
entt::registry &  t_reg 
)
overridevirtual

Given the frame buffers and the registry, create any descriptor sets that we may need Assumes that the frame buffer has been prepared with it's attachments already.

Parameters
t_FrameBufferThe swap chain frame buffer

Implements Fling::Subpass.

◆ CreateGraphicsPipeline()

void Fling::OffscreenSubpass::CreateGraphicsPipeline ( )
overridevirtual

Implements Fling::Subpass.

◆ CreateMeshDescriptorSet()

void Fling::OffscreenSubpass::CreateMeshDescriptorSet ( MeshRenderer t_MeshRend,
VkDescriptorPool  t_Pool,
FrameBuffer t_FrameBuf 
)
private

◆ Draw()

void Fling::OffscreenSubpass::Draw ( CommandBuffer t_CmdBuf,
VkFramebuffer  t_PresentFrameBuf,
UINT32  t_ActiveSwapImage,
entt::registry &  t_reg,
float  DeltaTime 
)
overridevirtual

offsetX

offsetY

Implements Fling::Subpass.

◆ GatherPresentDependencies()

void Fling::OffscreenSubpass::GatherPresentDependencies ( std::vector< CommandBuffer *> &  t_CmdBuffs,
std::vector< VkSemaphore > &  t_Deps,
UINT32  t_ActiveFrameIndex,
UINT32  t_CurrentFrameInFlight 
)
overridevirtual

If a subpass has a command buffer that the final swap chain presentation is dependent on, then add it this vector.

The Deferred offscreen GBuffer is an example of this

Reimplemented from Fling::Subpass.

◆ GetOffscreenFrameBuffer()

FrameBuffer* Fling::OffscreenSubpass::GetOffscreenFrameBuffer ( ) const
inline

◆ OnMeshRendererAdded()

void Fling::OffscreenSubpass::OnMeshRendererAdded ( entt::entity  t_Ent,
entt::registry &  t_Reg,
MeshRenderer t_MeshRend 
)
private

◆ PrepareAttachments()

void Fling::OffscreenSubpass::PrepareAttachments ( )
overridevirtual

Add any attachments to a frame buffer that this subpass may need.

Reimplemented from Fling::Subpass.

Field Documentation

◆ m_Camera

const FirstPersonCamera* Fling::OffscreenSubpass::m_Camera
private

◆ m_CommandPool

VkCommandPool Fling::OffscreenSubpass::m_CommandPool = VK_NULL_HANDLE
private

◆ m_DescriptorPool

VkDescriptorPool Fling::OffscreenSubpass::m_DescriptorPool = VK_NULL_HANDLE
private

◆ m_OffscreenCmdBufs

std::vector<CommandBuffer*> Fling::OffscreenSubpass::m_OffscreenCmdBufs
private

◆ m_OffscreenFrameBuf

FrameBuffer* Fling::OffscreenSubpass::m_OffscreenFrameBuf = nullptr
private

◆ m_OffscreenSemaphores

std::vector<VkSemaphore> Fling::OffscreenSubpass::m_OffscreenSemaphores
private

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