24 #ifndef PXR_IMAGING_HD_ST_TEXTURE_UTILS_H 25 #define PXR_IMAGING_HD_ST_TEXTURE_UTILS_H 28 #include "pxr/imaging/hdSt/api.h" 32 #include "pxr/imaging/hgi/handle.h" 33 #include "pxr/imaging/hgi/types.h" 39 PXR_NAMESPACE_OPEN_SCOPE
56 void(*)(
const void * src,
68 bool premultiplyAlpha);
78 bool premultiplyAlpha);
84 const std::string &filePath,
95 ComputeDimensionsFromTargetMemory(
96 const std::vector<HioImageSharedPtr> &mips,
97 HgiFormat targetFormat,
100 size_t * mipIndex =
nullptr);
113 HioImageSharedPtr
const &image,
115 bool premultiplyAlpha,
124 template <
typename T>
129 : AlignedBuffer(nullptr)
133 return _alignedPtr.get();
139 explicit AlignedBuffer(T * alignedPtr)
144 return _alignedPtr.release();
153 AlignedBuffer<uint8_t>
155 HgiTextureHandle
const & texture,
156 size_t * bufferSize);
159 template <
typename T>
163 HgiTextureHandle
const & texture,
164 size_t * bufferSize);
167 template <
typename T>
168 HdStTextureUtils::AlignedBuffer<T>
170 HgiTextureHandle
const & texture,
173 HdStTextureUtils::AlignedBuffer<uint8_t> buffer =
176 T * typedData = reinterpret_cast<T *>(buffer.release());
177 return HdStTextureUtils::AlignedBuffer<T>(typedData);
180 PXR_NAMESPACE_CLOSE_SCOPE
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.
Provide architecture-specific memory-alignment information.
static HDST_API HgiFormat GetHgiFormat(HioFormat hioFormat, bool premultiplyAlpha)
Get the Hgi format suitable for a given Hio format.
ARCH_API void ArchAlignedFree(void *ptr)
Free memory allocated by ArchAlignedAlloc.
SourceColorSpace
Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture ...
Helpers for loading textures.
static HDST_API ConversionFunction GetHioToHgiConversion(HioFormat hioFormat, bool premultiplyAlpha)
Returns the conversion function to return a HioFormat to the corresponding HgiFormat given by GetHgiF...
HgiMipInfo describes size and other info for a mip level.
Basic type for a vector of 3 int components.
Hydra Graphics Interface.
void(*)(const void *src, size_t numTexels, void *dst) ConversionFunction
Converts given number of texels.
static HDST_API std::vector< HioImageSharedPtr > GetAllMipImages(const std::string &filePath, HioImage::SourceColorSpace sourceColorSpace)
Get all mip levels from a file.