HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
types.h
Go to the documentation of this file.
1 //
2 // Copyright 2020 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HGI_TYPES_H
25 #define PXR_IMAGING_HGI_TYPES_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include <stdlib.h>
30 
31 
33 
34 /// \enum HgiFormat
35 ///
36 /// HgiFormat describes the memory format of image buffers used in Hgi.
37 /// These formats are closely aligned with HdFormat and allow us to keep Hgi
38 /// independent of Hd.
39 ///
40 /// For reference, see:
41 /// https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VkFormat
43 {
45 
46  // UNorm8 - a 1-byte value representing a float between 0 and 1.
47  // float value = (unorm / 255.0f);
50  /* HgiFormatUNorm8Vec3 */ // Unsupported Metal (MTLPixelFormat)
52 
53  // SNorm8 - a 1-byte value representing a float between -1 and 1.
54  // float value = max(snorm / 127.0f, -1.0f);
57  /* HgiFormatSNorm8Vec3 */ // Unsupported Metal (MTLPixelFormat)
59 
60  // Float16 - a 2-byte IEEE half-precision float.
65 
66  // Float32 - a 4-byte IEEE float.
71 
72  // Int32 - a 4-byte signed integer
77 
78  // UNorm8 SRGB - a 1-byte value representing a float between 0 and 1.
79  // Gamma compression/decompression happens during read/write.
80  // Alpha component is linear.
81  /* HgiFormatUNorm8srgb */ // Unsupported by OpenGL
82  /* HgiFormatUNorm8Vec2srgb */ // Unsupported by OpenGL
83  /* HgiFormatUNorm8Vec3srgb */ // Unsupported Metal (MTLPixelFormat)
85 
86  // BPTC compressed. 3-component, 4x4 blocks, signed floating-point
88 
89  // BPTC compressed. 3-component, 4x4 blocks, unsigned floating-point
91 
92  // Depth stencil format (Float32 can be used for just depth)
94 
96 };
97 
98 /// Return the count of components in the given format.
99 HGI_API
101 
102 /// Return the size of a single element of the given format.
103 ///
104 /// Returns the bytes-per-pixel even for blocked formats such as
105 /// BC6 since - luckily - the number still happens to be integral for supported
106 /// compression formats.
107 HGI_API
109 
110 /// Return whether the given format uses compression.
111 HGI_API
113 
115 
116 #endif
HGI_API bool HgiIsCompressed(HgiFormat f)
Return whether the given format uses compression.
GLclampf f
Definition: glew.h:3499
#define HGI_API
Definition: api.h:40
HGI_API size_t HgiGetComponentCount(HgiFormat f)
Return the count of components in the given format.
HGI_API size_t HgiDataSizeOfFormat(HgiFormat f)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HgiFormat
Definition: types.h:42