7#ifndef PXR_IMAGING_HD_ST_TEXTURE_UTILS_H
8#define PXR_IMAGING_HD_ST_TEXTURE_UTILS_H
11#include "pxr/imaging/hdSt/api.h"
15#include "pxr/imaging/hgi/handle.h"
16#include "pxr/imaging/hgi/types.h"
22PXR_NAMESPACE_OPEN_SCOPE
39 void(*)(
const void * src,
51 bool premultiplyAlpha);
61 bool premultiplyAlpha);
67 const std::string &filePath,
78 ComputeDimensionsFromTargetMemory(
79 const std::vector<HioImageSharedPtr> &mips,
80 HgiFormat targetFormat,
83 size_t * mipIndex =
nullptr);
96 HioImageSharedPtr
const &image,
98 bool premultiplyAlpha,
107 template <
typename T>
112 : AlignedBuffer(nullptr)
116 return _alignedPtr.get();
122 explicit AlignedBuffer(T * alignedPtr)
127 return _alignedPtr.release();
136 AlignedBuffer<uint8_t>
139 size_t * bufferSize);
142 template <
typename T>
147 size_t * bufferSize);
151HdStTextureUtils::AlignedBuffer<T>
156 HdStTextureUtils::AlignedBuffer<uint8_t> buffer =
159 T * typedData =
reinterpret_cast<T *
>(buffer.release());
160 return HdStTextureUtils::AlignedBuffer<T>(typedData);
163PXR_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.