VulkanEngine 0.1
Graphics engine using Vulkan
Loading...
Searching...
No Matches
VulkanEngine::Image< format, image_type, tiling, sample_count_flags > Class Template Reference

#include <Image.h>

Inheritance diagram for VulkanEngine::Image< format, image_type, tiling, sample_count_flags >:
VulkanEngine::StagedBufferDestination VulkanEngine::ImageBase VulkanEngine::BufferBase VulkanEngine::SingleUsageCommandBuffer VulkanEngine::ShaderImage< format, image_type, tiling, sample_count_flags >

Public Member Functions

 Image (vk::ImageLayout initial_layout, vk::ImageUsageFlags usage_flags, VmaMemoryUsage vma_memory_usage, uint32_t _width, uint32_t _height, uint32_t _depth, size_t pixel_size, bool generate_mip_maps)
 
virtual ~Image ()
 Destructor.
 
void setImageData (const void *data)
 
void createImageView (vk::ImageViewType image_view_type, vk::ImageAspectFlags image_aspect_flags)
 
void transitionImageLayout (vk::ImageLayout new_layout, const vk::CommandBuffer &command_buffer=nullptr)
 
const vk::Format getVkFormat () const
 Get the vk::Format of the image.
 
const vk::SampleCountFlagBits getVkSampleCountFlags () const
 Get vk::SampleCountFlagBits.
 
virtual vk::Image getVkImage () const
 Get the interal vulkan image.
 
virtual vk::ImageView getVkImageView () const
 Get the vk::ImageView.
 
- Public Member Functions inherited from VulkanEngine::BufferBase
virtual void updateBuffer (const void *_data, size_t _data_size)
 
- Public Member Functions inherited from VulkanEngine::ImageBase
 ImageBase ()
 Contructor.
 
virtual ~ImageBase ()
 Destructor.
 
virtual vk::Image getVkImage () const =0
 Get the interal vulkan image.
 
virtual vk::ImageView getVkImageView () const =0
 Get the internal vulkan image view.
 

Protected Member Functions

virtual void insertTransferCommand (const vk::CommandBuffer &command_buffer, const vk::Buffer &source_buffer)
 
virtual size_t getStagingBufferSize () const
 
- Protected Member Functions inherited from VulkanEngine::SingleUsageCommandBuffer
void beginSingleUsageCommandBuffer ()
 Creates and starts recording the command buffer.
 
void endSingleUsageCommandBuffer ()
 Stops recording and submits the command buffer.
 

Protected Attributes

uint32_t width
 The width of the Image.
 
uint32_t height
 The height of the Image.
 
uint32_t depth
 The depth of the Image.
 
size_t data_size
 The total size of Image's data.
 
uint32_t mipmap_levels
 The number of mipmap images to generate.
 
vk::ImageLayout vk_image_layout
 The current vk::ImageLayout.
 
vk::Image vk_image
 Internal vk_image.
 
vk::ImageView vk_image_view
 The vk::ImageView created in createImageView().
 
VkImageCreateInfo image_create_info
 VkImageCreateInfo.
 
- Protected Attributes inherited from VulkanEngine::BufferBase
VmaAllocation vma_allocation
 
- Protected Attributes inherited from VulkanEngine::SingleUsageCommandBuffer
vk::CommandBuffer single_use_command_buffer
 The single use command buffer.
 

Detailed Description

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
class VulkanEngine::Image< format, image_type, tiling, sample_count_flags >

Represents an image.

Template Parameters
formatThe vk::Format of the pixels in the image.
image_typeThe vk::ImageType specifying the dimensions of the image.
tilingThe vk::ImageTiling option to use.
sample_count_flagsvk::SampleCountFlagBits option to use for the image.

Constructor & Destructor Documentation

◆ Image()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::Image ( vk::ImageLayout  initial_layout,
vk::ImageUsageFlags  usage_flags,
VmaMemoryUsage  vma_memory_usage,
uint32_t  _width,
uint32_t  _height,
uint32_t  _depth,
size_t  pixel_size,
bool  generate_mip_maps 
)

Constructor.

Parameters
initial_layoutThe initial vk::ImageLayout of the Image.
usage_flagsvk::ImageUsageFlags specifying how the image will be used.
vma_memory_usageVmaMemoryUsage flags to pass to the Vulkan memory allocator library when allocating the image.
_widthThe width of the image.
_heightThe height of the image.
_depthThe depth of the image.
pixel_sizeThe data size of a single pixel in the image.

Member Function Documentation

◆ createImageView()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
void VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::createImageView ( vk::ImageViewType  image_view_type,
vk::ImageAspectFlags  image_aspect_flags 
)

Create vk::ImageView.

Parameters
image_view_typeThe type of image view.
image_aspect_flagsImage aspect flags.

◆ getStagingBufferSize()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
size_t VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::getStagingBufferSize
protectedvirtual
Returns
The data size for the staging buffer.

Implements VulkanEngine::StagedBufferDestination.

◆ getVkImage()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
vk::Image VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::getVkImage
virtual

Get the interal vulkan image.

Implements VulkanEngine::ImageBase.

◆ getVkImageView()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
vk::ImageView VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::getVkImageView
virtual

Get the vk::ImageView.

Implements VulkanEngine::ImageBase.

◆ insertTransferCommand()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
void VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::insertTransferCommand ( const vk::CommandBuffer &  command_buffer,
const vk::Buffer &  source_buffer 
)
protectedvirtual

Overridden to handle tranferring data from a StagedBuffer to this Image.

Parameters
command_buffersThe command buffer to insert the command into.
source_bufferThe source vk::Buffer in the StagedBuffer.

Implements VulkanEngine::StagedBufferDestination.

◆ setImageData()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
void VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::setImageData ( const void *  data)

Sets the image data from the given pointer.

Parameters
dataPointer to the image data.

◆ transitionImageLayout()

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
void VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::transitionImageLayout ( vk::ImageLayout  new_layout,
const vk::CommandBuffer &  command_buffer = nullptr 
)

Transition the image from one vk::ImageLayout to another given by new layout by adding a vk::ImageMemoryBarrier to the command_buffer.

Parameters
new_layoutThe new layout to transition to.
command_bufferThe command buffer to add the command to. One will be created and added to the graphics queue if not specified.

Member Data Documentation

◆ vk_image_layout

template<vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling, vk::SampleCountFlagBits sample_count_flags>
vk::ImageLayout VulkanEngine::Image< format, image_type, tiling, sample_count_flags >::vk_image_layout
protected

The current vk::ImageLayout.

See also
transitionImageLayout().

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