Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::VulkanFramebuffer Class Reference

Vulkan implementation of the Framebuffer abstraction. More...

#include <VulkanFramebuffer.h>

Inheritance diagram for Raven::VulkanFramebuffer:
Raven::Framebuffer Raven::Castable< Framebuffer >

Public Member Functions

 VulkanFramebuffer (const FramebufferSpecification &spec)
 Constructs a VulkanFramebuffer based on the given specification.
virtual ~VulkanFramebuffer ()
 Destructor. Cleans up Vulkan framebuffer resources.
void Resize (u32 width, u32 height, bool forceRecreate=false) override
 Resize the framebuffer dimensions.
void AddResizeCallback (const std::function< void(Ref< Framebuffer >)> &func) override
 Registers a callback to be invoked when the framebuffer is resized.
FramebufferSpecificationGetSpecification () override
 Returns a mutable reference to the framebuffer specification.
const FramebufferSpecificationGetSpecification () const override
 Returns a const reference to the framebuffer specification.
VkRenderPass GetVulkanRenderPass () const
 Returns the Vulkan render pass handle used by this framebuffer.
VkFramebuffer GetVulkanFramebuffer (u32 index=0) const
 Retrieves the Vulkan framebuffer handle.
void Invalidate ()
 Recreates and updates the Vulkan framebuffer and related resources.
Ref< Image2DGetDepthImage () const override
 Returns the depth attachment image.
Ref< Image2DGetImage (u32 index) const override
 Returns the color attachment image at the specified index.
usize GetColorAttachmentCount () const override
 Returns the number of color attachments.
bool HasDepthAttachment () override
 Indicates whether the framebuffer has a depth attachment.
const std::vector< VkClearValue > & GetVulkanClearValues () const
 Returns the Vulkan clear values associated with this framebuffer.
void Release () override
 Releases Vulkan framebuffer and associated resources.
Public Member Functions inherited from Raven::Framebuffer
virtual ~Framebuffer ()=default
Public Member Functions inherited from Raven::Castable< Framebuffer >
T & As ()
 Non-const version of As<T>(), for casting to a non-const target type.

Additional Inherited Members

Static Public Member Functions inherited from Raven::Framebuffer
static Ref< FramebufferCreate (const FramebufferSpecification &spec)
 Factory method to create a framebuffer from specification.

Detailed Description

Vulkan implementation of the Framebuffer abstraction.

Manages Vulkan framebuffers, render passes, and associated images. Supports swapchain-targeted and offscreen framebuffers with depth and color attachments.

Constructor & Destructor Documentation

◆ VulkanFramebuffer()

Raven::VulkanFramebuffer::VulkanFramebuffer ( const FramebufferSpecification & spec)

Constructs a VulkanFramebuffer based on the given specification.

Parameters
specFramebufferSpecification describing attachments and parameters.

◆ ~VulkanFramebuffer()

Raven::VulkanFramebuffer::~VulkanFramebuffer ( )
virtual

Destructor. Cleans up Vulkan framebuffer resources.

Member Function Documentation

◆ AddResizeCallback()

void Raven::VulkanFramebuffer::AddResizeCallback ( const std::function< void(Ref< Framebuffer >)> & func)
overridevirtual

Registers a callback to be invoked when the framebuffer is resized.

Callbacks receive a Ref to the resized framebuffer.

Parameters
funcCallback function to register.

Implements Raven::Framebuffer.

◆ GetColorAttachmentCount()

usize Raven::VulkanFramebuffer::GetColorAttachmentCount ( ) const
inlineoverridevirtual

Returns the number of color attachments.

For swapchain targets this is always 1.

Returns
usize Number of color attachments.

Implements Raven::Framebuffer.

◆ GetDepthImage()

Ref< Image2D > Raven::VulkanFramebuffer::GetDepthImage ( ) const
inlineoverridevirtual

Returns the depth attachment image.

Returns
Ref<Image2D> Depth image or nullptr if none.

Implements Raven::Framebuffer.

◆ GetImage()

Ref< Image2D > Raven::VulkanFramebuffer::GetImage ( u32 index) const
inlineoverridevirtual

Returns the color attachment image at the specified index.

Parameters
indexAttachment index.
Returns
Ref<Image2D> Color attachment image.

Implements Raven::Framebuffer.

◆ GetSpecification() [1/2]

const FramebufferSpecification & Raven::VulkanFramebuffer::GetSpecification ( ) const
inlineoverridevirtual

Returns a const reference to the framebuffer specification.

Implements Raven::Framebuffer.

◆ GetSpecification() [2/2]

FramebufferSpecification & Raven::VulkanFramebuffer::GetSpecification ( )
inlineoverridevirtual

Returns a mutable reference to the framebuffer specification.

Implements Raven::Framebuffer.

◆ GetVulkanClearValues()

const std::vector< VkClearValue > & Raven::VulkanFramebuffer::GetVulkanClearValues ( ) const
inline

Returns the Vulkan clear values associated with this framebuffer.

Useful for vkCmdBeginRenderPass clear operations.

Returns
const std::vector<VkClearValue>& Vector of clear values.

◆ GetVulkanFramebuffer()

VkFramebuffer Raven::VulkanFramebuffer::GetVulkanFramebuffer ( u32 index = 0) const
inline

Retrieves the Vulkan framebuffer handle.

Returns swapchain framebuffer if targeting a swapchain, otherwise the offscreen framebuffer.

Parameters
indexIndex for swapchain framebuffer (default 0).
Returns
VkFramebuffer Vulkan framebuffer handle.

◆ GetVulkanRenderPass()

VkRenderPass Raven::VulkanFramebuffer::GetVulkanRenderPass ( ) const
inline

Returns the Vulkan render pass handle used by this framebuffer.

Returns
VkRenderPass Vulkan render pass.

◆ HasDepthAttachment()

bool Raven::VulkanFramebuffer::HasDepthAttachment ( )
inlineoverridevirtual

Indicates whether the framebuffer has a depth attachment.

Returns
true if a depth attachment exists, false otherwise.

Implements Raven::Framebuffer.

◆ Invalidate()

void Raven::VulkanFramebuffer::Invalidate ( )

Recreates and updates the Vulkan framebuffer and related resources.

Called after resizing or specification changes.

◆ Release()

void Raven::VulkanFramebuffer::Release ( )
overridevirtual

Releases Vulkan framebuffer and associated resources.

Implements Raven::Framebuffer.

◆ Resize()

void Raven::VulkanFramebuffer::Resize ( u32 width,
u32 height,
bool forceRecreate = false )
overridevirtual

Resize the framebuffer dimensions.

Optionally forces recreation of the underlying Vulkan resources even if size hasn't changed.

Parameters
widthNew width of the framebuffer.
heightNew height of the framebuffer.
forceRecreateForce recreation even if size is unchanged.

Implements Raven::Framebuffer.


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