Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
foray::util::ImageLoader< FORMAT > Class Template Reference

General purpose image loader. More...

#include <foray_imageloader.hpp>

Classes

class  ImageInfo
 

Public Types

using FORMAT_TRAITS = ImageFormatTraits< FORMAT >
 

Public Member Functions

 ImageLoader ()
 
bool Init (const osi::Utf8Path &utf8path)
 Inits the image loader.
 
bool Load ()
 Loads the file into CPU memory (Init first!)
 
void Destroy ()
 Cleans up the loader.
 
virtual ~ImageLoader ()
 
void InitManagedImage (core::Context *context, core::ManagedImage *image, core::ManagedImage::CreateInfo &ci, VkImageLayout afterwrite=VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) const
 
void InitManagedImage (core::Context *context, core::HostSyncCommandBuffer &cmdBuffer, core::ManagedImage *image, core::ManagedImage::CreateInfo &ci, VkImageLayout afterwrite=VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) const
 
void UpdateManagedImageCI (core::ManagedImage::CreateInfo &ci) const
 
void WriteManagedImageData (core::ManagedImage *image, VkImageLayout afterwrite) const
 
void WriteManagedImageData (core::HostSyncCommandBuffer &cmdBuffer, core::ManagedImage *image, VkImageLayout afterwrite) const
 

Static Public Member Functions

static bool sFormatSupported (core::Context *context)
 Checks if format the loader was initialized in supports linear tiling transfer and shader read.
 

Protected Member Functions

bool PopulateImageInfo_TinyExr ()
 
bool PopulateImageInfo_Stb ()
 
bool Load_TinyExr ()
 
bool Load_Stb ()
 

Protected Attributes

ImageInfo mInfo
 
std::vector< uint8_t > mRawData
 
void * mCustomLoaderInfo = nullptr
 
std::function< void(void *)> mCustomLoaderInfoDeleter = {}
 

Detailed Description

template<VkFormat FORMAT>
class foray::util::ImageLoader< FORMAT >

General purpose image loader.

Supported File Types

Member Typedef Documentation

◆ FORMAT_TRAITS

template<VkFormat FORMAT>
using foray::util::ImageLoader< FORMAT >::FORMAT_TRAITS = ImageFormatTraits<FORMAT>

Constructor & Destructor Documentation

◆ ImageLoader()

template<VkFormat FORMAT>
foray::util::ImageLoader< FORMAT >::ImageLoader ( )
inline

◆ ~ImageLoader()

template<VkFormat FORMAT>
virtual foray::util::ImageLoader< FORMAT >::~ImageLoader ( )
inlinevirtual

Member Function Documentation

◆ Destroy()

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::Destroy ( )
inline

Cleans up the loader.

◆ Init()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::Init ( const osi::Utf8Path utf8path)
inline

Inits the image loader.

Returns
True if the image exists, can be loaded and the data is suitable for the

◆ InitManagedImage() [1/2]

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::InitManagedImage ( core::Context context,
core::HostSyncCommandBuffer cmdBuffer,
core::ManagedImage image,
core::ManagedImage::CreateInfo ci,
VkImageLayout  afterwrite = VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL 
) const
inline

◆ InitManagedImage() [2/2]

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::InitManagedImage ( core::Context context,
core::ManagedImage image,
core::ManagedImage::CreateInfo ci,
VkImageLayout  afterwrite = VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL 
) const
inline

◆ Load()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::Load ( )
inline

Loads the file into CPU memory (Init first!)

◆ Load_Stb()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::Load_Stb ( )
protected

◆ Load_TinyExr()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::Load_TinyExr ( )
protected

◆ PopulateImageInfo_Stb()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::PopulateImageInfo_Stb ( )
protected

◆ PopulateImageInfo_TinyExr()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::PopulateImageInfo_TinyExr ( )
protected

◆ sFormatSupported()

template<VkFormat FORMAT>
bool foray::util::ImageLoader< FORMAT >::sFormatSupported ( core::Context context)
inlinestatic

Checks if format the loader was initialized in supports linear tiling transfer and shader read.

◆ UpdateManagedImageCI()

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::UpdateManagedImageCI ( core::ManagedImage::CreateInfo ci) const
inline

◆ WriteManagedImageData() [1/2]

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::WriteManagedImageData ( core::HostSyncCommandBuffer cmdBuffer,
core::ManagedImage image,
VkImageLayout  afterwrite 
) const
inline

◆ WriteManagedImageData() [2/2]

template<VkFormat FORMAT>
void foray::util::ImageLoader< FORMAT >::WriteManagedImageData ( core::ManagedImage image,
VkImageLayout  afterwrite 
) const
inline

Member Data Documentation

◆ mCustomLoaderInfo

template<VkFormat FORMAT>
void* foray::util::ImageLoader< FORMAT >::mCustomLoaderInfo = nullptr
protected

◆ mCustomLoaderInfoDeleter

template<VkFormat FORMAT>
std::function<void(void*)> foray::util::ImageLoader< FORMAT >::mCustomLoaderInfoDeleter = {}
protected

◆ mInfo

template<VkFormat FORMAT>
ImageInfo foray::util::ImageLoader< FORMAT >::mInfo
protected

◆ mRawData

template<VkFormat FORMAT>
std::vector<uint8_t> foray::util::ImageLoader< FORMAT >::mRawData
protected

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