Skip to content

Commit c735937

Browse files
tgvarikpixar-oss
authored andcommitted
Remove HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES
In 23.11, we introduced new names for the internal instancer primvars Hydra uses for instance transforms. The rename was important to avoid accidental collisions between custom authored primvars and the internal ones. At the same time, we introduced the TfEnvSetting HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES to allow authors of Hydra render delegates time to update their implementations. We announced that the setting would be removed in 24.05. This change effects that removal and finally removes the tokens for the deprecated names. Render delegate authors who need more time to update their code should not adopt 24.05 until they have completed the transition. (Internal change: 2321970)
1 parent 423abe8 commit c735937

18 files changed

Lines changed: 99 additions & 620 deletions

pxr/imaging/hd/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,6 @@ pxr_build_test(testHdTypes
364364
testenv/testHdTypes.cpp
365365
)
366366

367-
pxr_build_test(testHdInstancerDeprecatedPrimvars
368-
LIBRARIES
369-
hd
370-
371-
CPPFILES
372-
testenv/testHdInstancerDeprecatedPrimvars.cpp
373-
)
374-
375367
pxr_build_test(testHdCollectionExpressionEvaluator
376368
LIBRARIES
377369
hd
@@ -446,12 +438,6 @@ pxr_register_test(testHdTypes
446438
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdTypes"
447439
)
448440

449-
pxr_register_test(testHdInstancerDeprecatedPrimvars
450-
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdInstancerDeprecatedPrimvars"
451-
ENV
452-
HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES=true
453-
)
454-
455441
pxr_register_test(testHdCollectionExpressionEvaluator
456442
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdCollectionExpressionEvaluator"
457443
)

pxr/imaging/hd/instancer.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ HdInstancer::GetInstancerNumLevels(HdRenderIndex& index,
6464
TfTokenVector const &
6565
HdInstancer::GetBuiltinPrimvarNames()
6666
{
67-
if (TfGetEnvSetting(HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES)) {
68-
static const TfTokenVector primvarNames = {
69-
HdInstancerTokens->instanceTransform,
70-
HdInstancerTokens->rotate,
71-
HdInstancerTokens->scale,
72-
HdInstancerTokens->translate
73-
};
74-
return primvarNames;
75-
}
7667
static const TfTokenVector primvarNames = {
7768
HdInstancerTokens->instanceTransforms,
7869
HdInstancerTokens->instanceRotations,

pxr/imaging/hd/testenv/testHdInstancerDeprecatedPrimvars.cpp

Lines changed: 0 additions & 75 deletions
This file was deleted.

pxr/imaging/hd/tokens.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525

2626
PXR_NAMESPACE_OPEN_SCOPE
2727

28-
// XXX: Remove this in 24.05. Until then, external users may
29-
// set this to true to maintain compatability with hydra backends that have
30-
// not yet been updated to use the new hydra-namespaced names.
31-
TF_DEFINE_ENV_SETTING(HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES, false,
32-
"enable to use pre-23.11 internal instancer primvar names");
33-
3428
TF_DEFINE_PUBLIC_TOKENS(HdTokens, HD_TOKENS);
3529

3630
TF_DEFINE_PUBLIC_TOKENS(HdInstancerTokens, HD_INSTANCER_TOKENS);

pxr/imaging/hd/tokens.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
PXR_NAMESPACE_OPEN_SCOPE
3434

35-
extern HD_API TfEnvSetting<bool> HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES;
36-
3735
#define HD_TOKENS \
3836
(accelerations) \
3937
(adjacency) \
@@ -141,15 +139,7 @@ extern HD_API TfEnvSetting<bool> HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES;
141139
((instanceTransforms, "hydra:instanceTransforms")) \
142140
((instanceRotations, "hydra:instanceRotations")) \
143141
((instanceScales, "hydra:instanceScales")) \
144-
((instanceTranslations, "hydra:instanceTranslations")) \
145-
\
146-
/* Deprecated versions of the above */ \
147-
/* To be removed in 2024, along with the */ \
148-
/* HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES env var*/ \
149-
(instanceTransform) \
150-
(rotate) \
151-
(scale) \
152-
(translate)
142+
((instanceTranslations, "hydra:instanceTranslations"))
153143

154144
#define HD_REPR_TOKENS \
155145
(disabled) \

pxr/imaging/hd/unitTestDelegate.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,18 +1077,15 @@ HdUnitTestDelegate::Get(SdfPath const& id, TfToken const& key)
10771077
else if(_points.find(id) != _points.end()) {
10781078
return VtValue(_points[id].points);
10791079
}
1080-
} else if (key == HdInstancerTokens->instanceScales ||
1081-
key == HdInstancerTokens->scale) {
1080+
} else if (key == HdInstancerTokens->instanceScales) {
10821081
if (_instancers.find(id) != _instancers.end()) {
10831082
return VtValue(_instancers[id].scale);
10841083
}
1085-
} else if (key == HdInstancerTokens->instanceRotations ||
1086-
key == HdInstancerTokens->rotate) {
1084+
} else if (key == HdInstancerTokens->instanceRotations) {
10871085
if (_instancers.find(id) != _instancers.end()) {
10881086
return VtValue(_instancers[id].rotate);
10891087
}
1090-
} else if (key == HdInstancerTokens->instanceTranslations ||
1091-
key == HdInstancerTokens->translate) {
1088+
} else if (key == HdInstancerTokens->instanceTranslations) {
10921089
if (_instancers.find(id) != _instancers.end()) {
10931090
return VtValue(_instancers[id].translate);
10941091
}
@@ -1126,18 +1123,15 @@ HdUnitTestDelegate::GetIndexedPrimvar(SdfPath const& id, TfToken const& key,
11261123
else if(_points.find(id) != _points.end()) {
11271124
return VtValue(_points[id].points);
11281125
}
1129-
} else if (key == HdInstancerTokens->instanceScales ||
1130-
key == HdInstancerTokens->scale) {
1126+
} else if (key == HdInstancerTokens->instanceScales) {
11311127
if (_instancers.find(id) != _instancers.end()) {
11321128
return VtValue(_instancers[id].scale);
11331129
}
1134-
} else if (key == HdInstancerTokens->instanceRotations ||
1135-
key == HdInstancerTokens->rotate) {
1130+
} else if (key == HdInstancerTokens->instanceRotations) {
11361131
if (_instancers.find(id) != _instancers.end()) {
11371132
return VtValue(_instancers[id].rotate);
11381133
}
1139-
} else if (key == HdInstancerTokens->instanceTranslations ||
1140-
key == HdInstancerTokens->translate) {
1134+
} else if (key == HdInstancerTokens->instanceTranslations) {
11411135
if (_instancers.find(id) != _instancers.end()) {
11421136
return VtValue(_instancers[id].translate);
11431137
}
@@ -1181,18 +1175,12 @@ HdUnitTestDelegate::GetPrimvarDescriptors(SdfPath const& id,
11811175
}
11821176
if (interpolation == HdInterpolationInstance && _hasInstancePrimvars &&
11831177
_instancers.find(id) != _instancers.end()) {
1184-
if (TfGetEnvSetting(HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES)) {
1185-
primvars.emplace_back(HdInstancerTokens->scale, interpolation);
1186-
primvars.emplace_back(HdInstancerTokens->rotate, interpolation);
1187-
primvars.emplace_back(HdInstancerTokens->translate, interpolation);
1188-
} else {
1189-
primvars.emplace_back(HdInstancerTokens->instanceScales,
1190-
interpolation);
1191-
primvars.emplace_back(HdInstancerTokens->instanceRotations,
1192-
interpolation);
1193-
primvars.emplace_back(HdInstancerTokens->instanceTranslations,
1194-
interpolation);
1195-
}
1178+
primvars.emplace_back(HdInstancerTokens->instanceScales,
1179+
interpolation);
1180+
primvars.emplace_back(HdInstancerTokens->instanceRotations,
1181+
interpolation);
1182+
primvars.emplace_back(HdInstancerTokens->instanceTranslations,
1183+
interpolation);
11961184
}
11971185

11981186
auto const cit = _primvars.find(id);

pxr/imaging/hd/version.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@
100100
// scene index prims.
101101
// 65 -> 66: Make HdSchema::_GetTypedDataSource and getters in generated
102102
// hydra schemas const.
103+
// 66 -> 67: Removes legacy internal instancer primvar names and the
104+
// TfEnvSetting for using them (see 56).
103105
//
104106

105-
#define HD_API_VERSION 66
107+
#define HD_API_VERSION 67
106108

107109
// 1 -> 2: SimpleLighting -> FallbackLighting
108110
#define HD_SHADER_API 2

pxr/imaging/hdSt/instancer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ HdStInstancer::_SyncPrimvars(HdSceneDelegate *sceneDelegate,
8383
VtValue value = sceneDelegate->Get(instancerId, primvar.name);
8484
if (!value.IsEmpty()) {
8585
HdBufferSourceSharedPtr source;
86-
if ((primvar.name == HdInstancerTokens->instanceTransform ||
87-
primvar.name == HdInstancerTokens->instanceTransforms)) {
86+
if (primvar.name == HdInstancerTokens->instanceTransforms) {
8887
if (value.IsHolding<VtArray<GfMatrix4d>>()) {
8988
// Explicitly invoke the c'tor taking a
9089
// VtArray<GfMatrix4d> to ensure we properly convert to

pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ CodeGenTest(HdSt_ShaderKey const &key, bool useBindlessBuffer,
223223
{
224224
HdBufferSpecVector bufferSpecs;
225225
bufferSpecs.emplace_back(
226-
(TfGetEnvSetting(HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES)
227-
? HdInstancerTokens->translate
228-
: HdInstancerTokens->instanceTranslations),
226+
HdInstancerTokens->instanceTranslations,
229227
HdTupleType { HdTypeFloatVec3, 1 });
230228
HdBufferArrayRangeSharedPtr range =
231229
registry->AllocateNonUniformBufferArrayRange(

pxr/imaging/hdx/unitTestDelegate.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -851,18 +851,15 @@ Hdx_UnitTestDelegate::Get(SdfPath const& id, TfToken const& key)
851851
if(_meshes.find(id) != _meshes.end()) {
852852
return VtValue(_meshes[id].opacity);
853853
}
854-
} else if (key == HdInstancerTokens->instanceScales ||
855-
key == HdInstancerTokens->scale) {
854+
} else if (key == HdInstancerTokens->instanceScales) {
856855
if (_instancers.find(id) != _instancers.end()) {
857856
return VtValue(_instancers[id].scale);
858857
}
859-
} else if (key == HdInstancerTokens->instanceRotations ||
860-
key == HdInstancerTokens->rotate) {
858+
} else if (key == HdInstancerTokens->instanceRotations) {
861859
if (_instancers.find(id) != _instancers.end()) {
862860
return VtValue(_instancers[id].rotate);
863861
}
864-
} else if (key == HdInstancerTokens->instanceTranslations ||
865-
key == HdInstancerTokens->translate) {
862+
} else if (key == HdInstancerTokens->instanceTranslations) {
866863
if (_instancers.find(id) != _instancers.end()) {
867864
return VtValue(_instancers[id].translate);
868865
}
@@ -951,18 +948,12 @@ Hdx_UnitTestDelegate::GetPrimvarDescriptors(SdfPath const& id,
951948
}
952949
if (interpolation == HdInterpolationInstance &&
953950
_instancers.find(id) != _instancers.end()) {
954-
if (TfGetEnvSetting(HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES)) {
955-
primvars.emplace_back(HdInstancerTokens->scale, interpolation);
956-
primvars.emplace_back(HdInstancerTokens->rotate, interpolation);
957-
primvars.emplace_back(HdInstancerTokens->translate, interpolation);
958-
} else {
959-
primvars.emplace_back(HdInstancerTokens->instanceScales,
960-
interpolation);
961-
primvars.emplace_back(HdInstancerTokens->instanceRotations,
962-
interpolation);
963-
primvars.emplace_back(HdInstancerTokens->instanceTranslations,
964-
interpolation);
965-
}
951+
primvars.emplace_back(HdInstancerTokens->instanceScales,
952+
interpolation);
953+
primvars.emplace_back(HdInstancerTokens->instanceRotations,
954+
interpolation);
955+
primvars.emplace_back(HdInstancerTokens->instanceTranslations,
956+
interpolation);
966957
}
967958
return primvars;
968959
}

0 commit comments

Comments
 (0)