File tree Expand file tree Collapse file tree 3 files changed +9
-20
lines changed
Expand file tree Collapse file tree 3 files changed +9
-20
lines changed Original file line number Diff line number Diff line change 2626
2727#include " pxr/base/tf/token.h"
2828#include " pxr/base/tf/type.h"
29+ #include " pxr/base/vt/traits.h"
2930#include " pxr/exec/vdf/context.h"
3031#include " pxr/usd/sdf/path.h"
3132
@@ -844,6 +845,9 @@ Exec_PrimComputationBuilder&
844845Exec_PrimComputationBuilder::Callback (
845846 ExecCallbackFn &&callback)
846847{
848+ static_assert (!VtIsArray<ResultType>::value,
849+ " VtArray is not a supported result type" );
850+
847851 _AddCallback (
848852 std::move (callback),
849853 ExecTypeRegistry::GetInstance ().CheckForRegistration <ResultType>());
@@ -860,6 +864,9 @@ Exec_PrimComputationBuilder::Callback(
860864{
861865 static_assert (!std::is_reference_v<ResultType>,
862866 " Callback functions must return by value" );
867+ static_assert (!VtIsArray<ResultType>::value,
868+ " VtArray is not a supported result type" );
869+
863870 _AddCallback (
864871 [callback](const VdfContext& ctx) { ctx.SetOutput (callback (ctx)); },
865872 ExecTypeRegistry::GetInstance ().CheckForRegistration <ResultType>());
Original file line number Diff line number Diff line change @@ -62,9 +62,6 @@ TestBasicRegistration()
6262
6363 reg.RegisterType (TestExecTypeRegistrationValue{});
6464 reg.CheckForRegistration <TestExecTypeRegistrationValue>();
65-
66- reg.RegisterType (VtArray<TestExecTypeRegistrationValue>{});
67- reg.CheckForRegistration <VtArray<TestExecTypeRegistrationValue>>();
6865}
6966
7067static void
@@ -189,23 +186,6 @@ TestCreateVector()
189186 // define only what is necessary for VtValue & VdfVector.
190187 TF_AXIOM (accessor[0 ] == TestExecTypeRegistrationValue{});
191188 }
192-
193- // VtArray<TestExecTypeRegistrationValue> is not known to Vt and is not an
194- // Sdf value type.
195- {
196- static_assert (!VtIsKnownValueType<
197- VtArray<TestExecTypeRegistrationValue>>());
198- static_assert (!SdfValueTypeTraits<
199- VtArray<TestExecTypeRegistrationValue>>::IsValueType);
200- const VtArray<TestExecTypeRegistrationValue> arr = { {}, {} };
201- const VdfVector vec = reg.CreateVector (VtValue (arr));
202- TF_AXIOM (vec.Holds <TestExecTypeRegistrationValue>());
203- const auto accessor = vec.GetReadAccessor <
204- TestExecTypeRegistrationValue>();
205- ASSERT_EQ (accessor.GetNumValues (), 2 );
206- TF_AXIOM (accessor[0 ] == arr[0 ]);
207- TF_AXIOM (accessor[1 ] == arr[1 ]);
208- }
209189}
210190
211191static void
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ class ExecTypeRegistry
7575 // /
7676 template <typename ValueType>
7777 static void RegisterType (const ValueType &fallback) {
78+ static_assert (!VtIsArray<ValueType>::value,
79+ " VtArray is not a supported execution value type" );
7880 _GetInstanceForRegistration ()._RegisterType (fallback);
7981 }
8082
You can’t perform that action at this time.
0 commit comments