HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
types.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/gf/vec3i.h"
#include "pxr/imaging/hgi/api.h"
#include <vector>
#include <limits>
#include <stdlib.h>
+ Include dependency graph for types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  HgiMipInfo
 

Enumerations

enum  HgiFormat : int {
  HgiFormatInvalid = -1, HgiFormatUNorm8 = 0, HgiFormatUNorm8Vec2, HgiFormatUNorm8Vec4,
  HgiFormatSNorm8, HgiFormatSNorm8Vec2, HgiFormatSNorm8Vec4, HgiFormatFloat16,
  HgiFormatFloat16Vec2, HgiFormatFloat16Vec3, HgiFormatFloat16Vec4, HgiFormatFloat32,
  HgiFormatFloat32Vec2, HgiFormatFloat32Vec3, HgiFormatFloat32Vec4, HgiFormatInt16,
  HgiFormatInt16Vec2, HgiFormatInt16Vec3, HgiFormatInt16Vec4, HgiFormatUInt16,
  HgiFormatUInt16Vec2, HgiFormatUInt16Vec3, HgiFormatUInt16Vec4, HgiFormatInt32,
  HgiFormatInt32Vec2, HgiFormatInt32Vec3, HgiFormatInt32Vec4, HgiFormatUNorm8Vec4srgb,
  HgiFormatBC6FloatVec3, HgiFormatBC6UFloatVec3, HgiFormatBC7UNorm8Vec4, HgiFormatBC7UNorm8Vec4srgb,
  HgiFormatBC1UNorm8Vec4, HgiFormatBC3UNorm8Vec4, HgiFormatFloat32UInt8, HgiFormatPackedInt1010102,
  HgiFormatCount
}
 

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< HgiMipInfoHgiGetMipInfos (HgiFormat format, const GfVec3i &dimensions, size_t layerCount, size_t dataByteSize=std::numeric_limits< size_t >::max())
 

Enumeration Type Documentation

enum HgiFormat : int

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

Enumerator
HgiFormatInvalid 
HgiFormatUNorm8 
HgiFormatUNorm8Vec2 
HgiFormatUNorm8Vec4 
HgiFormatSNorm8 
HgiFormatSNorm8Vec2 
HgiFormatSNorm8Vec4 
HgiFormatFloat16 
HgiFormatFloat16Vec2 
HgiFormatFloat16Vec3 
HgiFormatFloat16Vec4 
HgiFormatFloat32 
HgiFormatFloat32Vec2 
HgiFormatFloat32Vec3 
HgiFormatFloat32Vec4 
HgiFormatInt16 
HgiFormatInt16Vec2 
HgiFormatInt16Vec3 
HgiFormatInt16Vec4 
HgiFormatUInt16 
HgiFormatUInt16Vec2 
HgiFormatUInt16Vec3 
HgiFormatUInt16Vec4 
HgiFormatInt32 
HgiFormatInt32Vec2 
HgiFormatInt32Vec3 
HgiFormatInt32Vec4 
HgiFormatUNorm8Vec4srgb 
HgiFormatBC6FloatVec3 
HgiFormatBC6UFloatVec3 
HgiFormatBC7UNorm8Vec4 
HgiFormatBC7UNorm8Vec4srgb 
HgiFormatBC1UNorm8Vec4 
HgiFormatBC3UNorm8Vec4 
HgiFormatFloat32UInt8 
HgiFormatPackedInt1010102 
HgiFormatCount 

Definition at line 45 of file types.h.

Function Documentation

HGI_API HgiFormat HgiGetComponentBaseFormat ( HgiFormat  f)

Returns the scalar type of the format, in the form of an HgiFormat, if possible.

HGI_API size_t HgiGetComponentCount ( HgiFormat  f)

Return the count of components in the given format.

HGI_API size_t HgiGetDataSize ( HgiFormat  f,
const GfVec3i dimensions 
)

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

HGI_API bool HgiIsCompressed ( HgiFormat  f)

Return whether the given format uses compression.