SpiecsEngine
 
Loading...
Searching...
No Matches
Spices::VulkanImage Class Reference

#include <VulkanImage.h>

Inheritance diagram for Spices::VulkanImage:
Spices::VulkanObject

Public Member Functions

 VulkanImage (VulkanState &vulkanState)
 Constructor Function. Init class variable. Init a empty VulkanImage, used in TextureLoad.
 
 VulkanImage (VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
 
virtual ~VulkanImage () override
 Destructor Function.
 
VkImageView & GetView (uint32_t mipLevel=0)
 
VkImage & GetImage ()
 
uint32_t GetLayers () const
 Get this Layers.
 
uint32_t GetHeight () const
 Get this Height.
 
uint32_t GetWidth () const
 Get this Width.
 
VkFormat GetFormat () const
 Get this Format.
 
uint32_t GetMipLevels () const
 Get this MipLevels.
 
VkDescriptorImageInfo * GetImageInfo (VkImageLayout imageLayout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, uint32_t mipLevel=0)
 
void TransitionImageLayout (VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout)
 
void Barrier (VkCommandBuffer commandBuffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex, uint32_t dstQueueFamilyIndex) const
 Wrapper of Call vkCmdImageBarrier.
 
void CopyBufferToImage (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) const
 Copy the Buffer's data to this VkImage.
 
void CopyBufferToImage (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, const std::vector< VkBufferImageCopy > &regions) const
 Copy the Buffer's data to this VkImage. Used to create image data (include mipmaps), which owns a compressed format.
 
void CopyMemoryToImageHost (const std::vector< VkMemoryToImageCopyEXT > &copies) const
 Copy the Memory's data to this VkImage. Used to create image data (include mipmaps), which owns a compressed format.
 
void CopyMemoryToImageHost (const void *data) const
 Copy the Memory's data to this VkImage.
 
void CopyImageTexelToBuffer (uint32_t x, uint32_t y, void *out_rgba)
 
void CopyImageToBuffer (VkBuffer dstBuffer, const std::vector< VkBufferImageCopy > &regions)
 
void CopyImageToMemoryHost (void *data) const
 
void CopyImageToMemoryHost (const std::vector< VkImageToMemoryCopyEXT > &copies) const
 
void GenerateMipmaps (VkFormat imageFormat, int32_t texWidth, int32_t texHeight) const
 Generate mipmaps with the VkImage.
 
void CreateImageView (VkFormat format, VkImageViewType viewType, VkImageAspectFlags aspectFlags, bool isCreateMipmapView=false)
 Create Image View.
 
void CreateSampler ()
 Create a Sampler.
 
void CreateImage (VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
 
void CreateDescriptorSet (uint32_t binding)
 Create DescriptorSet with single image.
 
VkDescriptorSet & GetDescriptorSet ()
 Get VkDescriptorSet.
 
bool IsHostCopyable () const
 Check if this image format can copy from host to gpu directly.
 

Static Public Member Functions

static bool IsHostCopyable (VulkanState &state, VkFormat format)
 Check if this image format can copy from host to gpu directly.
 

Protected Attributes

VulkanStatem_VulkanState
 The global VulkanState Referenced from VulkanRenderBackend.
 

Private Member Functions

void DestroyDescriptorSetLayout () const
 Destroy the DescriptorSetLayout if Created a DescriptorSet.
 

Private Attributes

int m_Width = 0
 Image width.
 
int m_Height = 0
 Image height.
 
uint32_t m_Layers = 1
 Image layer(texture cube: 6).
 
uint32_t m_MipLevels = 1
 Image mipmaps num.
 
VkImageType m_ImageType {}
 Image Type.
 
VkFormat m_Format {}
 The image format.
 
VkImage m_Image {}
 The VkImage this Class Wrapped.
 
VmaAllocation m_Alloc {}
 VMA allocation.
 
VkDeviceMemory m_ImageMemory {}
 The image video memory.
 
std::vector< VkImageView > m_ImageViews
 The image view.
 
VkSampler m_TextureSampler
 The image sampler.
 
VkDescriptorImageInfo m_ImageInfo {}
 VkDescriptorImageInfo.
 
bool m_IsCreateSet = false
 True if Called Create DescriptorSet.
 
VkDescriptorSetLayout m_DescriptorSetLayout {}
 VkDescriptorSetLayout.
 
VkDescriptorSet m_DescriptorSet {}
 VkDescriptorSet.
 

Friends

class TextureLoader
 Allow access all data.
 
class Transcoder
 

Detailed Description

@breif VulkanImage is a wrapper of VkImage. It's a basic object of Vulkan.

Todo
Wrapper by Texture.

Definition at line 19 of file VulkanImage.h.


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