HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
capabilities.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 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_CAPABILITIES_H
25 #define PXR_IMAGING_HGI_CAPABILITIES_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include "pxr/imaging/hgi/enums.h"
30 
31 #include <cstddef>
32 
34 
35 /// \class HgiCapabilities
36 ///
37 /// Reports the capabilities of the Hgi device.
38 ///
40 {
41 public:
42  HGI_API
43  virtual ~HgiCapabilities() = 0;
44 
46  return (_flags & mask) != 0;
47  }
48 
49  HGI_API
50  virtual int GetAPIVersion() const = 0;
51 
52  HGI_API
53  virtual int GetShaderVersion() const = 0;
54 
55  HGI_API
56  size_t GetMaxUniformBlockSize() const {
57  return _maxUniformBlockSize;
58  }
59 
60  HGI_API
63  }
64 
65  HGI_API
68  }
69 
70  HGI_API
71  size_t GetMaxClipDistances() const {
72  return _maxClipDistances;
73  }
74 
75  HGI_API
76  size_t GetPageSizeAlignment() const {
77  return _pageSizeAlignment;
78  }
79 
80 protected:
87  , _flags(0)
88  {}
89 
91  if (value) {
92  _flags |= mask;
93  } else {
94  _flags &= ~mask;
95  }
96  }
97 
103 
104 private:
105  HgiCapabilities & operator=(const HgiCapabilities&) = delete;
106  HgiCapabilities(const HgiCapabilities&) = delete;
107 
108  HgiDeviceCapabilities _flags;
109 };
110 
112 
113 #endif
HGI_API size_t GetPageSizeAlignment() const
Definition: capabilities.h:76
HGI_API size_t GetMaxShaderStorageBlockSize() const
Definition: capabilities.h:61
size_t _maxClipDistances
Definition: capabilities.h:101
size_t _uniformBufferOffsetAlignment
Definition: capabilities.h:100
size_t _pageSizeAlignment
Definition: capabilities.h:102
virtual HGI_API int GetShaderVersion() const =0
HgiBits HgiDeviceCapabilities
Definition: enums.h:102
HGI_API size_t GetMaxClipDistances() const
Definition: capabilities.h:71
size_t _maxShaderStorageBlockSize
Definition: capabilities.h:99
size_t _maxUniformBlockSize
Definition: capabilities.h:98
GLint GLuint mask
Definition: glcorearb.h:124
bool IsSet(HgiDeviceCapabilities mask) const
Definition: capabilities.h:45
#define HGI_API
Definition: api.h:40
virtual HGI_API ~HgiCapabilities()=0
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
void _SetFlag(HgiDeviceCapabilities mask, bool value)
Definition: capabilities.h:90
Definition: core.h:1131
HGI_API size_t GetMaxUniformBlockSize() const
Definition: capabilities.h:56
virtual HGI_API int GetAPIVersion() const =0
HGI_API size_t GetUniformBufferOffsetAlignment() const
Definition: capabilities.h:66