7 #ifndef PXR_EXEC_EXEC_TYPE_REGISTRY_H
8 #define PXR_EXEC_EXEC_TYPE_REGISTRY_H
23 #include "pxr/base/vt/array.h"
28 #include <tbb/concurrent_unordered_map.h>
34 class Exec_ValueExtractor;
100 template <
typename ValueType>
104 "VtArray is not a supported execution value type.");
106 VdfIsEqualityComparable<ValueType>,
107 "Equality comparison is required for execution value types.");
108 _GetInstanceForRegistration()._RegisterType(fallback);
119 template <
typename ValueType>
121 return VdfExecutionTypeRegistry::CheckForRegistration<ValueType>(
122 "Use ExecTypeRegistry::RegisterType<T>() to register execution "
150 template <
typename ValueType>
151 void _RegisterType(
ValueType const &fallback);
153 template <
typename T>
154 struct _CreateVector {
171 template <
typename T>
172 static auto _MakeExtractorFunction();
176 void _RegisterExtractor(
198 tbb::concurrent_unordered_map<TfType, Exec_ValueExtractor, TfHash>
202 template <
typename ValueType>
204 ExecTypeRegistry::_RegisterType(
ValueType const &fallback)
210 if constexpr (!VtIsKnownValueType<ValueType>()) {
214 _RegisterExtractor(type, *+_MakeExtractorFunction<ValueType>());
217 template <
typename T>
219 ExecTypeRegistry::_CreateVector<T>::Create(
const T &
value)
229 const size_t size = value.size();
232 std::copy_n(value.cdata(),
size, execValue.data());
235 v.
Set(std::move(execValue));
240 template <
typename T>
242 ExecTypeRegistry::_MakeExtractorFunction()
250 TF_VERIFY(
mask.GetNumSet() == 0);
254 if (!TF_VERIFY(
mask.GetNumSet() == 1)) {
259 return VtValue(access[offset]);
266 if (!TF_VERIFY(
mask.AreContiguouslySet())) {
274 const size_t numValues = access.
IsBoxed()
T const & UncheckedGet() const &
#define PXR_NAMESPACE_OPEN_SCOPE
GLsizei const GLfloat * value
A VdfMask is placed on connections to specify the data flowing through them.
Fast, compressed bit array which is capable of performing logical operations without first decompress...
VtArray< T > ExtractAsVtArray(const size_t size, const int offset) const
static TfType Define(const T &fallback)
GLint GLint GLsizei GLint GLenum GLenum type
GLuint GLint GLboolean GLint GLenum access
EXEC_API Exec_ValueExtractor GetExtractor(TfType type) const
ExecTypeRegistry & operator=(ExecTypeRegistry const &)=delete
static EXEC_API const ExecTypeRegistry & GetInstance()
A trait to detect instantiations of VtArray, specialized in array.h.
TfType CheckForRegistration() const
ReadAccessor< TYPE > GetReadAccessor() const
EXEC_API VdfVector CreateVector(const VtValue &value) const
Construct a VdfVector whose value is copied from value.
#define PXR_NAMESPACE_CLOSE_SCOPE
static void RegisterType(const ValueType &fallback)
size_t GetNumValues() const