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"
39PXR_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>
156 size_t * bufferSize);
159 template <
typename T>
164 size_t * bufferSize);
168HdStTextureUtils::AlignedBuffer<T>
173 HdStTextureUtils::AlignedBuffer<uint8_t> buffer =
176 T * typedData =
reinterpret_cast<T *
>(buffer.release());
177 return HdStTextureUtils::AlignedBuffer<T>(typedData);
180PXR_NAMESPACE_CLOSE_SCOPE
Provide architecture-specific memory-alignment information.
Basic type for a vector of 3 int components.
Helpers for loading textures.
void(*)(const void *src, size_t numTexels, void *dst) ConversionFunction
Converts given number of texels.
static HDST_API ConversionFunction GetHioToHgiConversion(HioFormat hioFormat, bool premultiplyAlpha)
Returns the conversion function to return a HioFormat to the corresponding HgiFormat given by GetHgiF...
static HDST_API HgiFormat GetHgiFormat(HioFormat hioFormat, bool premultiplyAlpha)
Get the Hgi format suitable for a given Hio format.
static HDST_API std::vector< HioImageSharedPtr > GetAllMipImages(const std::string &filePath, HioImage::SourceColorSpace sourceColorSpace)
Get all mip levels from a file.
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.
Hydra Graphics Interface.
SourceColorSpace
Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture ...
ARCH_API void ArchAlignedFree(void *ptr)
Free memory allocated by ArchAlignedAlloc.
HgiMipInfo describes size and other info for a mip level.