|
Kompute
|
#include <Image.hpp>


Public Member Functions | |
| Image (std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, void *data, size_t dataSize, uint32_t x, uint32_t y, uint32_t numChannels, const DataTypes &dataType, vk::ImageTiling tiling, const MemoryTypes &memoryType=MemoryTypes::eDevice) | |
| Image (std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, uint32_t x, uint32_t y, uint32_t numChannels, const DataTypes &dataType, vk::ImageTiling tiling, const MemoryTypes &memoryType=MemoryTypes::eDevice) | |
| Image (std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, void *data, size_t dataSize, uint32_t x, uint32_t y, uint32_t numChannels, const DataTypes &dataType, const MemoryTypes &memoryType=MemoryTypes::eDevice) | |
| Image (std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, uint32_t x, uint32_t y, uint32_t numChannels, const DataTypes &dataType, const MemoryTypes &memoryType=MemoryTypes::eDevice) | |
| Image (const Image &)=delete | |
| Make Image uncopyable. | |
| Image (const Image &&)=delete | |
| Image & | operator= (const Image &)=delete |
| Image & | operator= (const Image &&)=delete |
| virtual | ~Image () |
| void | destroy () override |
| bool | isInit () override |
| void | recordCopyFrom (const vk::CommandBuffer &commandBuffer, std::shared_ptr< Image > copyFromImage) override |
| void | recordCopyFrom (const vk::CommandBuffer &commandBuffer, std::shared_ptr< Tensor > copyFromTensor) override |
| void | recordCopyFromStagingToDevice (const vk::CommandBuffer &commandBuffer) override |
| void | recordCopyFromDeviceToStaging (const vk::CommandBuffer &commandBuffer) override |
| void | recordPrimaryMemoryBarrier (const vk::CommandBuffer &commandBuffer, vk::AccessFlagBits srcAccessMask, vk::AccessFlagBits dstAccessMask, vk::PipelineStageFlagBits srcStageMask, vk::PipelineStageFlagBits dstStageMask) override |
| void | recordStagingMemoryBarrier (const vk::CommandBuffer &commandBuffer, vk::AccessFlagBits srcAccessMask, vk::AccessFlagBits dstAccessMask, vk::PipelineStageFlagBits srcStageMask, vk::PipelineStageFlagBits dstStageMask) override |
| void | recordPrimaryImageBarrier (const vk::CommandBuffer &commandBuffer, vk::AccessFlagBits srcAccessMask, vk::AccessFlagBits dstAccessMask, vk::PipelineStageFlagBits srcStageMask, vk::PipelineStageFlagBits dstStageMask, vk::ImageLayout dstLayout) |
| vk::WriteDescriptorSet | constructDescriptorSet (vk::DescriptorSet descriptorSet, uint32_t binding) override |
| std::shared_ptr< vk::Image > | getPrimaryImage () |
| vk::ImageLayout | getPrimaryImageLayout () |
| uint32_t | getNumChannels () |
| Type | type () override |
Public Member Functions inherited from kp::Memory | |
| Memory (std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, const DataTypes &dataType, const MemoryTypes &memoryType, uint32_t x, uint32_t y) | |
| Memory (const Memory &)=delete | |
| Make Memory uncopyable. | |
| Memory (const Memory &&)=delete | |
| Memory & | operator= (const Memory &)=delete |
| Memory & | operator= (const Memory &&)=delete |
| virtual | ~Memory () |
| MemoryTypes | memoryType () |
| DataTypes | dataType () |
| void | recordCopyFrom (const vk::CommandBuffer &commandBuffer, std::shared_ptr< Memory > copyFromMemory) |
| uint32_t | size () |
| uint32_t | dataTypeMemorySize () |
| uint32_t | memorySize () |
| vk::DescriptorType | getDescriptorType () |
| void * | rawData () |
| void | setData (const void *data, size_t size) |
| template<typename T > | |
| void | setData (const std::vector< T > &data) |
| template<typename T > | |
| T * | data () |
| template<typename T > | |
| std::vector< T > | vector () |
| uint32_t | getX () |
| uint32_t | getY () |
Protected Attributes | |
| uint32_t | mNumChannels |
| vk::DescriptorImageInfo | mDescriptorImageInfo |
| vk::ImageLayout | mPrimaryImageLayout = vk::ImageLayout::eUndefined |
| vk::ImageLayout | mStagingImageLayout = vk::ImageLayout::eUndefined |
| std::shared_ptr< vk::ImageView > | mImageView = nullptr |
| vk::ImageTiling | mTiling = vk::ImageTiling::eOptimal |
Protected Attributes inherited from kp::Memory | |
| MemoryTypes | mMemoryType |
| DataTypes | mDataType |
| uint32_t | mSize |
| uint32_t | mDataTypeMemorySize |
| void * | mRawData = nullptr |
| vk::DescriptorType | mDescriptorType |
| bool | mUnmapMemory = false |
| uint32_t | mX |
| uint32_t | mY |
| std::shared_ptr< vk::PhysicalDevice > | mPhysicalDevice |
| std::shared_ptr< vk::Device > | mDevice |
| std::shared_ptr< vk::DeviceMemory > | mPrimaryMemory |
| bool | mFreePrimaryMemory = false |
| std::shared_ptr< vk::DeviceMemory > | mStagingMemory |
| bool | mFreeStagingMemory = false |
Additional Inherited Members | |
Public Types inherited from kp::Memory | |
| enum class | MemoryTypes { eDevice = 0 , eHost = 1 , eStorage = 2 , eDeviceAndHost } |
| enum class | DataTypes { eBool = 0 , eInt = 1 , eUnsignedInt = 2 , eFloat = 3 , eDouble = 4 , eCustom = 5 , eShort = 6 , eUnsignedShort = 7 , eChar = 8 , eUnsignedChar = 9 } |
| enum class | Type { eTensor = 0 , eImage = 1 } |
Static Public Member Functions inherited from kp::Memory | |
| static std::string | toString (MemoryTypes dt) |
| static std::string | toString (DataTypes dt) |
| template<typename T > | |
| static constexpr DataTypes | dataType () |
| static uint32_t | dataTypeMemorySize (DataTypes dataType) |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
| template<> | |
| constexpr Memory::DataTypes | dataType () |
Protected Member Functions inherited from kp::Memory | |
| void | mapRawData () |
| void | unmapRawData () |
| void | updateRawData (void *data) |
| vk::MemoryPropertyFlags | getPrimaryMemoryPropertyFlags () |
| vk::MemoryPropertyFlags | getStagingMemoryPropertyFlags () |
Image data used in GPU operations.
Each image would has a respective Vulkan memory and image, which would be used to store their respective data. The images can be used for GPU data storage or transfer.
|
inline |
Constructor with data provided which would be used to create the respective vulkan image and memory.
| physicalDevice | The physical device to use to fetch properties |
| device | The device to use to create the image and memory from |
| data | Pointer to data that will be used to initialise the image |
| dataSize | Size in bytes of the data pointed to by data |
| x | Width of the image in pixels |
| y | Height of the image in pixels |
| numChannels | The number of channels in the image |
| dataType | Data type for the image which is of type DataTypes |
| memoryType | Type for the image which is of type MemoryTypes |
| tiling | Tiling mode to use for the image. |
|
inline |
Constructor with no data provided.
| physicalDevice | The physical device to use to fetch properties |
| device | The device to use to create the image and memory from |
| x | Width of the image in pixels |
| y | Height of the image in pixels |
| dataType | Data type for the image which is of type ImageDataTypes |
| memoryType | Type for the image which is of type MemoryTypes |
| tiling | Tiling mode to use for the image. |
|
inline |
Constructor with data provided which would be used to create the respective vulkan image and memory. No tiling has been provided so will be inferred from memoryType.
| physicalDevice | The physical device to use to fetch properties |
| device | The device to use to create the image and memory from |
| data | Pointer to data that will be used to initialise the image |
| dataSize | Size in bytes of the data pointed to by data |
| x | Width of the image in pixels |
| y | Height of the image in pixels |
| numChannels | The number of channels in the image |
| dataType | Data type for the image which is of type DataTypes |
| memoryType | Type for the image which is of type MemoryTypes |
|
inline |
Constructor with no data provided. No tiling has been provided so will be inferred from memoryType.
| physicalDevice | The physical device to use to fetch properties |
| device | The device to use to create the image and memory from |
| x | Width of the image in pixels |
| y | Height of the image in pixels |
| dataType | Data type for the image which is of type ImageDataTypes |
| memoryType | Type for the image which is of type MemoryTypes |
|
virtual |
Destructor which is in charge of freeing vulkan resources unless they have been provided externally.
|
overridevirtual |
Adds this object to a Vulkan descriptor set at binding.
| descriptorSet | The descriptor set to add to. |
| binding | The binding number to use. |
binding. Implements kp::Memory.
|
overridevirtual |
Destroys and frees the GPU resources which include the image and memory.
Reimplemented from kp::Memory.
|
overridevirtual |
Check whether image is initialized based on the created gpu resources.
Implements kp::Memory.
|
overridevirtual |
Records a copy from the memory of the image provided to the current image. This is intended to pass memory into a processing, to perform a staging image transfer, or to gather output (between others).
| commandBuffer | Vulkan Command Buffer to record the commands into |
| copyFromImage | Image to copy the data from |
Implements kp::Memory.
|
overridevirtual |
Records a copy from the memory of the tensor provided to the current image. This is intended to pass memory into a processing, to perform a staging image transfer, or to gather output (between others).
| commandBuffer | Vulkan Command Buffer to record the commands into |
| copyFromTensor | Tensor to copy the data from |
Implements kp::Memory.
|
overridevirtual |
Records a copy from the internal device memory to the staging memory using an optional barrier to wait for the operation. This function would only be relevant for kp::images of type eDevice.
| commandBuffer | Vulkan Command Buffer to record the commands into |
Implements kp::Memory.
|
overridevirtual |
Records a copy from the internal staging memory to the device memory using an optional barrier to wait for the operation. This function would only be relevant for kp::images of type eDevice.
| commandBuffer | Vulkan Command Buffer to record the commands into |
Implements kp::Memory.
| void kp::Image::recordPrimaryImageBarrier | ( | const vk::CommandBuffer & | commandBuffer, |
| vk::AccessFlagBits | srcAccessMask, | ||
| vk::AccessFlagBits | dstAccessMask, | ||
| vk::PipelineStageFlagBits | srcStageMask, | ||
| vk::PipelineStageFlagBits | dstStageMask, | ||
| vk::ImageLayout | dstLayout | ||
| ) |
Records the image memory barrier into the primary image and command buffer which ensures that relevant data transfers are carried out correctly.
| commandBuffer | Vulkan Command Buffer to record the commands into |
| srcAccessMask | Access flags for source access mask |
| dstAccessMask | Access flags for destination access mask |
| scrStageMask | Pipeline stage flags for source stage mask |
| dstStageMask | Pipeline stage flags for destination stage mask |
| dstLayout | Image layout for the image after the barrier completes |
|
overridevirtual |
Records the image memory barrier into the primary image and command buffer which ensures that relevant data transfers are carried out correctly.
| commandBuffer | Vulkan Command Buffer to record the commands into |
| srcAccessMask | Access flags for source access mask |
| dstAccessMask | Access flags for destination access mask |
| scrStageMask | Pipeline stage flags for source stage mask |
| dstStageMask | Pipeline stage flags for destination stage mask |
Implements kp::Memory.
|
overridevirtual |
Records the image memory barrier into the staging image and command buffer which ensures that relevant data transfers are carried out correctly.
| commandBuffer | Vulkan Command Buffer to record the commands into |
| srcAccessMask | Access flags for source access mask |
| dstAccessMask | Access flags for destination access mask |
| scrStageMask | Pipeline stage flags for source stage mask |
| dstStageMask | Pipeline stage flags for destination stage mask |
Implements kp::Memory.
|
inlineoverridevirtual |
Return the object type of this Memory object.
Implements kp::Memory.