Vulkan Engine 0.0
A simple Vulkan engine demo
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Attachment Class Reference

Attachment for a render pass. More...

#include <attachment.hpp>

Public Member Functions

 Attachment (EngineDevice &device, VkFormat format, uint32_t width, uint32_t height, VkImageUsageFlags usage, VkImageAspectFlags aspect_mask, VkImageLayout final_layout, VkImageLayout att_layout, uint32_t att_index, bool reduce_size)
 Initializes the Attachment object, given all the required metadata. More...
 
 ~Attachment ()
 
void set_size (uint32_t w, uint32_t h)
 In case the viewport size changes during runtime (IE: resizing the game window), this method can be used to set its new size without needing to manually destroy and re-create the object. More...
 
VkSampler & get_sampler ()
 
VkImage & get_image ()
 
VkImageView & get_image_view ()
 
uint32_t get_index () const
 
VkAttachmentReference & get_reference ()
 
VkAttachmentDescription & get_description ()
 
 Attachment (const Attachment &)=delete
 
Attachmentoperator= (const Attachment &)=delete
 
 Attachment (Attachment &&)=delete
 
Attachmentoperator= (Attachment &&)=delete
 

Detailed Description

Attachment for a render pass.

This class is responsible for managing the Vulkan image and image view, as well as its allocation and any other metadata required to define a render pass attachment. In case the resulting image needs to be read, it can also generate an appropriate sampler.

Constructor & Destructor Documentation

◆ Attachment() [1/3]

Attachment::Attachment ( EngineDevice device,
VkFormat  format,
uint32_t  width,
uint32_t  height,
VkImageUsageFlags  usage,
VkImageAspectFlags  aspect_mask,
VkImageLayout  final_layout,
VkImageLayout  att_layout,
uint32_t  att_index,
bool  reduce_size 
)
inline

Initializes the Attachment object, given all the required metadata.

Some parameters are set to sane defaults that never need to change so they're not required in the constructor.

Parameters
widthwidth of the viewport
heightheight of the viewport
reduce_sizesome render passes need an attachment half the size of the regular viewport size. In this case, the full width and height of the viewport are passed to this constructor, and this flag is set to true. This makes the code more consistent.

◆ ~Attachment()

Attachment::~Attachment ( )
inline

◆ Attachment() [2/3]

Attachment::Attachment ( const Attachment )
delete

◆ Attachment() [3/3]

Attachment::Attachment ( Attachment &&  )
delete

Member Function Documentation

◆ get_description()

VkAttachmentDescription & Attachment::get_description ( )
inline

◆ get_image()

VkImage & Attachment::get_image ( )
inline

◆ get_image_view()

VkImageView & Attachment::get_image_view ( )
inline

◆ get_index()

uint32_t Attachment::get_index ( ) const
inline

◆ get_reference()

VkAttachmentReference & Attachment::get_reference ( )
inline

◆ get_sampler()

VkSampler & Attachment::get_sampler ( )
inline

◆ operator=() [1/2]

Attachment & Attachment::operator= ( Attachment &&  )
delete

◆ operator=() [2/2]

Attachment & Attachment::operator= ( const Attachment )
delete

◆ set_size()

void Attachment::set_size ( uint32_t  w,
uint32_t  h 
)
inline

In case the viewport size changes during runtime (IE: resizing the game window), this method can be used to set its new size without needing to manually destroy and re-create the object.

Instead this method will take care of it.


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