Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Private Attributes | List of all members
talvos::Image Class Reference

This class represents an image object. More...

#include <talvos/Image.h>

Classes

class  Texel
 This class represents a single texel with four 32-bit component values. More...
 

Public Member Functions

 Image (Device &Dev, VkImageType Type, VkFormat Format, VkExtent3D Extent, uint32_t NumArrayLayers=1, uint32_t NumMipLevels=1)
 Create an image. More...
 
void bindAddress (uint64_t Address)
 Bind a memory address to the image (can only be called once). More...
 
uint64_t getAddress () const
 Returns the memory address of the beginning of the image. More...
 
uint32_t getDepth (uint32_t Level=0) const
 Returns the depth of the image at the specified mip level. More...
 
uint32_t getElementSize () const
 Returns the size in bytes of a single pixel in the image. More...
 
VkExtent3D getExtent () const
 Returns the size of a single layer of the image. More...
 
VkFormat getFormat () const
 Returns the format of the image. More...
 
uint32_t getHeight (uint32_t Level=0) const
 Returns the height of the image at the specified mip level. More...
 
uint64_t getMipLevelOffset (uint32_t Level) const
 Returns the offset in bytes to the beginning of the specified mip level. More...
 
uint32_t getNumArrayLayers () const
 Returns the number of array layers in the image. More...
 
uint32_t getNumMipLevels () const
 Returns the number of mip levels in the image. More...
 
uint64_t getTexelAddress (uint32_t X, uint32_t Y=0, uint32_t Z=0, uint32_t Layer=0, uint32_t MipLevel=0) const
 Returns the address in memory of the texel at the specified coordinate. More...
 
uint64_t getTotalSize () const
 Returns the total size of the image (including all mip levels). More...
 
VkImageType getType () const
 Returns the type of the image. More...
 
uint32_t getWidth (uint32_t Level=0) const
 Returns the width of the image at the specified mip level. More...
 
void read (Texel &T, uint64_t Address) const
 Read a texel from the image at the specified address. More...
 
void read (Texel &T, uint64_t Address, VkFormat ReadFormat) const
 Read a texel from the image at the specified address using ReadFormat. More...
 
void write (const Texel &T, uint64_t Address) const
 Write a texel to the image at the specified address. More...
 
void write (const Texel &T, uint64_t Address, VkFormat WriteFormat) const
 Write a texel to the image at the specified address using WriteFormat. More...
 

Private Attributes

Device & Dev
 The device this image view is created on. More...
 
VkImageType Type
 The image type. More...
 
VkFormat Format
 The image format. More...
 
VkExtent3D Extent
 The image extent. More...
 
uint32_t NumArrayLayers
 The number of array layers. More...
 
uint32_t NumMipLevels
 The number of mip levels. More...
 
uint64_t Address = 0
 The memory address of the image data. More...
 

Detailed Description

This class represents an image object.

Definition at line 24 of file Image.h.

Constructor & Destructor Documentation

talvos::Image::Image ( Device &  Dev,
VkImageType  Type,
VkFormat  Format,
VkExtent3D  Extent,
uint32_t  NumArrayLayers = 1,
uint32_t  NumMipLevels = 1 
)
inline

Create an image.

Definition at line 102 of file Image.h.

Member Function Documentation

void talvos::Image::bindAddress ( uint64_t  Address)

Bind a memory address to the image (can only be called once).

Definition at line 144 of file Image.cpp.

uint64_t talvos::Image::getAddress ( ) const
inline

Returns the memory address of the beginning of the image.

Definition at line 114 of file Image.h.

uint32_t talvos::Image::getDepth ( uint32_t  Level = 0) const

Returns the depth of the image at the specified mip level.

Definition at line 150 of file Image.cpp.

uint32_t talvos::Image::getElementSize ( ) const

Returns the size in bytes of a single pixel in the image.

Definition at line 156 of file Image.cpp.

VkExtent3D talvos::Image::getExtent ( ) const
inline

Returns the size of a single layer of the image.

Definition at line 123 of file Image.h.

VkFormat talvos::Image::getFormat ( ) const
inline

Returns the format of the image.

Definition at line 126 of file Image.h.

uint32_t talvos::Image::getHeight ( uint32_t  Level = 0) const

Returns the height of the image at the specified mip level.

Definition at line 161 of file Image.cpp.

uint64_t talvos::Image::getMipLevelOffset ( uint32_t  Level) const

Returns the offset in bytes to the beginning of the specified mip level.

Definition at line 167 of file Image.cpp.

uint32_t talvos::Image::getNumArrayLayers ( ) const
inline

Returns the number of array layers in the image.

Definition at line 135 of file Image.h.

uint32_t talvos::Image::getNumMipLevels ( ) const
inline

Returns the number of mip levels in the image.

Definition at line 138 of file Image.h.

uint64_t talvos::Image::getTexelAddress ( uint32_t  X,
uint32_t  Y = 0,
uint32_t  Z = 0,
uint32_t  Layer = 0,
uint32_t  MipLevel = 0 
) const

Returns the address in memory of the texel at the specified coordinate.

Definition at line 179 of file Image.cpp.

uint64_t talvos::Image::getTotalSize ( ) const
inline

Returns the total size of the image (including all mip levels).

Definition at line 145 of file Image.h.

VkImageType talvos::Image::getType ( ) const
inline

Returns the type of the image.

Definition at line 148 of file Image.h.

uint32_t talvos::Image::getWidth ( uint32_t  Level = 0) const

Returns the width of the image at the specified mip level.

Definition at line 188 of file Image.cpp.

void talvos::Image::read ( Texel &  T,
uint64_t  Address 
) const

Read a texel from the image at the specified address.

Definition at line 194 of file Image.cpp.

void talvos::Image::read ( Texel &  T,
uint64_t  Address,
VkFormat  ReadFormat 
) const

Read a texel from the image at the specified address using ReadFormat.

Definition at line 196 of file Image.cpp.

void talvos::Image::write ( const Texel &  T,
uint64_t  Address 
) const

Write a texel to the image at the specified address.

Definition at line 330 of file Image.cpp.

void talvos::Image::write ( const Texel &  T,
uint64_t  Address,
VkFormat  WriteFormat 
) const

Write a texel to the image at the specified address using WriteFormat.

Definition at line 335 of file Image.cpp.

Member Data Documentation

uint64_t talvos::Image::Address = 0
private

The memory address of the image data.

Definition at line 174 of file Image.h.

Device& talvos::Image::Dev
private

The device this image view is created on.

Definition at line 166 of file Image.h.

VkExtent3D talvos::Image::Extent
private

The image extent.

Definition at line 170 of file Image.h.

VkFormat talvos::Image::Format
private

The image format.

Definition at line 169 of file Image.h.

uint32_t talvos::Image::NumArrayLayers
private

The number of array layers.

Definition at line 171 of file Image.h.

uint32_t talvos::Image::NumMipLevels
private

The number of mip levels.

Definition at line 172 of file Image.h.

VkImageType talvos::Image::Type
private

The image type.

Definition at line 168 of file Image.h.