Lluvia
ll::ImageView Class Reference

Represents portions of a ll::Image to be sent as parameter to a GLSL shader. More...

#include <ImageView.h>

Inheritance diagram for ll::ImageView:
Collaboration diagram for ll::ImageView:

Public Member Functions

 ImageView ()=delete
 
 ImageView (const ImageView &)=delete
 
 ImageView (ImageView &&)=delete
 
 ~ImageView ()
 
ImageViewoperator= (const ImageView &)=delete
 
ImageViewoperator= (ImageView &&)=delete
 
ll::ObjectType getType () const noexcept override
 Gets the object type. More...
 
const std::shared_ptr< ll::Image > & getImage () const noexcept
 Gets the parent ll::Image this object was created from. More...
 
const std::shared_ptr< ll::Memory > & getMemory () const noexcept
 Gets the memory the underlying ll::Image was allocated from. More...
 
ll::MemoryAllocationInfo getAllocationInfo () const noexcept
 Gets the allocation information of the underlying ll::Image object. More...
 
uint64_t getSize () const noexcept
 Gets the memory allocation size in bytes. More...
 
uint64_t getMinimumSize () const noexcept
 Gets the minimum number of bytes to store the image contiguously in memory. More...
 
const ll::ImageDescriptorgetImageDescriptor () const noexcept
 Gets the image descriptor. More...
 
ll::ImageUsageFlags getUsageFlags () const noexcept
 Gets the Vulkan image usage flags. More...
 
uint32_t getUsageFlagsUnsafe () const noexcept
 Gets the usage flags casted to an integer type. More...
 
ll::ImageLayout getLayout () const noexcept
 Gets the Vulkan image layout. More...
 
ll::ImageTiling getTiling () const noexcept
 Gets the vulkan image tiling. More...
 
ll::ChannelType getChannelType () const noexcept
 Gets the channel type. More...
 
uint64_t getChannelTypeSize () const noexcept
 Gets the channel type size. More...
 
template<typename T = ll::ChannelCount>
getChannelCount () const noexcept
 Gets the channel count. More...
 
uint32_t getWidth () const noexcept
 Gets the image view width in pixels. More...
 
uint32_t getHeight () const noexcept
 Gets the image view height in pixels. More...
 
uint32_t getDepth () const noexcept
 Gets the image view depth in pixels. More...
 
ll::vec3ui getShape () const noexcept
 Gets the shape of the image view. More...
 
const ll::ImageViewDescriptorgetDescriptor () const noexcept
 Gets the image view descriptor. More...
 
void changeImageLayout (const ll::ImageLayout newLayout)
 Immediately changes the layout of the underlying ll::Image object. More...
 
void clear ()
 Immediately clears the image pixels to zero. More...
 
void copyTo (ll::ImageView &dst)
 Immediately copies the content of this image view into the destination. More...
 
- Public Member Functions inherited from ll::Object
 Object ()=default
 Default constructor. More...
 
 Object (const Object &)=delete
 Copy constructor. More...
 
 Object (Object &&)=delete
 Move constructor. More...
 
virtual ~Object ()=default
 
Objectoperator= (const Object &)=delete
 Copy assignment. More...
 
Objectoperator= (Object &&)=delete
 Move assignment. More...
 

Friends

class Image
 
class ComputeNode
 

Detailed Description

Represents portions of a ll::Image to be sent as parameter to a GLSL shader.

Image views are created from a ll::Image object provided a ll::ImageViewDescriptor.

auto session = ll::Session::create();
// device-local memory with page size of 2048 bytes
auto memory = session->createMemory(vk::MemoryPropertyFlagBits::eDeviceLocal, 2048);
// 8-bit unsigned, 4-channel, 640x480 image.
auto desc = ll::ImageDescriptor{}
.setWidth(640)
.setHeight(480)
auto image = memory->createImage(desc);
// image view descriptor for a sampled image
auto imgViewDesc = ll::ImageViewDescriptor {}
.setIsSampled(true)
auto imageView = image->createImageView(imgViewDesc);
Stores all relevant information for creating ll::Image objects.
Definition: ImageDescriptor.h:189
ImageDescriptor & setHeight(const uint32_t height) noexcept
Sets the height.
ImageDescriptor & setWidth(const uint32_t width) noexcept
Sets the width.
ImageDescriptor & setChannelType(const ll::ChannelType type) noexcept
Sets the channel type.
ImageDescriptor & setChannelCount(const ll::ChannelCount count) noexcept
Sets the channel count.
Descriptor for ll::ImageView objects.
Definition: ImageViewDescriptor.h:41
ImageViewDescriptor & setIsSampled(bool isSampled) noexcept
Sets whether or not the image view will be sampled.
ImageViewDescriptor & setAddressMode(ll::ImageAddressMode addressMode) noexcept
Sets the address mode to all image axes.
ImageViewDescriptor & setFilterMode(ll::ImageFilterMode filterMode) noexcept
Sets the filtering mode.
ImageViewDescriptor & setNormalizedCoordinates(bool normalizedCoordinates) noexcept
Sets whether or not the image view will use normalized coordinates.
static std::shared_ptr< ll::Session > create()
Creates a new ll::Session object.

ImageView objects are mapped to GLSL objects as follows:

Constructor & Destructor Documentation

◆ ImageView() [1/3]

ll::ImageView::ImageView ( )
delete

◆ ImageView() [2/3]

ll::ImageView::ImageView ( const ImageView )
delete

◆ ImageView() [3/3]

ll::ImageView::ImageView ( ImageView &&  )
delete

◆ ~ImageView()

ll::ImageView::~ImageView ( )

Member Function Documentation

◆ changeImageLayout()

void ll::ImageView::changeImageLayout ( const ll::ImageLayout  newLayout)

Immediately changes the layout of the underlying ll::Image object.

This method creates a command buffer and submits it to change the layout of the image. Execution is blocked until the layout change is completed.

Parameters
[in]newLayoutThe new layout

◆ clear()

void ll::ImageView::clear ( )

Immediately clears the image pixels to zero.

This method creates a command buffer and sumbits it to clear all the pixels in the underlying image to zero. Execution is blocked until the operation is completed.

◆ copyTo()

void ll::ImageView::copyTo ( ll::ImageView dst)

Immediately copies the content of this image view into the destination.

This method creates a command buffer and sumbits it to copy the content of this image view underlying Image object into dst Image object. No valiation of destination image shape is performed. Execution is blocked until the operation is completed.

Parameters
[in]dstThe destination image view..

◆ getAllocationInfo()

ll::MemoryAllocationInfo ll::ImageView::getAllocationInfo ( ) const
noexcept

Gets the allocation information of the underlying ll::Image object.

Returns
The allocation information.

◆ getChannelCount()

template<typename T = ll::ChannelCount>
T ll::ImageView::getChannelCount ( ) const
inlinenoexcept

Gets the channel count.

Template Parameters
TType of the return value. Defaults to ll::ChannelCount.
Returns
The channel count.

◆ getChannelType()

ll::ChannelType ll::ImageView::getChannelType ( ) const
noexcept

Gets the channel type.

Returns
The channel type.

◆ getChannelTypeSize()

uint64_t ll::ImageView::getChannelTypeSize ( ) const
noexcept

Gets the channel type size.

Returns
The channel type size.

◆ getDepth()

uint32_t ll::ImageView::getDepth ( ) const
noexcept

Gets the image view depth in pixels.

Returns
The image view depth in pixels.

◆ getDescriptor()

const ll::ImageViewDescriptor& ll::ImageView::getDescriptor ( ) const
noexcept

Gets the image view descriptor.

Returns
The descriptor.

◆ getHeight()

uint32_t ll::ImageView::getHeight ( ) const
noexcept

Gets the image view height in pixels.

Returns
The image view height in pixels.

◆ getImage()

const std::shared_ptr<ll::Image>& ll::ImageView::getImage ( ) const
noexcept

Gets the parent ll::Image this object was created from.

Returns
The parent ll::Image object.

◆ getImageDescriptor()

const ll::ImageDescriptor& ll::ImageView::getImageDescriptor ( ) const
noexcept

Gets the image descriptor.

Returns
The image descriptor.

◆ getLayout()

ll::ImageLayout ll::ImageView::getLayout ( ) const
noexcept

Gets the Vulkan image layout.

The layout is changed through invocations of Session::changeImageLayout or CommandBuffer::changeImageLayout.

See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#_vkimagelayout_3

Returns
The image layout.

◆ getMemory()

const std::shared_ptr<ll::Memory>& ll::ImageView::getMemory ( ) const
noexcept

Gets the memory the underlying ll::Image was allocated from.

Returns
The memory.

◆ getMinimumSize()

uint64_t ll::ImageView::getMinimumSize ( ) const
noexcept

Gets the minimum number of bytes to store the image contiguously in memory.

This methods is equivalent to:

uint64_t minimumSize = getWidth() *
                       getHeight() *
                       getDepth() *
                       getChannelTypeSize() *
                       static_cast<uint64_t>(getChannelCount())
Returns
The minimum image size in bytes.

◆ getShape()

ll::vec3ui ll::ImageView::getShape ( ) const
noexcept

Gets the shape of the image view.

The vec3ui object returned must be interpreted as follows:

x : width
y : height
z : depth
Returns
The shape.

◆ getSize()

uint64_t ll::ImageView::getSize ( ) const
noexcept

Gets the memory allocation size in bytes.

This methods is equivalent to calling getAllocationInfo().size.

The size reported by this method includes any row stride and padding needed to store the image in memory according to the device. Use :getMinimumSize: to get the minimum amount of memory to allocate all pixels contiguously in memory without any stride.

Returns
The image size in bytes.

◆ getTiling()

ll::ImageTiling ll::ImageView::getTiling ( ) const
noexcept

Gets the vulkan image tiling.

Returns
The image tiling.

◆ getType()

ll::ObjectType ll::ImageView::getType ( ) const
overridevirtualnoexcept

Gets the object type.

This method can be used for safely down-casting pointers of ll::Object type to its children.

ll::Object* ptr = ...
auto bufferPtr = static_cast<ll::Buffer*>(ptr);
}
Objects to manage raw portions of allocated memory.
Definition: Buffer.h:57
Base class for all types that can be used in computer shaders.
Definition: Object.h:94
virtual ll::ObjectType getType() const noexcept=0
Gets the object type.
Returns
The object type.

Implements ll::Object.

◆ getUsageFlags()

ll::ImageUsageFlags ll::ImageView::getUsageFlags ( ) const
noexcept

Gets the Vulkan image usage flags.

See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkImageUsageFlagBits for more information.

Returns
The usage flags.

◆ getUsageFlagsUnsafe()

uint32_t ll::ImageView::getUsageFlagsUnsafe ( ) const
noexcept

Gets the usage flags casted to an integer type.

Please do not use this method. It's for internal use only.

Returns
The usage flags unsafe.

◆ getWidth()

uint32_t ll::ImageView::getWidth ( ) const
noexcept

Gets the image view width in pixels.

Returns
The image view width in pixels.

◆ operator=() [1/2]

ImageView& ll::ImageView::operator= ( const ImageView )
delete

◆ operator=() [2/2]

ImageView& ll::ImageView::operator= ( ImageView &&  )
delete

Friends And Related Function Documentation

◆ ComputeNode

friend class ComputeNode
friend

◆ Image

friend class Image
friend

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