HDK
|
#include "pxr/pxr.h"
#include "pxr/base/gf/vec3i.h"
#include "pxr/imaging/hgi/api.h"
#include <vector>
#include <limits>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
class | HgiMipInfo |
Functions | |
HGI_API size_t | HgiGetComponentCount (HgiFormat f) |
Return the count of components in the given format. More... | |
HGI_API size_t | HgiGetDataSizeOfFormat (HgiFormat f, size_t *blockWidth=nullptr, size_t *blockHeight=nullptr) |
HGI_API bool | HgiIsCompressed (HgiFormat f) |
Return whether the given format uses compression. More... | |
HGI_API size_t | HgiGetDataSize (HgiFormat f, const GfVec3i &dimensions) |
HGI_API HgiFormat | HgiGetComponentBaseFormat (HgiFormat f) |
HGI_API std::vector< HgiMipInfo > | HgiGetMipInfos (HgiFormat format, const GfVec3i &dimensions, size_t layerCount, size_t dataByteSize=std::numeric_limits< size_t >::max()) |
HgiFormat describes the memory format of image buffers used in Hgi. These formats are closely aligned with HdFormat and allow us to keep Hgi independent of Hd.
For reference, see: https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VkFormat
Returns the scalar type of the format, in the form of an HgiFormat, if possible.
Return the count of components in the given format.
Returns the size necessary to allocate a buffer of given dimensions and format, rounding dimensions up to suitable multiple when using a compressed format.
HGI_API size_t HgiGetDataSizeOfFormat | ( | HgiFormat | f, |
size_t * | blockWidth = nullptr , |
||
size_t * | blockHeight = nullptr |
||
) |
Return the size of a single element of the given format.
For an uncompressed format, returns the number of bytes per pixel and sets blockWidth and blockHeight to 1. For a compressed format (e.g., BC6), returns the number of bytes per block and sets blockWidth and blockHeight to the width and height of a block.
HGI_API std::vector<HgiMipInfo> HgiGetMipInfos | ( | HgiFormat | format, |
const GfVec3i & | dimensions, | ||
size_t | layerCount, | ||
size_t | dataByteSize = std::numeric_limits< size_t >::max() |
||
) |
Returns mip infos.
If dataByteSize is specified, the levels stops when the total memory required by all levels up to that point reach the specified value. Otherwise, the levels stop when all dimensions are 1. Mip map sizes are calculated by dividing the previous mip level by two and rounding down to the nearest integer (minimum integer is 1). level 0: 37x53 level 1: 18x26 level 2: 9x13 level 3: 4x6 level 4: 2x3 level 5: 1x1