|
Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Wraps allocation and lifetime functionality of VkImage. More...
#include <foray_managedimage.hpp>
Classes | |
| struct | CreateInfo |
| Combines all structs used for initialization. More... | |
| struct | QuickTransition |
| Helper struct translated to a VkImageMemoryBarrier2 struct for one-time layout transitions. More... | |
Public Member Functions | |
| ManagedImage () | |
| virtual | ~ManagedImage () |
| virtual void | Create (Context *context, const CreateInfo &createInfo) |
| Allocates image, creates image, creates imageview. | |
| virtual void | Resize (const VkExtent3D &newextent) |
| Uses stored create info to recreate vulkan image with a new size. | |
| virtual void | Resize (const VkExtent2D &newextent) |
| Uses stored create info to recreate vulkan image with a new size. | |
| virtual void | Create (Context *context, VkImageUsageFlags usage, VkFormat format, const VkExtent2D &extent, std::string_view name="Unnamed Image") |
| Shorthand using common values. See CreateInfo for information. | |
| virtual void | TransitionLayout (ManagedImage::QuickTransition &quickTransition, VkCommandBuffer commandBuffer=VK_NULL_HANDLE) |
| Simple layout transition. | |
| void | WriteDeviceLocalData (const void *data, size_t size, VkImageLayout layoutAfterWrite, VkBufferImageCopy &imageCopy) |
| Creates a staging buffer, writes staging buffer, transitions image layout to transfer destination optimal, copies staging buffer to device local memory, transforms layout back to layoutAfterWrite parameter. | |
| void | WriteDeviceLocalData (HostSyncCommandBuffer &cmdBuffer, const void *data, size_t size, VkImageLayout layoutAfterWrite, VkBufferImageCopy &imageCopy) |
| void | WriteDeviceLocalData (const void *data, size_t size, VkImageLayout layoutAfterWrite) |
| See other overload for description. Omits image copy region and assumes a set of default values to write a simple image (no mimap, no layers) completely. | |
| void | WriteDeviceLocalData (HostSyncCommandBuffer &cmdBuffer, const void *data, size_t size, VkImageLayout layoutAfterWrite) |
| virtual void | Destroy () override |
| Destroy the resource. | |
| virtual bool | Exists () const override |
| Return true, if the managed resource is allocated. | |
| VkExtent2D | GetExtent2D () const |
| virtual void | SetName (std::string_view name) override |
| Set a custom name for the object. | |
| VkSampleCountFlagBits | GetSampleCount () const |
Public Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_IMAGE > | |
| VulkanResource () | |
| VulkanResource (std::string_view name) | |
| virtual std::string_view | GetTypeName () const |
| Returns <OBJECT_TYPE> stringified. | |
Public Member Functions inherited from foray::core::ManagedResource | |
| ManagedResource () | |
| Default constructor registers the resource. | |
| ManagedResource (std::string_view name) | |
| Registers the resource and sets its name. | |
| virtual | ~ManagedResource () |
| Unregisters the resource. | |
| std::string_view | GetName () const |
| Return a custom name for the object. | |
| std::string | Print () const |
| Print name and type in one string. | |
Public Member Functions inherited from foray::NoMoveDefaults | |
| NoMoveDefaults ()=default | |
| NoMoveDefaults (const NoMoveDefaults &other)=delete | |
| NoMoveDefaults (NoMoveDefaults &&other)=default | |
| NoMoveDefaults & | operator= (const NoMoveDefaults &other)=delete |
Protected Member Functions | |
| void | CheckImageFormatSupport (const CreateInfo &createInfo) |
| void | UpdateDebugNames () |
Protected Member Functions inherited from foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_IMAGE > | |
| virtual void | SetObjectName (core::Context *context, const void *handle, std::string_view name, bool updateResourceName=true) |
| Set the object name. Sets both ManagedResource::mName aswell as vulkan debug object name. | |
Protected Attributes | |
| Context * | mContext {} |
| CreateInfo | mCreateInfo |
| VkImage | mImage {} |
| VkImageView | mImageView {} |
| VkFormat | mFormat {} |
| VmaAllocation | mAllocation {} |
| VmaAllocationInfo | mAllocInfo {} |
| VkDeviceSize | mSize {} |
| VkExtent3D | mExtent3D {} |
Protected Attributes inherited from foray::core::ManagedResource | |
| std::string | mName |
| This objects custom name. | |
Additional Inherited Members | |
Static Public Member Functions inherited from foray::core::ManagedResource | |
| static void | sPrintAllocatedResources (bool printAsWarning) |
| Print a list of all registered existing resources. | |
| static const std::unordered_set< ManagedResource * > * | GetTotalAllocatedResources () |
Wraps allocation and lifetime functionality of VkImage.
|
inline |
|
inlinevirtual |
|
protected |
|
virtual |
Allocates image, creates image, creates imageview.
| context | Requires Allocator, DispatchTable, Device |
|
virtual |
Shorthand using common values. See CreateInfo for information.
| context | Requires Allocator, DispatchTable, Device |
|
overridevirtual |
Destroy the resource.
Implements foray::core::ManagedResource.
|
inlineoverridevirtual |
Return true, if the managed resource is allocated.
Example: Vulkan object stored could be nullptr or instantiated
Implements foray::core::ManagedResource.
|
inline |
|
inline |
|
virtual |
Uses stored create info to recreate vulkan image with a new size.
|
virtual |
Uses stored create info to recreate vulkan image with a new size.
|
overridevirtual |
Set a custom name for the object.
Reimplemented from foray::core::ManagedResource.
|
virtual |
Simple layout transition.
| commandBuffer | If set, writes the transition to the commandbuffer. If not set, uses host synchronized temporary command buffer instead (slow) |
|
protected |
| void foray::core::ManagedImage::WriteDeviceLocalData | ( | const void * | data, |
| size_t | size, | ||
| VkImageLayout | layoutAfterWrite | ||
| ) |
See other overload for description. Omits image copy region and assumes a set of default values to write a simple image (no mimap, no layers) completely.
| void foray::core::ManagedImage::WriteDeviceLocalData | ( | const void * | data, |
| size_t | size, | ||
| VkImageLayout | layoutAfterWrite, | ||
| VkBufferImageCopy & | imageCopy | ||
| ) |
Creates a staging buffer, writes staging buffer, transitions image layout to transfer destination optimal, copies staging buffer to device local memory, transforms layout back to layoutAfterWrite parameter.
| data | The data to write |
| size | Size of the image |
| layoutAfterWrite | The layout that the image is transitioned to after it has been written. |
| imageCopy | Specify how exactly the image is copied. |
| void foray::core::ManagedImage::WriteDeviceLocalData | ( | HostSyncCommandBuffer & | cmdBuffer, |
| const void * | data, | ||
| size_t | size, | ||
| VkImageLayout | layoutAfterWrite | ||
| ) |
| void foray::core::ManagedImage::WriteDeviceLocalData | ( | HostSyncCommandBuffer & | cmdBuffer, |
| const void * | data, | ||
| size_t | size, | ||
| VkImageLayout | layoutAfterWrite, | ||
| VkBufferImageCopy & | imageCopy | ||
| ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |