SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::IImage Class Referenceabstract
Inheritance diagram for spark::render::IImage:
spark::render::IStateResource spark::render::IDeviceMemory spark::render::vk::IVulkanImage spark::render::vk::VulkanImage

Public Member Functions

virtual std::size_t size (unsigned int level) const =0
 Get the size of the image (in bytes) at the specified mip-map level.
 
virtual math::Vector3< unsigned > extent (unsigned level=0) const noexcept=0
 Get the extent of the image at the specified mip-map level.
 
virtual Format format () const noexcept=0
 Gets the internal format of the image.
 
virtual ImageDimensions dimensions () const noexcept=0
 Gets the dimensions of the image. (1D, 2D, 3D, Cube)
 
virtual unsigned int levels () const noexcept=0
 Gets the number of mip-map levels of the image.
 
virtual unsigned int layers () const noexcept=0
 Gets the number of layers of the image.
 
virtual unsigned int planes () const noexcept=0
 Returns the number of planes of the image.
 
virtual MultiSamplingLevel samples () const noexcept=0
 Gets the number of samples with which the image is sampled.
 
virtual ImageLayout layout (unsigned int sub_resource=0) const =0
 Gets the layout of the image.
 
virtual unsigned int subResourceId (unsigned &level, unsigned &layer, unsigned &plane) const noexcept
 Returns the sub-resource ID for a combination of mip-map level, array layer and plane.
 
std::tuple< unsigned, unsigned, unsigned > resolveSubresource (const unsigned subresource) const noexcept
 Returns the sub-resource ID for a combination of mip-map level, array layer and plane.
 
virtual std::size_t size () const noexcept=0
 Gets the size (in bytes) of the memory chunk.
 
- Public Member Functions inherited from spark::render::IStateResource
virtual const std::string & name () const noexcept=0
 Gets the name of the state resource.
 
- Public Member Functions inherited from spark::render::IDeviceMemory
virtual unsigned int elements () const noexcept=0
 Get the number of sub-resources in the memory chunk.
 
virtual std::size_t elementSize () const noexcept=0
 Gets the size (in bytes) of one element in the memory chunk. If there is only one element, this equals the result of IDeviceMemory::size().
 
virtual std::size_t elementAlignment () const =0
 Gets the alignment of one element in the memory chunk.
 
virtual std::size_t alignedElementSize () const noexcept=0
 Gets the real size (in bytes) of the memory chunk.
 
virtual bool writable () const noexcept=0
 Checks if the resource can be bound to a read/write descriptor.
 

Member Function Documentation

◆ dimensions()

virtual ImageDimensions spark::render::IImage::dimensions ( ) const
nodiscardpure virtualnoexcept

Gets the dimensions of the image. (1D, 2D, 3D, Cube)

Returns
A ImageDimensions that describes the dimensions of the image.
Note
This imply various things, especially which values of the extent() are valid.

Implemented in spark::render::vk::VulkanImage.

◆ extent()

virtual math::Vector3< unsigned > spark::render::IImage::extent ( unsigned level = 0) const
nodiscardpure virtualnoexcept

Get the extent of the image at the specified mip-map level.

Parameters
levelThe mip-map level for which to get the extent.
Returns
The extent of the image at the specified mip-map level or 0 if the mip-map level is invalid.
Note
Not all components of the returned extent are valid for all image dimensions. For example, a 1D image only has a valid x component. See ImageDimensions.

Implemented in spark::render::vk::VulkanImage.

◆ format()

virtual Format spark::render::IImage::format ( ) const
nodiscardpure virtualnoexcept

Gets the internal format of the image.

Returns
A Format that describes the internal format of the image.

Implemented in spark::render::vk::VulkanImage.

◆ layers()

virtual unsigned int spark::render::IImage::layers ( ) const
nodiscardpure virtualnoexcept

Gets the number of layers of the image.

Returns
The number of layers (slices) of the image.

Implemented in spark::render::vk::VulkanImage.

◆ layout()

virtual ImageLayout spark::render::IImage::layout ( unsigned int sub_resource = 0) const
nodiscardpure virtual

Gets the layout of the image.

Parameters
sub_resourceThe sub-resource id for which to get the layout.
Returns
The layout of the image.

◆ levels()

virtual unsigned int spark::render::IImage::levels ( ) const
nodiscardpure virtualnoexcept

Gets the number of mip-map levels of the image.

Returns
The number of mip-map levels of the image.

Implemented in spark::render::vk::VulkanImage.

◆ planes()

virtual unsigned int spark::render::IImage::planes ( ) const
nodiscardpure virtualnoexcept

Returns the number of planes of the image.

Returns
The number of planes of the image.
Note
This values is dictated from the format() of the image.

Implemented in spark::render::vk::VulkanImage.

◆ resolveSubresource()

std::tuple< unsigned, unsigned, unsigned > spark::render::IImage::resolveSubresource ( const unsigned subresource) const
inlinenodiscardnoexcept

Returns the sub-resource ID for a combination of mip-map level, array layer and plane.

Parameters
subresourceThe sub-resource ID.
Returns
The sub-resource ID for the specified combination of level, layer and plane.

◆ samples()

virtual MultiSamplingLevel spark::render::IImage::samples ( ) const
nodiscardpure virtualnoexcept

Gets the number of samples with which the image is sampled.

Returns
The number of samples of the image.

Implemented in spark::render::vk::VulkanImage.

◆ size() [1/2]

virtual std::size_t spark::render::IDeviceMemory::size ( ) const
nodiscardvirtualnoexcept

Gets the size (in bytes) of the memory chunk.

Returns
The size of the memory chunk in bytes.
Note
The size of the device memory block depends on different factors. The actual used memory of one element can be obtained by calling by the IDeviceMemory::elementSize(). For different reasons, though, elements may be required to be aligned to a certain size. The size of one aligned element is returned by IDeviceMemory::alignedElementSize(). The size of the memory block, the elements get aligned to is returned by IDeviceMemory::elementAlignment().

Implements spark::render::IDeviceMemory.

Reimplemented in spark::render::vk::VulkanImage.

◆ size() [2/2]

virtual std::size_t spark::render::IImage::size ( unsigned int level) const
nodiscardpure virtual

Get the size of the image (in bytes) at the specified mip-map level.

Returns
The size of the image (in bytes) at the specified mip-map or 0 if the mip-map level is invalid.
Note
The returned size is only for one layer. If you have multiple layers, you need to multiply the returned size with the number of layers.

◆ subResourceId()

virtual unsigned int spark::render::IImage::subResourceId ( unsigned & level,
unsigned & layer,
unsigned & plane ) const
inlinenodiscardvirtualnoexcept

Returns the sub-resource ID for a combination of mip-map level, array layer and plane.

Parameters
levelThe mip-map level of the sub-resource.
layerThe array layer of the sub-resource.
planeThe plane of the sub-resource.
Returns
The sub-resource ID for the specified combination of level, layer and plane.