Nameless Engine
|
#include <VulkanResource.h>
Public Member Functions | |
VulkanResource (const VulkanResource &)=delete | |
VulkanResource & | operator= (const VulkanResource &)=delete |
VkBuffer | getInternalBufferResource () const |
VkImageView | getInternalImageView () const |
VkImageView | getInternalCubemapImageView (size_t iCubemapFaceIndex=0) |
VkImageView | getInternalImageViewDepthAspect () const |
VkImage | getInternalImage () const |
bool | isStorageResource () const |
std::pair< std::recursive_mutex, VmaAllocation > * | getInternalResourceMemory () |
Public Member Functions inherited from ne::GpuResource | |
GpuResource (GpuResourceManager *pManager, const std::string &sResourceName, unsigned int iElementSizeInBytes, unsigned int iElementCount) | |
GpuResource (GpuResource &)=delete | |
GpuResource & | operator= (GpuResource &)=delete |
std::string | getResourceName () const |
unsigned int | getElementSizeInBytes () const |
unsigned int | getElementCount () const |
GpuResourceManager * | getResourceManager () const |
Private Member Functions | |
VulkanResource (VulkanResourceManager *pResourceManager, const std::string &sResourceName, std::variant< VkBuffer, VkImage > pInternalResource, bool isStorageResource, VmaAllocation pResourceMemory, unsigned int iElementSizeInBytes, unsigned int iElementCount) | |
VulkanResource (VulkanResourceManager *pResourceManager, const std::string &sResourceName, ktxVulkanTexture ktxTexture) | |
Static Private Member Functions | |
static std::variant< std::unique_ptr< VulkanResource >, Error > | create (VulkanResourceManager *pResourceManager, const std::string &sResourceName, VmaAllocator pMemoryAllocator, const VkBufferCreateInfo &bufferInfo, const VmaAllocationCreateInfo &allocationInfo, unsigned int iElementSizeInBytes, unsigned int iElementCount) |
static std::variant< std::unique_ptr< VulkanResource >, Error > | create (VulkanResourceManager *pResourceManager, const std::string &sResourceName, VmaAllocator pMemoryAllocator, const VkImageCreateInfo &imageInfo, const VmaAllocationCreateInfo &allocationInfo, std::optional< VkImageAspectFlags > viewDescription, bool bIsCubeMapView=false) |
static std::variant< std::unique_ptr< VulkanResource >, Error > | create (VulkanResourceManager *pResourceManager, const std::string &sResourceName, ktxVulkanTexture ktxTexture) |
Private Attributes | |
std::optional< ktxVulkanTexture > | optionalKtxTexture |
VkBuffer | pBufferResource = nullptr |
VkImage | pImageResource = nullptr |
VkImageView | pImageView = nullptr |
VkImageView | pDepthAspectImageView = nullptr |
std::vector< VkImageView > | vCubeMapViews |
std::pair< std::recursive_mutex, VmaAllocation > | mtxResourceMemory |
const bool | isUsedAsStorageResource = false |
Friends | |
class | VulkanResourceManager |
Vulkan buffer/memory wrapper.
|
private |
Constructor. Creates an empty resource.
pResourceManager | Owner resource manager. |
sResourceName | Name of the resource. |
pInternalResource | Created Vulkan resource. |
isStorageResource | Defines if this resource is a storage buffer/image or not. |
pResourceMemory | Allocated memory for the created Vulkan resource. |
iElementSizeInBytes | Resource size information. Size of one array element (if array), otherwise specify size of the whole resource. |
iElementCount | Resource size information. Total number of elements in the array (if array), otherwise specify 1. |
|
private |
Constructor. Initializes resources as a wrapper for KTX image.
pResourceManager | Owner resource manager. |
sResourceName | Name of the resource. |
ktxTexture | Created KTX texture (already loaded in the GPU memory) that this resource will wrap. |
|
staticprivate |
Creates a new image resource.
pResourceManager | Owner resource manager. |
sResourceName | Resource name, used for logging. |
ktxTexture | Created KTX texture (already loaded in the GPU memory) that this resource will wrap. |
|
staticprivate |
Creates a new buffer resource.
pResourceManager | Owner resource manager. |
sResourceName | Resource name, used for logging. |
pMemoryAllocator | Allocator to create resource. |
bufferInfo | Buffer creation info. |
allocationInfo | Allocation creation info. |
iElementSizeInBytes | Resource size information. Size of one array element (if array), otherwise specify size of the whole resource. |
iElementCount | Resource size information. Total number of elements in the array (if array), otherwise specify 1. |
|
staticprivate |
Creates a new image resource.
pResourceManager | Owner resource manager. |
sResourceName | Resource name, used for logging. |
pMemoryAllocator | Allocator to create resource. |
imageInfo | Image creation info. |
allocationInfo | Allocation creation info. |
viewDescription | If specified also creates an image view that references the image. |
bIsCubeMapView | true to create a view to a cubemap, false to create a 2D texture view. Ignored if view description is not specified. |
|
inline |
Returns internal buffer resource.
nullptr
if this resource uses image as internal resource not a buffer, otherwise internal buffer resource.
|
inline |
Returns internal image view for cubemap textures.
iCubemapFaceIndex | Index of the cubemap face to get the view to. |
nullptr
if this resource uses buffer as internal resource not an image or not a cubemap, otherwise internal image view.
|
inline |
Returns internal image.
nullptr
if this resource uses buffer as internal resource not an image, otherwise internal image.
|
inline |
Returns internal image view.
nullptr
if this resource uses buffer as internal resource not an image, otherwise internal image view.
|
inline |
Returns internal image view that only references depth aspect of the image.
nullptr
.
|
inline |
Returns memory allocation of the internal resource.
bool ne::VulkanResource::isStorageResource | ( | ) | const |
Tells if this resource is a storage buffer/image or not.
|
private |
Defines if this resource is a storage buffer/image or not.
|
private |
Allocated memory for created resource.
|
private |
Not empty if the object was created as a wrapper around KTX texture.
|
private |
Created buffer Vulkan resource.
nullptr
if pImageResource is used.
|
private |
Optional view that references pImageResource depth aspect.
|
private |
Created image Vulkan resource.
nullptr
if pBufferResource is used.
|
private |
Optional view that references pImageResource.
|
private |
Views to each face of the cubemap texture (only valid if the resource is a cubemap texture).