Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Protected Attributes
Fling::Subpass Class Referenceabstract

A subpass represents one part of a RenderPipeline. More...

#include <Subpass.h>

Inherits Fling::NonCopyable.

Inherited by Fling::DebugSubpass, Fling::GeometrySubpass, Fling::ImGuiSubpass, and Fling::OffscreenSubpass.

Public Member Functions

 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 PrepareAttachments ()
 Add any attachments to a frame buffer that this subpass may need. More...
 
virtual void CreateGraphicsPipeline ()=0
 
virtual void Draw (CommandBuffer &t_CmdBuf, VkFramebuffer t_PresentFrameBuf, UINT32 t_ActiveFrameInFlight, entt::registry &t_reg, float DeltaTime)=0
 
virtual void CleanUp (entt::registry &t_reg)
 Cleanup any allocated resources that you may need a registry for. More...
 
virtual void CreateDescriptorSets (VkDescriptorPool t_Pool, entt::registry &t_reg)=0
 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...
 
virtual void GatherPresentDependencies (std::vector< CommandBuffer *> &t_CmdBuffs, std::vector< VkSemaphore > &t_Deps, UINT32 t_ActiveFrameIndex, UINT32 t_CurrentFrameInFlight)
 If a subpass has a command buffer that the final swap chain presentation is dependent on, then add it this vector. More...
 
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
 

Protected Attributes

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...
 

Additional Inherited Members

- Protected Member Functions inherited from Fling::NonCopyable
 NonCopyable ()=default
 
virtual ~NonCopyable ()=default
 

Detailed Description

A subpass represents one part of a RenderPipeline.

Each subpass should can add attachments to the frame buffer, build it's own command buffers, and create its own descriptors. When overriding this class, add any additional uniform buffers or bindings you may need into the child class.

See also
GeometrySubpass for an example

Constructor & Destructor Documentation

◆ Subpass()

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 
)

◆ ~Subpass()

Fling::Subpass::~Subpass ( )
virtual

Member Function Documentation

◆ CleanUp()

virtual void Fling::Subpass::CleanUp ( entt::registry &  t_reg)
inlinevirtual

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

Reimplemented in Fling::OffscreenSubpass, Fling::DebugSubpass, and Fling::ImGuiSubpass.

◆ CreateDescriptorSets()

virtual void Fling::Subpass::CreateDescriptorSets ( VkDescriptorPool  t_Pool,
entt::registry &  t_reg 
)
pure virtual

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

Implemented in Fling::GeometrySubpass, Fling::OffscreenSubpass, Fling::DebugSubpass, and Fling::ImGuiSubpass.

◆ CreateGraphicsPipeline()

virtual void Fling::Subpass::CreateGraphicsPipeline ( )
pure virtual

◆ Draw()

virtual void Fling::Subpass::Draw ( CommandBuffer t_CmdBuf,
VkFramebuffer  t_PresentFrameBuf,
UINT32  t_ActiveFrameInFlight,
entt::registry &  t_reg,
float  DeltaTime 
)
pure virtual

◆ GatherPresentBuffers()

virtual void Fling::Subpass::GatherPresentBuffers ( std::vector< CommandBuffer *> &  t_CmdBuffs,
UINT32  t_ActiveFrameIndex 
)
inlinevirtual

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.

ImGUI is an example of this

◆ GatherPresentDependencies()

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

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 in Fling::OffscreenSubpass.

◆ GetClearValues()

const std::vector<VkClearValue>& Fling::Subpass::GetClearValues ( ) const
inline

◆ GetGraphicsPipeline()

GraphicsPipeline* Fling::Subpass::GetGraphicsPipeline ( ) const
inlinenoexcept

◆ PrepareAttachments()

virtual void Fling::Subpass::PrepareAttachments ( )
inlinevirtual

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

Reimplemented in Fling::OffscreenSubpass, Fling::DebugSubpass, and Fling::ImGuiSubpass.

Field Documentation

◆ m_ClearValues

std::vector<VkClearValue> Fling::Subpass::m_ClearValues = std::vector<VkClearValue>(2)
protected

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

◆ m_Device

const LogicalDevice* Fling::Subpass::m_Device
protected

◆ m_FragShader

std::shared_ptr<Fling::Shader> Fling::Subpass::m_FragShader
protected

◆ m_GraphicsPipeline

GraphicsPipeline* Fling::Subpass::m_GraphicsPipeline = nullptr
protected

Layouts created in the constructor via shader reflection.

◆ m_SwapChain

const Swapchain* Fling::Subpass::m_SwapChain
protected

◆ m_VertexShader

std::shared_ptr<Fling::Shader> Fling::Subpass::m_VertexShader
protected

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