CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::VKImage Class Referencefinal

#include <CeresEngine/RenderAPI/Vulkan/VKImage.hpp>

Inheritance diagram for CeresEngine::VKImage:
CeresEngine::GPUImage CeresEngine::VKDeviceObject< VKImage, GPUImage > CeresEngine::TDeviceObject< GPUImageDescriptor, GPUResource > CeresEngine::VKObject< ChildTypeName, ParentType > CeresEngine::VKDeviceObjectBase CeresEngine::GPUResource CeresEngine::VKObjectBase CeresEngine::GPUDeviceObject CeresEngine::GPUObject

Public Types

using Allocator = VKObjectAllocator
 An allocator type used to allocate new VKImage instances from a memory pool.
 
- Public Types inherited from CeresEngine::TDeviceObject< GPUImageDescriptor, GPUResource >
using Descriptor = GPUImageDescriptor
 An type-alias to the descriptor struct type.
 

Public Member Functions

 VKImage (VKDevice &device, const GPUImageDescriptor &descriptor)
 
 VKImage (VKDevice &device, const GPUImageDescriptor &descriptor, VkImage existingImage, VKSwapchain *swapchain)
 
 ~VKImage () final
 
 operator VkImage () const noexcept
 The Vulkan image object.
 
GPUImageViewPtr createView (const GPUImageViewDescriptor &descriptor) final
 
void transitionImageLayout (VkCommandBuffer commandBuffer, VkImageLayout newLayout, const GPUImageSubresource &subresource)
 
void transitionImageLayout (const VkCommandBuffer commandBuffer, const VkImageLayout newLayout, const GPUImageLocation &location)
 
void transitionImageLayout (const VkCommandBuffer commandBuffer, const VkImageLayout newLayout)
 
VkImageLayout getLayout (UInt32 mipLevel, UInt32 layer=0) const
 
void setLayout (VkImageLayout newLayout, UInt32 mipLevel, UInt32 layer=0)
 
void setLayout (VkImageLayout newLayout, const GPUImageSubresource &subresource)
 
void generateMips (VkCommandBuffer commandBuffer)
 Generates the whole mipmap chain.
 
UInt32 getMipLevels () const
 
VKSwapchaingetSwapchain () const noexcept
 If the image belongs to a swapchain, points to the owning swapchain.
 
- Public Member Functions inherited from CeresEngine::GPUImage
 GPUImage (const GPUImage &)=delete
 Deleted copy constructor.
 
GPUImageoperator= (const GPUImage &)=delete
 
 GPUImage (GPUImage &&)=delete
 Deleted move constructor.
 
GPUImageoperator= (GPUImage &&)=delete
 
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Inherited constructors.
 
 TDeviceObject (const TDeviceObject &)=delete
 Inherited constructors.
 
 TDeviceObject (TDeviceObject &&)=delete
 Inherited constructors.
 
- Public Member Functions inherited from CeresEngine::TDeviceObject< GPUImageDescriptor, GPUResource >
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Initializes a new RenderAPI device object instance.
 
 TDeviceObject (const TDeviceObject &)=delete
 
 TDeviceObject (TDeviceObject &&)=delete
 
 ~TDeviceObject () override=default
 
TDeviceObjectoperator= (const TDeviceObject &)=delete
 
TDeviceObjectoperator= (TDeviceObject &&)=delete
 
- Public Member Functions inherited from CeresEngine::GPUResource
 GPUDeviceObject (GPUDevice &device)
 
- Public Member Functions inherited from CeresEngine::GPUDeviceObject
 GPUDeviceObject (GPUDevice &device)
 
 ~GPUDeviceObject () override
 
- Public Member Functions inherited from CeresEngine::GPUObject
 GPUObject ()=default
 
virtual ~GPUObject ()=default
 
 GPUObject (const GPUObject &)=delete
 
GPUObjectoperator= (const GPUObject &)=delete
 
 GPUObject (GPUObject &&)=delete
 
GPUObjectoperator= (GPUObject &&)=delete
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Releases the object by decrementing it's reference count by one.
 
- Public Member Functions inherited from CeresEngine::VKDeviceObjectBase
 VKDeviceObjectBase (VKDevice &device) noexcept
 Creates a new VKDeviceObjectBase from the given device.
 
 ~VKDeviceObjectBase () noexcept
 Destroys the VKDeviceObjectBase.
 

Static Public Member Functions

static AllocatorgetAllocator () noexcept
 Returns the allocator for VKImage.
 
static voidoperator new (size_t size) noexcept
 Allocates memory for a new instance of VKImage.
 
static void operator delete (void *p, std::size_t size) noexcept
 Deletes memory for an instance of VKImage.
 
- Static Public Member Functions inherited from CeresEngine::GPUImage
static UInt32 numMipLevels (UInt32 width, UInt32 height=1, UInt32 depth=1) noexcept
 Returns the number of MIP-map levels for a image with the specified size.
 
static UInt32 numMipLevels (const GPUImageDescriptor &imageDesc) noexcept
 Returns the number of MIP-map levels for the specified image descriptor.
 
static UInt32 bufferSize (Format format, UInt32 numTexels) noexcept
 Returns the required buffer size (in bytes) of a image with the specified hardware format and number of texels.
 
static UInt32 size (const GPUImageDescriptor &imageDesc) noexcept
 
static bool isMipMapped (const GPUImageDescriptor &imageDesc) noexcept
 Returns true if the specified image descriptor describes a image with MIP-mapping enabled.
 
static bool isArray (GPUImageType type) noexcept
 Returns true if the specified image type is an array image.
 
static bool isMultiSample (GPUImageType type) noexcept
 Returns true if the specified image type is a multi-sample image.
 
static bool isCube (GPUImageType type) noexcept
 Returns true if the specified image type is a cube image.
 
- Static Public Member Functions inherited from CeresEngine::VKObject< ChildTypeName, ParentType >
static RC< ChildTypeNamecast (const RC< ParentType > &ptr)
 Casts a RC containing a ParentType pointer to a pointer to a pointer to a ChildTypeName.
 
static ChildTypeNamecast (ParentType &object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static const ChildTypeNamecast (const ParentType &object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static ChildTypeNamecast (ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static const ChildTypeNamecast (const ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
- Static Public Member Functions inherited from CeresEngine::VKObjectBase
static voidoperator new (size_t size) noexcept
 
static void operator delete (void *p, std::size_t sz) noexcept
 

Private Types

using super = GPUImage
 

Private Member Functions

void transitionImageLayout (VkCommandBuffer commandBuffer, VkImageLayout oldLayout, VkImageLayout newLayout, UInt32 mipLevel, UInt32 layer)
 

Private Attributes

const GPUImageDescriptor mDescriptor
 A structure that describes the and it's properties.
 
VkImage mImage = VK_NULL_HANDLE
 The Vulkan image object.
 
VKMemoryAllocation mImageMemory
 The allocated memory.
 
VkDeviceSize mSize = 0
 The image size.
 
VkFormat mFormat
 The Vulkan image format.
 
bool mOwns = true
 A flag indicating if the VKImage objects owns the mImage instance.
 
VKImageViewCache mImageViews
 A cache of all active image views.
 
SmallVector< VkImageLayout, 10 > mLayouts
 
VKSwapchainmSwapchain = nullptr
 If the image belongs to a swapchain, points to the owning swapchain.
 

Friends

class VKImageView
 

Additional Inherited Members

- Public Attributes inherited from CeresEngine::TDeviceObject< GPUImageDescriptor, GPUResource >
const Descriptordescriptor
 A structure that describes the object and it's properties.
 
- Public Attributes inherited from CeresEngine::GPUDeviceObject
GPUDevicedevice
 The owning device this object was created from.
 
- Public Attributes inherited from CeresEngine::VKDeviceObjectBase
VKDevicedeviceVK
 The owning VKDevice instance.
 
- Protected Member Functions inherited from CeresEngine::GPUObject
virtual void destroy () noexcept
 A internal method called by the system when the object reference count reaches zero.
 
- Protected Member Functions inherited from CeresEngine::VKDeviceObject< VKImage, GPUImage >
 VKDeviceObject (VKDevice &device) noexcept
 Creates a new VKDeviceObject from the given device.
 

Member Typedef Documentation

◆ Allocator

An allocator type used to allocate new VKImage instances from a memory pool.

◆ super

Constructor & Destructor Documentation

◆ VKImage() [1/2]

CeresEngine::VKImage::VKImage ( VKDevice device,
const GPUImageDescriptor descriptor 
)

◆ VKImage() [2/2]

CeresEngine::VKImage::VKImage ( VKDevice device,
const GPUImageDescriptor descriptor,
VkImage  existingImage,
VKSwapchain swapchain 
)

◆ ~VKImage()

CeresEngine::VKImage::~VKImage ( )
final

Member Function Documentation

◆ createView()

GPUImageViewPtr CeresEngine::VKImage::createView ( const GPUImageViewDescriptor descriptor)
finalvirtual

Implements CeresEngine::GPUImage.

◆ generateMips()

void CeresEngine::VKImage::generateMips ( VkCommandBuffer  commandBuffer)

Generates the whole mipmap chain.

Parameters
commandBufferThe command buffer to execute the operation on

◆ getAllocator()

static Allocator & CeresEngine::VKImage::getAllocator ( )
staticnoexcept

Returns the allocator for VKImage.

◆ getLayout()

VkImageLayout CeresEngine::VKImage::getLayout ( UInt32  mipLevel,
UInt32  layer = 0 
) const

◆ getMipLevels()

UInt32 CeresEngine::VKImage::getMipLevels ( ) const

◆ getSwapchain()

VKSwapchain * CeresEngine::VKImage::getSwapchain ( ) const
inlinenoexcept

If the image belongs to a swapchain, points to the owning swapchain.

◆ operator delete()

static void CeresEngine::VKImage::operator delete ( void p,
std::size_t  size 
)
staticnoexcept

Deletes memory for an instance of VKImage.

◆ operator new()

static void * CeresEngine::VKImage::operator new ( size_t  size)
staticnoexcept

Allocates memory for a new instance of VKImage.

◆ operator VkImage()

CeresEngine::VKImage::operator VkImage ( ) const
inlinenoexcept

The Vulkan image object.

◆ setLayout() [1/2]

void CeresEngine::VKImage::setLayout ( VkImageLayout  newLayout,
const GPUImageSubresource subresource 
)

◆ setLayout() [2/2]

void CeresEngine::VKImage::setLayout ( VkImageLayout  newLayout,
UInt32  mipLevel,
UInt32  layer = 0 
)

◆ transitionImageLayout() [1/4]

void CeresEngine::VKImage::transitionImageLayout ( const VkCommandBuffer  commandBuffer,
const VkImageLayout  newLayout 
)
inline

◆ transitionImageLayout() [2/4]

void CeresEngine::VKImage::transitionImageLayout ( const VkCommandBuffer  commandBuffer,
const VkImageLayout  newLayout,
const GPUImageLocation location 
)
inline

◆ transitionImageLayout() [3/4]

void CeresEngine::VKImage::transitionImageLayout ( VkCommandBuffer  commandBuffer,
VkImageLayout  newLayout,
const GPUImageSubresource subresource 
)

◆ transitionImageLayout() [4/4]

void CeresEngine::VKImage::transitionImageLayout ( VkCommandBuffer  commandBuffer,
VkImageLayout  oldLayout,
VkImageLayout  newLayout,
UInt32  mipLevel,
UInt32  layer 
)
private

Friends And Related Symbol Documentation

◆ VKImageView

Member Data Documentation

◆ mDescriptor

const GPUImageDescriptor CeresEngine::VKImage::mDescriptor
private

A structure that describes the and it's properties.

◆ mFormat

VkFormat CeresEngine::VKImage::mFormat
private

The Vulkan image format.

◆ mImage

VkImage CeresEngine::VKImage::mImage = VK_NULL_HANDLE
private

The Vulkan image object.

◆ mImageMemory

VKMemoryAllocation CeresEngine::VKImage::mImageMemory
private

The allocated memory.

◆ mImageViews

VKImageViewCache CeresEngine::VKImage::mImageViews
private

A cache of all active image views.

◆ mLayouts

SmallVector<VkImageLayout, 10> CeresEngine::VKImage::mLayouts
private

◆ mOwns

bool CeresEngine::VKImage::mOwns = true
private

A flag indicating if the VKImage objects owns the mImage instance.

If not owned, the VkImage is not freed on the destructor. Generally, this should only be used for swapchain images.

◆ mSize

VkDeviceSize CeresEngine::VKImage::mSize = 0
private

The image size.

◆ mSwapchain

VKSwapchain* CeresEngine::VKImage::mSwapchain = nullptr
private

If the image belongs to a swapchain, points to the owning swapchain.


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