HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdStTextureUtils Class Reference

#include <textureUtils.h>

Classes

class  AlignedBuffer
 

Public Types

using ConversionFunction = void(*)(const void *src, size_t numTexels, void *dst)
 

Static Public Member Functions

static HDST_API HgiFormat GetHgiFormat (HioFormat hioFormat, bool premultiplyAlpha)
 
static HDST_API ConversionFunction GetHioToHgiConversion (HioFormat hioFormat, bool premultiplyAlpha)
 
static HDST_API std::vector
< HioImageSharedPtr
GetAllMipImages (const std::string &filePath, HioImage::SourceColorSpace sourceColorSpace)
 Get all mip levels from a file. More...
 
static HDST_API GfVec3i ComputeDimensionsFromTargetMemory (const std::vector< HioImageSharedPtr > &mips, HgiFormat targetFormat, size_t tileCount, size_t targetMemory, size_t *mipIndex=nullptr)
 
static HDST_API bool ReadAndConvertImage (HioImageSharedPtr const &image, bool flipped, bool premultiplyAlpha, const HgiMipInfo &mipInfo, size_t layer, void *bufferStart)
 
static HDST_API AlignedBuffer
< uint8_t > 
HgiTextureReadback (Hgi *const hgi, HgiTextureHandle const &texture, size_t *bufferSize)
 Returns an unsigned byte buffer with data read back from texture. More...
 
template<typename T >
static AlignedBuffer< THgiTextureReadback (Hgi *const hgi, HgiTextureHandle const &texture, size_t *bufferSize)
 Returns a buffer with data of type T read back from texture. More...
 

Detailed Description

Helpers for loading textures.

Definition at line 48 of file textureUtils.h.

Member Typedef Documentation

using HdStTextureUtils::ConversionFunction = void(*)(const void * src, size_t numTexels, void * dst)

Converts given number of texels.

Conversion can be in-place if the ends of the source and destination buffers align.

Definition at line 58 of file textureUtils.h.

Member Function Documentation

static HDST_API GfVec3i HdStTextureUtils::ComputeDimensionsFromTargetMemory ( const std::vector< HioImageSharedPtr > &  mips,
HgiFormat  targetFormat,
size_t  tileCount,
size_t  targetMemory,
size_t *  mipIndex = nullptr 
)
static
static HDST_API std::vector<HioImageSharedPtr> HdStTextureUtils::GetAllMipImages ( const std::string filePath,
HioImage::SourceColorSpace  sourceColorSpace 
)
static

Get all mip levels from a file.

static HDST_API HgiFormat HdStTextureUtils::GetHgiFormat ( HioFormat  hioFormat,
bool  premultiplyAlpha 
)
static

Get the Hgi format suitable for a given Hio format.

Premultiply alpha indicates whether a conversion function multiplying RGB with alpha should be created.

static HDST_API ConversionFunction HdStTextureUtils::GetHioToHgiConversion ( HioFormat  hioFormat,
bool  premultiplyAlpha 
)
static

Returns the conversion function to return a HioFormat to the corresponding HgiFormat given by GetHgiFormat.

Returns nullptr if no conversion necessary.

static HDST_API AlignedBuffer<uint8_t> HdStTextureUtils::HgiTextureReadback ( Hgi *const  hgi,
HgiTextureHandle const texture,
size_t *  bufferSize 
)
static

Returns an unsigned byte buffer with data read back from texture.

template<typename T >
HdStTextureUtils::AlignedBuffer< T > HdStTextureUtils::HgiTextureReadback ( Hgi *const  hgi,
HgiTextureHandle const texture,
size_t *  bufferSize 
)
static

Returns a buffer with data of type T read back from texture.

Definition at line 169 of file textureUtils.h.

static HDST_API bool HdStTextureUtils::ReadAndConvertImage ( HioImageSharedPtr const image,
bool  flipped,
bool  premultiplyAlpha,
const HgiMipInfo mipInfo,
size_t  layer,
void bufferStart 
)
static

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